Go to the documentation of this file.
11 #ifndef __SYS_PRAGMA_H_INCLUDED__
12 #define __SYS_PRAGMA_H_INCLUDED__
18 # define SYS_PRAGMA(X) __pragma(X)
19 #elif defined(__GNUC__)
20 # define SYS_PRAGMA(X) _Pragma(#X)
22 # define SYS_PRAGMA(X)
28 # define SYS_PRAGMA_PUSH_WARN() SYS_PRAGMA(warning(push))
29 # define SYS_PRAGMA_POP_WARN() SYS_PRAGMA(warning(pop))
30 #elif SYS_IS_GCC_GE(4, 6) || defined(__clang__)
31 # define SYS_PRAGMA_PUSH_WARN() SYS_PRAGMA(GCC diagnostic push)
32 # define SYS_PRAGMA_POP_WARN() SYS_PRAGMA(GCC diagnostic pop)
34 # define SYS_PRAGMA_PUSH_WARN()
35 # define SYS_PRAGMA_POP_WARN()
41 #if SYS_IS_GCC_GE(4, 2) || defined(__clang__)
42 # define SYS_PRAGMA_DISABLE_DEPRECATED() \
43 SYS_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations")
44 #elif defined(_MSC_VER)
45 # define SYS_PRAGMA_DISABLE_DEPRECATED() \
46 SYS_PRAGMA(warning(disable: 4996))
48 # define SYS_PRAGMA_DISABLE_DEPRECATED()
51 # define SYS_PRAGMA_DISABLE_OVERLOADED_VIRTUAL() \
52 SYS_PRAGMA(warning(disable: 4263)) \
53 SYS_PRAGMA(warning(disable: 4266)) \
55 #elif SYS_IS_GCC_GE(4, 6) || defined(__clang__)
56 # define SYS_PRAGMA_DISABLE_OVERLOADED_VIRTUAL() \
57 SYS_PRAGMA(GCC diagnostic ignored "-Woverloaded-virtual")
59 # define SYS_PRAGMA_DISABLE_OVERLOADED_VIRTUAL()
61 #if SYS_IS_GCC_GE(4, 6) || defined(__clang__)
62 # define SYS_PRAGMA_DISABLE_IGNORED_QUALIFIERS() \
63 SYS_PRAGMA(GCC diagnostic ignored "-Wignored-qualifiers")
65 # define SYS_PRAGMA_DISABLE_IGNORED_QUALIFIERS()
67 #if SYS_IS_GCC_GE(4, 6) || defined(__clang__)
68 # define SYS_PRAGMA_DISABLE_UNUSED_FUNCTION() \
69 SYS_PRAGMA(GCC diagnostic ignored "-Wunused-function")
71 # define SYS_PRAGMA_DISABLE_UNUSED_FUNCTION()
73 #if SYS_IS_GCC_GE(4, 6) || defined(__clang__)
74 # define SYS_PRAGMA_DISABLE_UNUSED_VALUE() \
75 SYS_PRAGMA(GCC diagnostic ignored "-Wunused-value")
77 # define SYS_PRAGMA_DISABLE_UNUSED_VALUE()
79 #if SYS_IS_GCC_GE(4, 6) || defined(__clang__)
80 # define SYS_PRAGMA_DISABLE_UNUSED_VARIABLE() \
81 SYS_PRAGMA(GCC diagnostic ignored "-Wunused-variable")
83 # define SYS_PRAGMA_DISABLE_UNUSED_VARIABLE()
85 #if SYS_IS_GCC_GE(4, 6)
86 # define SYS_PRAGMA_DISABLE_UNUSED_BUT_SET_VARIABLE() \
87 SYS_PRAGMA(GCC diagnostic ignored "-Wunused-but-set-variable")
88 #elif defined(_MSC_VER)
89 # define SYS_PRAGMA_DISABLE_UNUSED_BUT_SET_VARIABLE() \
90 SYS_PRAGMA(warning(disable: 4189))
92 # define SYS_PRAGMA_DISABLE_UNUSED_BUT_SET_VARIABLE()
94 #if SYS_IS_GCC_GE(4, 6) || defined(__clang__)
95 # define SYS_PRAGMA_DISABLE_COMMENT_WARNING() \
96 SYS_PRAGMA(GCC diagnostic ignored "-Wcomment")
98 # define SYS_PRAGMA_DISABLE_COMMENT_WARNING()
100 #if SYS_IS_GCC_GE(4, 6) || defined(__clang__)
101 # define SYS_PRAGMA_DISABLE_MISSING_FIELD_INITIALIZERS() \
102 SYS_PRAGMA(GCC diagnostic ignored "-Wmissing-field-initializers")
104 # define SYS_PRAGMA_DISABLE_MISSING_FIELD_INITIALIZERS()
106 #if SYS_IS_GCC_GE(4, 6) || defined(__clang__)
107 # define SYS_PRAGMA_DISABLE_NON_VIRTUAL_DTOR() \
108 SYS_PRAGMA(GCC diagnostic ignored "-Wnon-virtual-dtor")
110 # define SYS_PRAGMA_DISABLE_NON_VIRTUAL_DTOR() \
111 SYS_PRAGMA(warning(disable: 4265))
113 #if SYS_IS_GCC_GE(4, 6) || SYS_IS_CLANG_GE(13, 0)
114 # define SYS_PRAGMA_DISABLE_FREE_NONHEAP_OBJECT() \
115 SYS_PRAGMA(GCC diagnostic ignored "-Wfree-nonheap-object")
117 # define SYS_PRAGMA_DISABLE_FREE_NONHEAP_OBJECT()
120 #if SYS_IS_GCC_GE(4, 8) && !defined(__clang__)
121 # define SYS_PRAGMA_DISABLE_INVALID_OFFSETOF() \
122 SYS_PRAGMA(GCC diagnostic ignored "-Winvalid-offsetof")
124 # define SYS_PRAGMA_DISABLE_INVALID_OFFSETOF()
127 #if defined(__clang__)
128 # define SYS_PRAGMA_DISABLE_INCONSISTENT_OVERRIDE() \
129 SYS_PRAGMA(GCC diagnostic ignored "-Winconsistent-missing-override")
131 # define SYS_PRAGMA_DISABLE_INCONSISTENT_OVERRIDE()
134 #if SYS_IS_GCC_GE(4, 8) && !defined(__clang__)
135 # define SYS_PRAGMA_DISABLE_MAYBE_UNINITIALIZED() \
136 SYS_PRAGMA(GCC diagnostic ignored "-Wmaybe-uninitialized")
138 # define SYS_PRAGMA_DISABLE_MAYBE_UNINITIALIZED()
141 #if SYS_IS_GCC_GE(4, 8) && !defined(__clang__)
142 # define SYS_PRAGMA_DISABLE_UNINITIALIZED() \
143 SYS_PRAGMA(GCC diagnostic ignored "-Wuninitialized")
145 # define SYS_PRAGMA_DISABLE_UNINITIALIZED()
148 #if defined(__clang__)
149 # define SYS_PRAGMA_DISABLE_VARARGS() \
150 SYS_PRAGMA(GCC diagnostic ignored "-Wvarargs")
152 # define SYS_PRAGMA_DISABLE_VARARGS()
158 #if SYS_IS_GCC_GE(4, 8) && !defined(__clang__)
159 # define SYS_PRAGMA_DISABLE_ATTRIBUTES() \
160 SYS_PRAGMA(GCC diagnostic ignored "-Wattributes")
162 # define SYS_PRAGMA_DISABLE_ATTRIBUTES()
165 #if SYS_IS_CLANG_GE(10, 0)
166 # define SYS_PRAGMA_DISABLE_SUGGEST_OVERRIDE() \
167 SYS_PRAGMA(GCC diagnostic ignored "-Wsuggest-override") \
168 SYS_PRAGMA(GCC diagnostic ignored "-Wsuggest-destructor-override")
169 #elif SYS_IS_GCC_GE(5, 0)
170 # define SYS_PRAGMA_DISABLE_SUGGEST_OVERRIDE() \
171 SYS_PRAGMA(GCC diagnostic ignored "-Wsuggest-override")
173 # define SYS_PRAGMA_DISABLE_SUGGEST_OVERRIDE()
176 #if SYS_IS_GCC_GE(8, 0) && !defined(__clang__)
177 # define SYS_PRAGMA_DISABLE_ALLOC_SIZE_LARGER_THAN() \
178 SYS_PRAGMA(GCC diagnostic ignored "-Walloc-size-larger-than=")
180 # define SYS_PRAGMA_DISABLE_ALLOC_SIZE_LARGER_THAN()
183 #if SYS_IS_GCC_GE(11, 0) && !defined(__clang__)
184 # define SYS_PRAGMA_DISABLE_MISMATCHED_NEW_DELETE() \
185 SYS_PRAGMA(GCC diagnostic ignored "-Wmismatched-new-delete")
187 # define SYS_PRAGMA_DISABLE_MISMATCHED_NEW_DELETE()
190 #if SYS_IS_GCC_GE(11, 0) && !defined(__clang__)
191 # define SYS_PRAGMA_DISABLE_NON_NULL() \
192 SYS_PRAGMA(GCC diagnostic ignored "-Wnonnull")
194 # define SYS_PRAGMA_DISABLE_NON_NULL()
197 #endif // __SYS_PRAGMA_H_INCLUDED__