[Piglit] [PATCH 2/5] Add noreturn attribute on clang
Jan Vesely
jan.vesely at rutgers.edu
Wed Dec 3 12:53:29 PST 2014
Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
---
Clang also defines __GNUC__, but it feels better not to rely on it
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 af9fb97..e869dc2 100755
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -53,6 +53,10 @@ extern "C" {
#include "piglit-log.h"
+#ifndef __has_attribute
+#define __has_attribute(x) 0
+#endif
+
#if defined(_MSC_VER)
/* windows.h won't define min/max macros if NOMINMAX is defined, however
@@ -78,7 +82,7 @@ extern "C" {
#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
More information about the Piglit
mailing list