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

Brian Paul brianp at vmware.com
Mon Oct 20 07:33:15 PDT 2014


On 10/19/2014 02:29 PM, Vinson Lee wrote:
> Silence clang sometimes-uninitialized warnings.
>
> unaligned-blit.cpp:161:13: warning: variable 'src_samples' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
>          } else if (strcmp(argv[3], "downsample") == 0) {
>                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> unaligned-blit.cpp:171:26: note: uninitialized use occurs here
>          src_fbo.setup(FboConfig(src_samples, pattern_size, pattern_size));
>                                  ^~~~~~~~~~~
> unaligned-blit.cpp:161:9: note: remove the 'if' if its condition is always true
>          } else if (strcmp(argv[3], "downsample") == 0) {
>                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> unaligned-blit.cpp:121:17: note: initialize the variable 'src_samples' to silence this warning
>          int src_samples;
>                         ^
>                          = 0
> unaligned-blit.cpp:161:13: warning: variable 'dst_samples' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
>          } else if (strcmp(argv[3], "downsample") == 0) {
>                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> unaligned-blit.cpp:172:26: note: uninitialized use occurs here
>          dst_fbo.setup(FboConfig(dst_samples, pattern_size, pattern_size));
>                                  ^~~~~~~~~~~
> unaligned-blit.cpp:161:9: note: remove the 'if' if its condition is always true
>          } else if (strcmp(argv[3], "downsample") == 0) {
>                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> unaligned-blit.cpp:122: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/unaligned-blit.cpp | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/spec/ext_framebuffer_multisample/unaligned-blit.cpp b/tests/spec/ext_framebuffer_multisample/unaligned-blit.cpp
> index d18f3dd..4237b50 100644
> --- a/tests/spec/ext_framebuffer_multisample/unaligned-blit.cpp
> +++ b/tests/spec/ext_framebuffer_multisample/unaligned-blit.cpp
> @@ -99,7 +99,7 @@ scrambling_blit(const int *permutation)
>   }
>
>   void
> -print_usage_and_exit(char *prog_name)
> +NORETURN print_usage_and_exit(char *prog_name)
>   {
>   	printf("Usage: %s <num_samples> <buffer_type> <blit_type>\n"
>   	       "  where <buffer_type> is one of:\n"
>

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




More information about the Piglit mailing list