Finite Volume Solver  prototype
A framework to build finite volume solvers for the AG Klein at the Freie Universität Berlin.
pragma.hpp
Go to the documentation of this file.
1 // Copyright (c) 2018 Maikel Nadolski
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a copy
4 // of this software and associated documentation files (the "Software"), to deal
5 // in the Software without restriction, including without limitation the rights
6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 // copies of the Software, and to permit persons to whom the Software is
8 // furnished to do so, subject to the following conditions:
9 //
10 // The above copyright notice and this permission notice shall be included in
11 // all copies or substantial portions of the Software.
12 //
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 // SOFTWARE.
20 
21 #ifndef FUB_CORE_PRAGMA_HPP
22 #define FUB_CORE_PRAGMA_HPP
23 
24 #define DIAG_STR(s) #s
25 #define DIAG_JOINSTR(x, y) DIAG_STR(x##y)
26 #ifdef _MSC_VER
27 #define DIAG_DO_PRAGMA(x) __pragma(#x)
28 #define DIAG_PRAGMA(compiler, x) DIAG_DO_PRAGMA(warning(x))
29 #else
30 #define DIAG_DO_PRAGMA(x) _Pragma(#x)
31 #define DIAG_PRAGMA(compiler, x) DIAG_DO_PRAGMA(compiler diagnostic x)
32 #endif
33 #if defined(__clang__)
34 #define DISABLE_WARNING(gcc_unused, clang_option, msvc_unused) \
35  DIAG_PRAGMA(clang, push) \
36  DIAG_PRAGMA(clang, ignored DIAG_JOINSTR(-W, clang_option))
37 #define ENABLE_WARNING(gcc_unused, clang_option, msvc_unused) \
38  DIAG_PRAGMA(clang, pop)
39 #elif defined(_MSC_VER)
40 #define DISABLE_WARNING(gcc_unused, clang_unused, msvc_errorcode) \
41  DIAG_PRAGMA(msvc, push) DIAG_DO_PRAGMA(warning(disable :##msvc_errorcode))
42 #define ENABLE_WARNING(gcc_unused, clang_unused, msvc_errorcode) \
43  DIAG_PRAGMA(msvc, pop)
44 #elif defined(__GNUC__)
45 #if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406
46 #define DISABLE_WARNING(gcc_option, clang_unused, msvc_unused) \
47  DIAG_PRAGMA(GCC, push) DIAG_PRAGMA(GCC, ignored DIAG_JOINSTR(-W, gcc_option))
48 #define ENABLE_WARNING(gcc_option, clang_unused, msvc_unused) \
49  DIAG_PRAGMA(GCC, pop)
50 #else
51 #define DISABLE_WARNING(gcc_option, clang_unused, msvc_unused) \
52  DIAG_PRAGMA(GCC, ignored DIAG_JOINSTR(-W, gcc_option))
53 #define ENABLE_WARNING(gcc_option, clang_option, msvc_unused) \
54  DIAG_PRAGMA(GCC, warning DIAG_JOINSTR(-W, gcc_option))
55 #endif
56 #endif
57 
58 #endif