[Piglit] [PATCH] cl-program-tester: Add NORETURN attribute to exit_report_result.

Jan Vesely jan.vesely at rutgers.edu
Tue Sep 2 06:39:48 PDT 2014


On Mon, 2014-09-01 at 21:03 -0700, Vinson Lee wrote:
> Fix clang sometimes-uninitialized warning.
> 
> program-tester.c:1523:12: warning: variable 'main_argument_type' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
>         } else if(regex_match(main_argument, "\\.bin$")) {
>                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> program-tester.c:1542:9: note: uninitialized use occurs here
>         switch(main_argument_type) {
>                ^~~~~~~~~~~~~~~~~~
> program-tester.c:1523:9: note: remove the 'if' if its condition is always true
>         } else if(regex_match(main_argument, "\\.bin$")) {
>                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> program-tester.c:1455:2: note: variable 'main_argument_type' is declared here
>         enum main_argument_type_t {
>         ^
> 
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
>  tests/cl/program/program-tester.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/cl/program/program-tester.c b/tests/cl/program/program-tester.c
> index a51f148..38a9379 100644
> --- a/tests/cl/program/program-tester.c
> +++ b/tests/cl/program/program-tester.c
> @@ -451,7 +451,7 @@ clean(const int argc,
>  	free_tests();
>  }
>  
> -void
> +NORETURN void
>  exit_report_result(enum piglit_result result)
>  {
>  	free_dynamic_strs();

I think it'd be nice to add a clang ifdef to piglit-util.h instead of
relying on clang defining __GNUC__.

either way
Reviewed-by: Jan Vesely <jan.vesely at rutgers.edu>

-- 
Jan Vesely <jan.vesely at rutgers.edu>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20140902/301fea10/attachment.sig>


More information about the Piglit mailing list