Direct-BT  2.3.1
Direct-BT - Direct Bluetooth Programming.
cpp_pragma.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Gothel Software e.K.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining
5  * a copy of this software and associated documentation files (the
6  * "Software"), to deal in the Software without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sublicense, and/or sell copies of the Software, and to
9  * permit persons to whom the Software is furnished to do so, subject to
10  * the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be
13  * included in all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22  *
23  */
24 
25 #ifndef CPP_PRAGMA_HPP_
26 #define CPP_PRAGMA_HPP_
27 
28 namespace jau {
29 
30 #if defined(_MSC_VER)
31  #define PRAGMA_DISABLE_WARNING_PUSH __pragma(warning( push ))
32  #define PRAGMA_DISABLE_WARNING_POP __pragma(warning( pop ))
33  #define PRAGMA_DISABLE_WARNING(warningNumber) __pragma(warning( disable : warningNumber ))
34 
35  #define PRAGMA_DISABLE_WARNING_UNREFERENCED_FORMAL_PARAMETER PRAGMA_DISABLE_WARNING(4100)
36  #define PRAGMA_DISABLE_WARNING_UNREFERENCED_FUNCTION PRAGMA_DISABLE_WARNING(4505)
37  #define PRAGMA_DISABLE_WARNING_CPP
38  #define PRAGMA_DISABLE_WARNING_MULTICHAR
39 
40 #elif defined(__GNUC__) || defined(__clang__)
41  #define DO_PRAGMA(X) _Pragma(#X)
42  #define PRAGMA_DISABLE_WARNING_PUSH DO_PRAGMA(GCC diagnostic push)
43  #define PRAGMA_DISABLE_WARNING_POP DO_PRAGMA(GCC diagnostic pop)
44  #define PRAGMA_DISABLE_WARNING(warningName) DO_PRAGMA(GCC diagnostic ignored #warningName)
45  #define PRAGMA_WARNING_ONLY(warningName) DO_PRAGMA(GCC diagnostic warning #warningName)
46 
47  #define PRAGMA_DISABLE_WARNING_UNREFERENCED_FORMAL_PARAMETER PRAGMA_DISABLE_WARNING(-Wunused-parameter)
48  #define PRAGMA_DISABLE_WARNING_UNREFERENCED_FUNCTION PRAGMA_DISABLE_WARNING(-Wunused-function)
49  #define PRAGMA_DISABLE_WARNING_CPP PRAGMA_DISABLE_WARNING(-Wcpp)
50  #define PRAGMA_DISABLE_WARNING_MULTICHAR PRAGMA_DISABLE_WARNING(-Wmultichar)
51 
52 #else
53  #define PRAGMA_DISABLE_WARNING_PUSH
54  #define PRAGMA_DISABLE_WARNING_POP
55  #define PRAGMA_DISABLE_WARNING_UNREFERENCED_FORMAL_PARAMETER
56  #define PRAGMA_DISABLE_WARNING_UNREFERENCED_FUNCTION
57  #define PRAGMA_DISABLE_WARNING_CPP
58  #define PRAGMA_DISABLE_WARNING_MULTICHAR
59 #endif
60 
61 } // namespace jau
62 
63 #endif /* CPP_PRAGMA_HPP_ */
jau
Definition: basic_algos.hpp:34