[Piglit] [PATCH] ext_framebuffer_multisample: Add NORETURN attribute to print_usage_and_exit.

Brian Paul brianp at vmware.com
Mon Jul 7 07:26:53 PDT 2014


On 07/03/2014 06:04 PM, Vinson Lee wrote:
> Silence clang sometimes-uninitialized warning.
>
> accuracy.cpp:130:13: warning: variable 'test_type' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
>          } else if (strcmp(argv[2], "depth_resolve") == 0) {
>                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> accuracy.cpp:135:21: note: uninitialized use occurs here
>          test = create_test(test_type, num_samples, small,
>                             ^~~~~~~~~
> accuracy.cpp:130:9: note: remove the 'if' if its condition is always true
>          } else if (strcmp(argv[2], "depth_resolve") == 0) {
>                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> accuracy.cpp:119:2: note: variable 'test_type' is declared here
>          test_type_enum test_type;
>          ^
>
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
>   tests/spec/ext_framebuffer_multisample/accuracy.cpp | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/spec/ext_framebuffer_multisample/accuracy.cpp b/tests/spec/ext_framebuffer_multisample/accuracy.cpp
> index 2c0d445..8299f79 100644
> --- a/tests/spec/ext_framebuffer_multisample/accuracy.cpp
> +++ b/tests/spec/ext_framebuffer_multisample/accuracy.cpp
> @@ -58,7 +58,7 @@ const int pattern_width = 256; const int pattern_height = 256;
>   const int supersample_factor = 16;
>   Test *test = NULL;
>
> -void
> +NORETURN void
>   print_usage_and_exit(char *prog_name)
>   {
>   	printf("Usage: %s <num_samples> <test_type> [options]\n"
>

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



More information about the Piglit mailing list