[Piglit] [PATCH] util: Mark piglit_report_result with noreturn attribute.

Ian Romanick idr at freedesktop.org
Tue Feb 18 15:59:12 PST 2014


On 02/10/2014 09:53 PM, Vinson Lee wrote:
> This silences several false compiler warnings with Clang.

At some point someone may try to compile this on an ancient GCC that
doesn't have noreturn, but that guy can submit a patch to fix it. :)

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
>  tests/util/piglit-util.h | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
> index 96b31d5..14abd69 100644
> --- a/tests/util/piglit-util.h
> +++ b/tests/util/piglit-util.h
> @@ -84,6 +84,14 @@ lround(double x) {
>  #define PRINTFLIKE(f, a)
>  #endif
>  
> +#if defined(__GNUC__)
> +#define NORETURN __attribute__((noreturn))
> +#elif defined(_MSC_VER)
> +#define NORETURN __declspec(noreturn)
> +#else
> +#define NORETURN
> +#endif
> +
>  #ifndef HAVE_ASPRINTF
>  int asprintf(char **strp, const char *fmt, ...) PRINTFLIKE(2, 3);
>  #endif /* HAVE_ASPRINTF */
> @@ -142,7 +150,7 @@ bool piglit_is_extension_in_array(const char **haystack, const char *needle);
>  int piglit_find_line(const char *program, int position);
>  void piglit_merge_result(enum piglit_result *all, enum piglit_result subtest);
>  const char * piglit_result_to_string(enum piglit_result result);
> -void piglit_report_result(enum piglit_result result);
> +void piglit_report_result(enum piglit_result result) NORETURN;
>  void piglit_report_subtest_result(enum piglit_result result,
>  				  const char *format, ...) PRINTFLIKE(2, 3);
>  




More information about the Piglit mailing list