From: Bart Van Assche Date: Mon, 22 Jun 2020 15:21:06 +0000 (-0700) Subject: Merge compiler/gcc4.h into compiler/compiler.h X-Git-Tag: fio-3.21~23^2 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=0e7e072539f4478a3ef650e4fc76c2f0cd95d5a9;hp=c7f72c4bdb3586025cc7c5da707e69cc7a1baf07;p=fio.git Merge compiler/gcc4.h into compiler/compiler.h 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 --- diff --git a/compiler/compiler-gcc4.h b/compiler/compiler-gcc4.h deleted file mode 100644 index e8701cf0..00000000 --- a/compiler/compiler-gcc4.h +++ /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 diff --git a/compiler/compiler.h b/compiler/compiler.h index 8eba2929..8c0eb9d1 100644 --- a/compiler/compiler.h +++ b/compiler/compiler.h @@ -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