Another way to request the desired semantics, compatible with clang
This commit is contained in:
1 parent
b50813713a
commit
0bd1bcb68e
1 file changed
+8
-12
@@ -162,7 +162,7 @@
|
|||||||
#if __clang_major__ >= 6
|
#if __clang_major__ >= 6
|
||||||
#define M_BEGIN_PROTECTED_CODE \
|
#define M_BEGIN_PROTECTED_CODE \
|
||||||
_Pragma("clang diagnostic push") \
|
_Pragma("clang diagnostic push") \
|
||||||
_Pragma("clang push_options") \
|
_Pragma("clang diagnostic ignored \"-Wattributes\"") \
|
||||||
_Pragma("clang diagnostic ignored \"-Wold-style-cast\"") \
|
_Pragma("clang diagnostic ignored \"-Wold-style-cast\"") \
|
||||||
_Pragma("clang diagnostic ignored \"-Wzero-as-null-pointer-constant\"") \
|
_Pragma("clang diagnostic ignored \"-Wzero-as-null-pointer-constant\"") \
|
||||||
_Pragma("clang diagnostic ignored \"-Wunused-function\"") \
|
_Pragma("clang diagnostic ignored \"-Wunused-function\"") \
|
||||||
@@ -170,14 +170,13 @@
|
|||||||
#else
|
#else
|
||||||
#define M_BEGIN_PROTECTED_CODE \
|
#define M_BEGIN_PROTECTED_CODE \
|
||||||
_Pragma("clang diagnostic push") \
|
_Pragma("clang diagnostic push") \
|
||||||
_Pragma("clang push_options") \
|
_Pragma("clang diagnostic ignored \"-Wattributes\"") \
|
||||||
_Pragma("clang diagnostic ignored \"-Wold-style-cast\"") \
|
_Pragma("clang diagnostic ignored \"-Wold-style-cast\"") \
|
||||||
_Pragma("clang diagnostic ignored \"-Wunused-function\"") \
|
_Pragma("clang diagnostic ignored \"-Wunused-function\"") \
|
||||||
_Pragma("clang diagnostic ignored \"-Wformat-nonliteral\"")
|
_Pragma("clang diagnostic ignored \"-Wformat-nonliteral\"")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define M_END_PROTECTED_CODE \
|
#define M_END_PROTECTED_CODE \
|
||||||
_Pragma("clang pop_options") \
|
|
||||||
_Pragma("clang diagnostic pop")
|
_Pragma("clang diagnostic pop")
|
||||||
|
|
||||||
#elif defined(__GNUC__) && defined(__cplusplus)
|
#elif defined(__GNUC__) && defined(__cplusplus)
|
||||||
@@ -188,13 +187,12 @@
|
|||||||
*/
|
*/
|
||||||
#define M_BEGIN_PROTECTED_CODE \
|
#define M_BEGIN_PROTECTED_CODE \
|
||||||
_Pragma("GCC diagnostic push") \
|
_Pragma("GCC diagnostic push") \
|
||||||
_Pragma("GCC push_options") \
|
_Pragma("GCC diagnostic ignored \"-Wattributes\"") \
|
||||||
_Pragma("GCC diagnostic ignored \"-Wold-style-cast\"") \
|
_Pragma("GCC diagnostic ignored \"-Wold-style-cast\"") \
|
||||||
_Pragma("GCC diagnostic ignored \"-Wzero-as-null-pointer-constant\"") \
|
_Pragma("GCC diagnostic ignored \"-Wzero-as-null-pointer-constant\"") \
|
||||||
_Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"")
|
_Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"")
|
||||||
|
|
||||||
#define M_END_PROTECTED_CODE \
|
#define M_END_PROTECTED_CODE \
|
||||||
_Pragma("GCC pop_options") \
|
|
||||||
_Pragma("GCC diagnostic pop")
|
_Pragma("GCC diagnostic pop")
|
||||||
|
|
||||||
#elif defined(__clang__)
|
#elif defined(__clang__)
|
||||||
@@ -202,12 +200,11 @@
|
|||||||
/* Warnings disabled for CLANG in C mode */
|
/* Warnings disabled for CLANG in C mode */
|
||||||
#define M_BEGIN_PROTECTED_CODE \
|
#define M_BEGIN_PROTECTED_CODE \
|
||||||
_Pragma("clang diagnostic push") \
|
_Pragma("clang diagnostic push") \
|
||||||
_Pragma("clang push_options") \
|
_Pragma("clang diagnostic ignored \"-Wattributes\"") \
|
||||||
_Pragma("clang diagnostic ignored \"-Wunused-function\"") \
|
_Pragma("clang diagnostic ignored \"-Wunused-function\"") \
|
||||||
_Pragma("clang diagnostic ignored \"-Wformat-nonliteral\"")
|
_Pragma("clang diagnostic ignored \"-Wformat-nonliteral\"")
|
||||||
|
|
||||||
#define M_END_PROTECTED_CODE \
|
#define M_END_PROTECTED_CODE \
|
||||||
_Pragma("clang pop_options") \
|
|
||||||
_Pragma("clang diagnostic pop")
|
_Pragma("clang diagnostic pop")
|
||||||
|
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
@@ -216,19 +213,18 @@
|
|||||||
/* Warnings disabled for GNU C in C mode (Wstringop-overflow produces false warnings) */
|
/* Warnings disabled for GNU C in C mode (Wstringop-overflow produces false warnings) */
|
||||||
#define M_BEGIN_PROTECTED_CODE \
|
#define M_BEGIN_PROTECTED_CODE \
|
||||||
_Pragma("GCC diagnostic push") \
|
_Pragma("GCC diagnostic push") \
|
||||||
_Pragma("GCC push_options") \
|
_Pragma("GCC diagnostic ignored \"-Wattributes\"") \
|
||||||
_Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"") \
|
_Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"") \
|
||||||
_Pragma("GCC diagnostic ignored \"-Wstringop-overflow\"")
|
_Pragma("GCC diagnostic ignored \"-Wstringop-overflow\"")
|
||||||
#else
|
#else
|
||||||
/* Warnings disabled for GNU C in C mode */
|
/* Warnings disabled for GNU C in C mode */
|
||||||
#define M_BEGIN_PROTECTED_CODE \
|
#define M_BEGIN_PROTECTED_CODE \
|
||||||
_Pragma("GCC diagnostic push") \
|
_Pragma("GCC diagnostic push") \
|
||||||
_Pragma("GCC push_options") \
|
_Pragma("GCC diagnostic ignored \"-Wattributes\"") \
|
||||||
_Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"")
|
_Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define M_END_PROTECTED_CODE \
|
#define M_END_PROTECTED_CODE \
|
||||||
_Pragma("GCC pop_options") \
|
|
||||||
_Pragma("GCC diagnostic pop")
|
_Pragma("GCC diagnostic pop")
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@@ -290,9 +286,9 @@ M_BEGIN_PROTECTED_CODE
|
|||||||
Otherwise uses the classic "M_INLINE"
|
Otherwise uses the classic "M_INLINE"
|
||||||
*/
|
*/
|
||||||
#if defined(__GNUC__) && defined(M_USE_EXTERN_DECL)
|
#if defined(__GNUC__) && defined(M_USE_EXTERN_DECL)
|
||||||
#define M_INLINE _Pragma("GCC optimize (\"-fno-inline\")") inline
|
#define M_INLINE __attribute__ ((noinline)) inline
|
||||||
#elif defined(__GNUC__) && defined(M_USE_EXTERN_DEF)
|
#elif defined(__GNUC__) && defined(M_USE_EXTERN_DEF)
|
||||||
#define M_INLINE _Pragma("GCC optimize (\"-fno-inline\")") extern inline
|
#define M_INLINE __attribute__ ((noinline)) extern inline
|
||||||
#else
|
#else
|
||||||
#define M_INLINE static inline
|
#define M_INLINE static inline
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in new issue
Block a user