Go to the documentation of this file.
8 #ifndef RMF_INTERNAL_COMPILER_MACROS_H
9 #define RMF_INTERNAL_COMPILER_MACROS_H
11 #define RMF_STRINGIFY(x) #x
15 #define __func__ __FUNCTION__
16 #elif defined(__STDC_VERSION__) && __STDC_VERSION__ < 199901L
18 #define __func__ __FUNCTION__
20 #define __func__ "<unknown>"
25 #define RMF_OVERRIDE override
28 #define RMF_FINAL final
31 #define RMF_NOEXCEPT noexcept
32 #define RMF_CANEXCEPT noexcept(false)
34 #define RMF_CXX11_DEFAULT_COPY_CONSTRUCTOR(Name) \
35 Name(const Name &) = default; \
36 Name &operator=(const Name &) = default
38 #if defined(__clang__) || defined(__GNUC__)
39 #define RMF_PRAGMA(x) _Pragma(RMF_STRINGIFY(x))
40 #elif defined(_MSC_VER)
41 #define RMF_PRAGMA(x) __pragma(x)
47 #if defined(__clang__)
48 #define RMF_CLANG_PRAGMA(x) RMF_PRAGMA(clang x)
49 #define RMF_GCC_PRAGMA(x)
50 #define RMF_VC_PRAGMA(x)
52 #elif defined(__GNUC__)
53 #define RMF_CLANG_PRAGMA(x)
54 #define RMF_GCC_PRAGMA(x) RMF_PRAGMA(GCC x)
55 #define RMF_VC_PRAGMA(x)
57 #elif defined(_MSC_VER)
58 #define RMF_CLANG_PRAGMA(x)
59 #define RMF_GCC_PRAGMA(x)
60 #define RMF_VC_PRAGMA(x) RMF_PRAGMA(x)
63 #define RMF_CLANG_PRAGMA(x)
64 #define RMF_GCC_PRAGMA(x)
65 #define RMF_VC_PRAGMA(x)
69 #if defined(__clang__)
70 #define RMF_PUSH_WARNINGS RMF_CLANG_PRAGMA(diagnostic push)
71 #define RMF_POP_WARNINGS RMF_CLANG_PRAGMA(diagnostic pop)
73 #elif defined(__GNUC__)
74 #if __GNUC__ > 4 || __GNUC_MINOR__ >= 6
75 #define RMF_PUSH_WARNINGS RMF_GCC_PRAGMA(diagnostic push)
76 #define RMF_POP_WARNINGS RMF_GCC_PRAGMA(diagnostic pop)
79 #define RMF_PUSH_WARNINGS
80 #define RMF_POP_WARNINGS
84 #elif defined(_MSC_VER)
85 #define RMF_PUSH_WARNINGS RMF_VC_PRAGMA(warning(push))
86 #define RMF_POP_WARNINGS RMF_VC_PRAGMA(warning(pop))
89 #define RMF_PUSH_WARNINGS
90 #define RMF_POP_WARNINGS
96 #define RMF_COMPILER_WARNINGS \
97 RMF_CLANG_PRAGMA(diagnostic warning "-Wall") \
98 RMF_CLANG_PRAGMA(diagnostic warning "-Wextra") \
99 RMF_CLANG_PRAGMA(diagnostic ignored "-Wconversion") \
100 RMF_CLANG_PRAGMA(diagnostic ignored "-Wc++11-extensions") \
101 RMF_CLANG_PRAGMA(diagnostic ignored "-Wc++11-compat") \
102 RMF_CLANG_PRAGMA(diagnostic ignored "-Wunused-member-function")
104 #elif defined(__GNUC__)
109 #if __GNUC__ > 4 || __GNUC_MINOR__ >= 6
110 #define RMF_GCC_CXX0X_COMPAT \
111 RMF_GCC_PRAGMA(diagnostic ignored \
113 #ifdef RMF_SWIG_WRAPPER
114 #define RMF_GCC_PROTOTYPES
116 #define RMF_GCC_PROTOTYPES \
117 RMF_GCC_PRAGMA(diagnostic warning "-Wmissing-declarations")
121 #define RMF_GCC_CXX0X_COMPAT
122 #define RMF_GCC_PROTOTYPES
126 #if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
127 #ifdef RMF_SWIG_WRAPPER
128 #define RMF_GCC_OVERRIDE
130 #define RMF_GCC_OVERRIDE \
131 RMF_GCC_PRAGMA(diagnostic warning "-Wsuggest-override")
134 #define RMF_GCC_OVERRIDE
137 #define RMF_COMPILER_WARNINGS \
138 RMF_GCC_PRAGMA(diagnostic warning "-Wall") \
139 RMF_GCC_PRAGMA(diagnostic warning "-Wextra") \
140 RMF_GCC_PRAGMA(diagnostic warning "-Winit-self") \
141 RMF_GCC_PRAGMA(diagnostic warning "-Wcast-align") \
142 RMF_GCC_PRAGMA(diagnostic warning "-Woverloaded-virtual") \
143 RMF_GCC_PRAGMA(diagnostic ignored "-Wconversion") \
144 RMF_GCC_PRAGMA(diagnostic warning "-Wundef") \
145 RMF_GCC_PROTOTYPES RMF_GCC_CXX0X_COMPAT RMF_GCC_OVERRIDE
147 #elif defined(_MSC_VER)
148 #define RMF_COMPILER_WARNINGS \
149 RMF_VC_PRAGMA(warning(disable : 4275; disable : 4251; disable : 4244; disable : 4068; disable : 4297))
152 #define RMF_COMPILER_WARNINGS
156 #define RMF_ENABLE_WARNINGS RMF_PUSH_WARNINGS RMF_COMPILER_WARNINGS
158 #define RMF_DISABLE_WARNINGS RMF_POP_WARNINGS