19#define CLANG_VERSION ((__clang_major__ * 100) + __clang_minor__)
22#if defined(__GNUC__) && !(defined(__INTEL_COMPILER)) && !defined(__clang__)
23#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
26#if defined(GCC_VERSION) || defined(CLANG_VERSION)
28#define GNU_DIAG_MAKE_WARNING(x) "-W" x
29#define GNU_DIAG_DO_PRAGMA(x) _Pragma(#x)
31#if defined(GCC_VERSION)
32#define GNU_DIAG_PRAGMA(x) GNU_DIAG_DO_PRAGMA(GCC diagnostic x)
34#define GNU_DIAG_PRAGMA(x) GNU_DIAG_DO_PRAGMA(clang diagnostic x)
45#if defined(GCC_VERSION)
50#define GNU_DIAG_OFF(x) \
51 GNU_DIAG_PRAGMA(push) \
52 GNU_DIAG_PRAGMA(ignored GNU_DIAG_MAKE_WARNING("pragmas")) \
53 GNU_DIAG_PRAGMA(ignored GNU_DIAG_MAKE_WARNING(x))
54#define GNU_DIAG_ON(x) GNU_DIAG_PRAGMA(pop)
58#elif defined(CLANG_VERSION) && CLANG_VERSION >= 306
63#define GNU_DIAG_OFF(x) \
64 GNU_DIAG_PRAGMA(push) \
65 GNU_DIAG_PRAGMA(ignored GNU_DIAG_MAKE_WARNING("unknown-pragmas")) \
66 GNU_DIAG_PRAGMA(ignored GNU_DIAG_MAKE_WARNING("unknown-warning-option")) \
67 GNU_DIAG_PRAGMA(ignored GNU_DIAG_MAKE_WARNING(x))
68#define GNU_DIAG_ON(x) GNU_DIAG_PRAGMA(pop)
73#define GNU_DIAG_OFF(x)
80#define MSVC_DIAG_OFF(id) \
81 __pragma(warning(push)) \
82 __pragma(warning(disable : id))
83#define MSVC_DIAG_ON(id) __pragma(warning(pop))
86#define MSVC_DIAG_OFF(x)
87#define MSVC_DIAG_ON(x)
93#if defined(__cplusplus) && defined(GCC_VERSION) && GCC_VERSION >= 50000
94#define GNU_DIAG_OFF_SUGGEST_OVERRIDE GNU_DIAG_OFF("suggest-override")
95#define GNU_DIAG_ON_SUGGEST_OVERRIDE GNU_DIAG_ON("suggest-override")
96#elif defined(__cplusplus) && defined(CLANG_VERSION) && CLANG_VERSION >= 306
97#define GNU_DIAG_OFF_SUGGEST_OVERRIDE GNU_DIAG_OFF("inconsistent-missing-override")
98#define GNU_DIAG_ON_SUGGEST_OVERRIDE GNU_DIAG_ON("inconsistent-missing-override")
100#define GNU_DIAG_OFF_SUGGEST_OVERRIDE
101#define GNU_DIAG_ON_SUGGEST_OVERRIDE
105#if defined(GCC_VERSION) || defined(CLANG_VERSION)
106#define GNU_UNUSED_FUNCTION __attribute__((unused))
108#define GNU_UNUSED_FUNCTION