On Mon, 2014-09-01 at 10:52 -0500, Aaron Watry wrote:
> Signed-off-by: Aaron Watry <[email protected]>
> ---
>  tests/cl/program/program-tester.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tests/cl/program/program-tester.c 
> b/tests/cl/program/program-tester.c
> index 0e35826..4798e59 100644
> --- a/tests/cl/program/program-tester.c
> +++ b/tests/cl/program/program-tester.c
> @@ -1546,6 +1546,7 @@ init(const int argc,
>               config_file = piglit_cl_get_arg_value(argc, argv, "config");
>               config_str = piglit_load_text_file(config_file, 
> &config_str_size);
>       } else {
> +             main_argument_type = ARG_BINARY;
>               fprintf(stderr, "Ops, this should not happen!\n");
>               exit_report_result(PIGLIT_WARN);
>       }

I know it's just to shut up clang warning, but I think it'd be better to
tell the compiler that exit_report_result does not return. See the
attached patches, they fix the problem for me (clang svn).

jan

-- 
Jan Vesely <[email protected]>
From 91471f10049b00200e44a7bfec4676a6f5529b91 Mon Sep 17 00:00:00 2001
From: Jan Vesely <[email protected]>
Date: Mon, 1 Sep 2014 16:33:35 -0400
Subject: [Piglit][PATCH 1/2] Use noreturn attribute on clang

Signed-off-by: Jan Vesely <[email protected]>
---
 tests/util/piglit-util.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
index 0f112ab..dc726d7 100644
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -47,6 +47,10 @@ extern "C" {
 
 #include "piglit-log.h"
 
+#ifndef __has_attribute
+#define __has_attribute(x) 0
+#endif
+
 #if defined(_MSC_VER)
 
 #if !defined(__cplusplus) && !defined(inline)
@@ -100,7 +104,7 @@ lround(double x) {
 #define PRINTFLIKE(f, a)
 #endif
 
-#if defined(__GNUC__)
+#if defined(__GNUC__) || __has_attribute(noreturn)
 #define NORETURN __attribute__((noreturn))
 #elif defined(_MSC_VER)
 #define NORETURN __declspec(noreturn)
-- 
1.9.3

From c06d245e4d67cc6278d67860fb2031cdf51323b4 Mon Sep 17 00:00:00 2001
From: Jan Vesely <[email protected]>
Date: Mon, 1 Sep 2014 16:35:24 -0400
Subject: [Piglit][PATCH 2/2] cl: Mark exit_export_resutls as noreturn.

clang for some reason can't deduce this from piglit_report_result attribute

Signed-off-by: Jan Vesely <[email protected]>
---
 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 332d733..d6dbc55 100644
--- a/tests/cl/program/program-tester.c
+++ b/tests/cl/program/program-tester.c
@@ -452,7 +452,7 @@ clean(const int argc,
 	free_tests();
 }
 
-void
+NORETURN void
 exit_report_result(enum piglit_result result)
 {
 	free_dynamic_strs();
-- 
1.9.3

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to