Merge compiler/gcc4.h into compiler/compiler.h
authorBart Van Assche <bvanassche@acm.org>
Mon, 22 Jun 2020 15:21:06 +0000 (08:21 -0700)
committerBart Van Assche <bvanassche@acm.org>
Wed, 24 Jun 2020 02:28:27 +0000 (19:28 -0700)
Follow the example of the Linux kernel and merge the file compiler/gcc4.h
into compiler/gcc.h. Additionally, enable __must_check,
__compiletime_warning() and __compiletime_error() for clang.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
compiler/compiler-gcc4.h [deleted file]
compiler/compiler.h

diff --git a/compiler/compiler-gcc4.h b/compiler/compiler-gcc4.h
deleted file mode 100644 (file)
index e8701cf..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef FIO_COMPILER_GCC4_H
-#define FIO_COMPILER_GCC4_H
-
-#ifndef __must_check
-#define __must_check           __attribute__((warn_unused_result))
-#endif
-
-#define GCC_VERSION (__GNUC__ * 10000          \
-                       + __GNUC_MINOR__ * 100  \
-                       + __GNUC_PATCHLEVEL__)
-
-#if GCC_VERSION >= 40300
-#define __compiletime_warning(message) __attribute__((warning(message)))
-#define __compiletime_error(message)   __attribute__((error(message)))
-#endif
-
-#endif
index 8eba2929f6b3f8e9cd431b12ac186b62921712d4..8c0eb9d10d210c5f6e92be3e062ca9ddf8076558 100644 (file)
@@ -3,15 +3,15 @@
 
 /* IWYU pragma: begin_exports */
 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9) || __clang_major__ >= 6
-#include "compiler-gcc4.h"
 #else
 #error Compiler too old, need at least gcc 4.9
 #endif
 /* IWYU pragma: end_exports */
 
-#ifndef __must_check
-#define __must_check
-#endif
+#define __must_check           __attribute__((warn_unused_result))
+
+#define __compiletime_warning(message) __attribute__((warning(message)))
+#define __compiletime_error(message)   __attribute__((error(message)))
 
 /*
  * Mark unused variables passed to ops functions as unused, to silence gcc