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

Brian Paul brianp at vmware.com
Mon Jul 28 10:18:45 PDT 2014


On 07/18/2014 03:11 PM, Vinson Lee wrote:
> Silence clang sometimes-uninitialized warnings.
>
> clip-and-scissor-blit.cpp:362:13: warning: variable 'src_samples' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
>          } else if (strcmp(argv[2], "normal") == 0) {
>                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> clip-and-scissor-blit.cpp:369:26: note: uninitialized use occurs here
>          src_fbo.setup(FboConfig(src_samples, src_size[0], src_size[1]));
>                                  ^~~~~~~~~~~
> clip-and-scissor-blit.cpp:362:9: note: remove the 'if' if its condition is always true
>          } else if (strcmp(argv[2], "normal") == 0) {
>                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> clip-and-scissor-blit.cpp:352:17: note: initialize the variable 'src_samples' to silence this warning
>          int src_samples;
>                         ^
>                          = 0
> clip-and-scissor-blit.cpp:362:13: warning: variable 'dst_samples' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
>          } else if (strcmp(argv[2], "normal") == 0) {
>                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> clip-and-scissor-blit.cpp:370:26: note: uninitialized use occurs here
>          dst_fbo.setup(FboConfig(dst_samples, dst_size[0], dst_size[1]));
>                                  ^~~~~~~~~~~
> clip-and-scissor-blit.cpp:362:9: note: remove the 'if' if its condition is always true
>          } else if (strcmp(argv[2], "normal") == 0) {
>                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> clip-and-scissor-blit.cpp:353:17: note: initialize the variable 'dst_samples' to silence this warning
>          int dst_samples;
>                         ^
>                          = 0
>
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
>   tests/spec/ext_framebuffer_multisample/clip-and-scissor-blit.cpp | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/spec/ext_framebuffer_multisample/clip-and-scissor-blit.cpp b/tests/spec/ext_framebuffer_multisample/clip-and-scissor-blit.cpp
> index a9a9304..b48930c 100644
> --- a/tests/spec/ext_framebuffer_multisample/clip-and-scissor-blit.cpp
> +++ b/tests/spec/ext_framebuffer_multisample/clip-and-scissor-blit.cpp
> @@ -312,7 +312,7 @@ do_test(int coord, bool clip_low, test_type_enum test_type,
>   						   dst_size[1]);
>   }
>
> -void
> +NORETURN void
>   print_usage_and_exit(char *prog_name)
>   {
>   	printf("Usage: %s <num_samples> <blit_type>\n"
>

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



More information about the Piglit mailing list