Re: [Piglit] [PATCH] cl-api-get-platform-ids: Initialize variable.

2014-07-03 Thread Tom Stellard
On Tue, Jul 01, 2014 at 10:38:56PM -0700, Vinson Lee wrote:
> Fix clang sometimes-uninitialized warning.
> 
> get-platform-ids.c:62:5: warning: variable 'platforms' is used uninitialized 
> whenever 'if' condition is true [-Wsometimes-uninitialized]
> if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
>^
> get-platform-ids.c:93:30: note: uninitialized use occurs here
> errNo = clGetPlatformIDs(0, platforms, NULL);
> ^
> get-platform-ids.c:62:2: note: remove the 'if' if its condition is always 
> false
> if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
> ^~~
> get-platform-ids.c:56:27: note: initialize the variable 'platforms' to 
> silence this warning
> cl_platform_id* platforms;
>  ^
>   = NULL
> 
Reviewed-by: Tom Stellard 
> Signed-off-by: Vinson Lee 
> ---
>  tests/cl/api/get-platform-ids.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/cl/api/get-platform-ids.c b/tests/cl/api/get-platform-ids.c
> index 6cc734a..f94ab0c 100644
> --- a/tests/cl/api/get-platform-ids.c
> +++ b/tests/cl/api/get-platform-ids.c
> @@ -53,7 +53,7 @@ piglit_cl_test(const int argc,
>   int i;
>   cl_int errNo;
>   cl_uint num_platforms;
> - cl_platform_id* platforms;
> + cl_platform_id* platforms = NULL;
>  
>   /*** Normal usage ***/
>  
> -- 
> 1.9.2
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] cl-api-get-platform-ids: Initialize variable.

2014-07-01 Thread Vinson Lee
Fix clang sometimes-uninitialized warning.

get-platform-ids.c:62:5: warning: variable 'platforms' is used uninitialized 
whenever 'if' condition is true [-Wsometimes-uninitialized]
if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
   ^
get-platform-ids.c:93:30: note: uninitialized use occurs here
errNo = clGetPlatformIDs(0, platforms, NULL);
^
get-platform-ids.c:62:2: note: remove the 'if' if its condition is always false
if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
^~~
get-platform-ids.c:56:27: note: initialize the variable 'platforms' to silence 
this warning
cl_platform_id* platforms;
 ^
  = NULL

Signed-off-by: Vinson Lee 
---
 tests/cl/api/get-platform-ids.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/cl/api/get-platform-ids.c b/tests/cl/api/get-platform-ids.c
index 6cc734a..f94ab0c 100644
--- a/tests/cl/api/get-platform-ids.c
+++ b/tests/cl/api/get-platform-ids.c
@@ -53,7 +53,7 @@ piglit_cl_test(const int argc,
int i;
cl_int errNo;
cl_uint num_platforms;
-   cl_platform_id* platforms;
+   cl_platform_id* platforms = NULL;
 
/*** Normal usage ***/
 
-- 
1.9.2

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit