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

Vinson Lee vlee at freedesktop.org
Sun Oct 19 13:29:43 PDT 2014


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"
-- 
1.9.2



More information about the Piglit mailing list