[Piglit] [PATCH] varying-packing-simple: Add NORETURN attribute to print_usage_and_exit.

Brian Paul brianp at vmware.com
Tue Oct 28 07:02:05 PDT 2014


On 10/27/2014 11:03 PM, Vinson Lee wrote:
> Silence clang sometimes-uninitialized warnings.
>
> simple.c:368:6: warning: variable 'test_type' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
>          if (all_types[i])
>              ^~~~~~~~~~~~
> simple.c:380:30: note: uninitialized use occurs here
>          piglit_require_GLSL_version(test_type->glsl_version_required);
>                                      ^~~~~~~~~
> simple.c:368:2: note: remove the 'if' if its condition is always true
>          if (all_types[i])
>          ^~~~~~~~~~~~~~~~~
> simple.c:355:35: note: initialize the variable 'test_type' to silence this warning
>          const struct type_desc *test_type;
>                                           ^
>                                            = NULL
> simple.c:374:11: warning: variable 'test_array' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
>          else if (strcmp(argv[2], "separate") == 0)
>                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> simple.c:385:12: note: uninitialized use occurs here
>                                         test_array, max_varying_floats);
>                                         ^~~~~~~~~~
> simple.c:374:7: note: remove the 'if' if its condition is always true
>          else if (strcmp(argv[2], "separate") == 0)
>               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> simple.c:356:22: note: initialize the variable 'test_array' to silence this warning
>          GLboolean test_array;
>                              ^
>                               = '\0'
>
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
>   tests/spec/glsl-1.10/execution/varying-packing/simple.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/spec/glsl-1.10/execution/varying-packing/simple.c b/tests/spec/glsl-1.10/execution/varying-packing/simple.c
> index 87ff37e..6d07a36 100644
> --- a/tests/spec/glsl-1.10/execution/varying-packing/simple.c
> +++ b/tests/spec/glsl-1.10/execution/varying-packing/simple.c
> @@ -335,7 +335,7 @@ choose_varyings(struct varying_desc *varyings,
>   }
>
>   void
> -print_usage_and_exit(const char *prog_name)
> +NORETURN print_usage_and_exit(const char *prog_name)
>   {
>   	unsigned i;
>   	printf("Usage: %s <type> <arrayspec>\n"
>

Reviewed-by: Brian Paul <brianp at vmware.com>



More information about the Piglit mailing list