macros.hh
Go to the documentation of this file.
1 #ifndef __SOT_CORE_MACROS_HH__
2 #define __SOT_CORE_MACROS_HH__
3 
4 // ref https://www.fluentcpp.com/2019/08/30/how-to-disable-a-warning-in-cpp/
5 #if defined(_MSC_VER)
6 
7 #define SOT_CORE_DISABLE_WARNING_PUSH __pragma(warning(push))
8 #define SOT_CORE_DISABLE_WARNING_POP __pragma(warning(pop))
9 #define SOT_CORE_DISABLE_WARNING(warningNumber) \
10  __pragma(warning(disable : warningNumber))
11 #define SOT_CORE_DISABLE_WARNING_DEPRECATED SOT_CORE_DISABLE_WARNING(4996)
12 #define SOT_CORE_DISABLE_WARNING_FALLTHROUGH
13 
14 #elif defined(__GNUC__) || defined(__clang__)
15 
16 #define SOT_CORE_DO_PRAGMA(X) _Pragma(#X)
17 #define SOT_CORE_DISABLE_WARNING_PUSH SOT_CORE_DO_PRAGMA(GCC diagnostic push)
18 #define SOT_CORE_DISABLE_WARNING_POP SOT_CORE_DO_PRAGMA(GCC diagnostic pop)
19 #define SOT_CORE_DISABLE_WARNING(warningName) \
20  SOT_CORE_DO_PRAGMA(GCC diagnostic ignored #warningName)
21 #define SOT_CORE_DISABLE_WARNING_DEPRECATED \
22  SOT_CORE_DISABLE_WARNING(-Wdeprecated - declarations)
23 #define SOT_CORE_DISABLE_WARNING_FALLTHROUGH \
24  SOT_CORE_DISABLE_WARNING(-Wimplicit - fallthrough)
25 
26 #else
27 
28 #define SOT_CORE_DISABLE_WARNING_PUSH
29 #define SOT_CORE_DISABLE_WARNING_POP
30 #define SOT_CORE_DISABLE_WARNING_DEPRECATED
31 
32 #endif
33 
34 #endif


sot-core
Author(s): Olivier Stasse, ostasse@laas.fr
autogenerated on Wed Jun 21 2023 02:51:26