Browse Source

try allowing clang to see Gcc_NORETURN

Caleb James DeLisle 9 years ago
parent
commit
07be184ee3
2 changed files with 25 additions and 9 deletions
  1. 0 1
      memory/Allocator.c
  2. 25 8
      util/Gcc.h

+ 0 - 1
memory/Allocator.c

@@ -384,7 +384,6 @@ static int pivotChildrenToAdoptedParents(struct Allocator_pvt* context, const ch
         }
     }
     Assert_failure("Didn't free all allocators in 10000 deep iterations");
-    return 0; // some compilers are a bit slow.
 }
 
 /**

+ 25 - 8
util/Gcc.h

@@ -37,14 +37,31 @@
 #define Gcc_ALLOC_SIZE(...) \
     __attribute__ ((alloc_size(__VA_ARGS__)))
 
-#else
-
-#define Gcc_PRINTF( format_idx, arg_idx )
-#define Gcc_NORETURN
-#define Gcc_NONNULL(...)
-#define Gcc_PURE
-#define Gcc_PACKED
-#define Gcc_ALLOC_SIZE(...)
+#elif defined(__clang__)
+
+#define Gcc_NORETURN \
+    __attribute__((__noreturn__))
+
+#endif
+
+#ifndef Gcc_PRINTF
+    #define Gcc_PRINTF( format_idx, arg_idx )
+#endif
+#ifndef Gcc_NORETURN
+    #define Gcc_NORETURN
+#endif
+#ifndef Gcc_NONNULL
+    #define Gcc_NONNULL(...)
+#endif
+#ifndef Gcc_PURE
+    #define Gcc_PURE
+#endif
+#ifndef Gcc_PACKED
+    #define Gcc_PACKED
+#endif
+#ifndef Gcc_ALLOC_SIZE
+    #define Gcc_ALLOC_SIZE(...)
+#endif
 
 #endif