cl-api-compile-program: Initialize variable

Graphics / Mesa 3D Graphics Library / Piglit - Vinson Lee [freedesktop.org] - 4 December 2014 00:37 UTC

This patch silences Clang sometimes-uninitialized warnings.

compile-program.c:312:6: warning: variable 'kernel' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if(!piglit_cl_check_error(errNo, CL_SUCCESS)) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compile-program.c:332:18: note: uninitialized use occurs here clReleaseKernel(kernel); ^~~~~~ compile-program.c:312:3: note: remove the 'if' if its condition is always false if(!piglit_cl_check_error(errNo, CL_SUCCESS)) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compile-program.c:302:5: warning: variable 'kernel' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if(!piglit_cl_check_error(errNo, CL_SUCCESS)) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compile-program.c:332:18: note: uninitialized use occurs here clReleaseKernel(kernel); ^~~~~~ compile-program.c:302:2: note: remove the 'if' if its condition is always false if(!piglit_cl_check_error(errNo, CL_SUCCESS)) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compile-program.c:114:18: note: initialize the variable 'kernel' to silence this warning cl_kernel kernel; ^
= NULL

358781d cl-api-compile-program: Initialize variable.
tests/cl/api/compile-program.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Upstream: cgit.freedesktop.org


  • Share