DiSMEC++
macros.h
Go to the documentation of this file.
1 // Copyright (c) 2022, Aalto University, developed by Erik Schultheis
2 // All rights reserved.
3 //
4 // SPDX-License-Identifier: MIT
5 
6 #ifndef DISMEC_SRC_MODEL_MACROS_H
7 #define DISMEC_SRC_MODEL_MACROS_H
8 
9 #include <boost/predef.h>
10 
11 // defining diagnostic helper macros. To disable a diagnostic, use `DIAGNOSTIC_IGNORE`.
12 // To disable only for GCC or only for Clang, use the respective suffixed macros
13 #if BOOST_COMP_GNUC
14 #define DO_PRAGMA(x) _Pragma (#x)
15 #define DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push")
16 #define DIAGNOSTIC_POP _Pragma("GCC diagnostic pop")
17 #define DIAGNOSTIC_IGNORE(X) DO_PRAGMA(GCC diagnostic ignored X)
18 #define DIAGNOSTIC_IGNORE_GCC(X) DIAGNOSTIC_IGNORE(X)
19 #define DIAGNOSTIC_IGNORE_CLANG(X)
20 #elif BOOST_COMP_CLANG
21 #define DO_PRAGMA(x) _Pragma (#x)
22 #define DIAGNOSTIC_PUSH _Pragma("clang diagnostic push")
23 #define DIAGNOSTIC_POP _Pragma("clang diagnostic pop")
24 #define DIAGNOSTIC_IGNORE(X) DO_PRAGMA(clang diagnostic ignored X)
25 #define DIAGNOSTIC_IGNORE_GCC(X)
26 #define DIAGNOSTIC_IGNORE_CLANG(X) DIAGNOSTIC_IGNORE(X)
27 #endif
28 
29 #endif //DISMEC_SRC_MODEL_MACROS_H