jaulib
v1.5.0
Jau Support Library (C++, Java, ..)
Loading...
Searching...
No Matches
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
/** \addtogroup CppLang
31
*
32
* @{
33
*/
34
35
#if defined(_MSC_VER)
36
#define PRAGMA_DISABLE_WARNING_PUSH __pragma(warning( push ))
37
#define PRAGMA_DISABLE_WARNING_POP __pragma(warning( pop ))
38
#define PRAGMA_DISABLE_WARNING(warningNumber) __pragma(warning( disable : warningNumber ))
39
40
#define PRAGMA_DISABLE_WARNING_UNREFERENCED_FORMAL_PARAMETER PRAGMA_DISABLE_WARNING(4100)
41
#define PRAGMA_DISABLE_WARNING_UNREFERENCED_FUNCTION PRAGMA_DISABLE_WARNING(4505)
42
#define PRAGMA_DISABLE_WARNING_CPP
43
#define PRAGMA_DISABLE_WARNING_MULTICHAR
44
#define PRAGMA_DISABLE_WARNING_NULL_DEREFERENCE
45
#define PRAGMA_DISABLE_WARNING_FORMAT_OVERFLOW
46
#define PRAGMA_DISABLE_WARNING_FORMAT_NONLITERAL
47
#define PRAGMA_DISABLE_WARNING_FORMAT_SECURITY
48
#define PRAGMA_DISABLE_WARNING_PMF_CONVERSIONS
49
#define PRAGMA_DISABLE_WARNING_STRINGOP_OVERFLOW
50
#define PRAGMA_DISABLE_WARNING_INT_OVERFLOW
51
#define PRAGMA_DISABLE_WARNING_RESTRICT
52
#define PRAGMA_DISABLE_WARNING_PEDANTIC
53
#define PRAGMA_DISABLE_WARNING_ZERO_LENGTH_ARRAY
54
#define PRAGMA_DISABLE_WARNING_TYPE_RANGE_LIMIT
55
56
#elif defined(__GNUC__) || defined(__clang__)
57
#define DO_PRAGMA(X) _Pragma(#X)
58
#define PRAGMA_DISABLE_WARNING_PUSH DO_PRAGMA(GCC diagnostic push)
59
#define PRAGMA_DISABLE_WARNING_POP DO_PRAGMA(GCC diagnostic pop)
60
#define PRAGMA_DISABLE_WARNING(warningName) DO_PRAGMA(GCC diagnostic ignored #warningName)
61
#define PRAGMA_WARNING_ONLY(warningName) DO_PRAGMA(GCC diagnostic warning #warningName)
62
63
#define PRAGMA_DISABLE_WARNING_UNREFERENCED_FORMAL_PARAMETER PRAGMA_DISABLE_WARNING(-Wunused-parameter)
64
#define PRAGMA_DISABLE_WARNING_UNREFERENCED_FUNCTION PRAGMA_DISABLE_WARNING(-Wunused-function)
65
#define PRAGMA_DISABLE_WARNING_CPP PRAGMA_DISABLE_WARNING(-Wcpp)
66
#define PRAGMA_DISABLE_WARNING_MULTICHAR PRAGMA_DISABLE_WARNING(-Wmultichar)
67
#define PRAGMA_DISABLE_WARNING_NULL_DEREFERENCE PRAGMA_DISABLE_WARNING(-Wnull-dereference)
68
#define PRAGMA_DISABLE_WARNING_ARRAY_BOUNDS PRAGMA_DISABLE_WARNING(-Warray-bounds)
69
#define PRAGMA_DISABLE_WARNING_FORMAT_OVERFLOW PRAGMA_DISABLE_WARNING(-Wformat-overflow)
70
#define PRAGMA_DISABLE_WARNING_FORMAT_NONLITERAL PRAGMA_DISABLE_WARNING(-Wformat-nonliteral)
71
#define PRAGMA_DISABLE_WARNING_FORMAT_SECURITY PRAGMA_DISABLE_WARNING(-Wformat-security)
72
#if defined(__GNUC__) && !defined(__clang__)
73
#define PRAGMA_DISABLE_WARNING_PMF_CONVERSIONS PRAGMA_DISABLE_WARNING(-Wpmf-conversions)
74
#define PRAGMA_DISABLE_WARNING_STRINGOP_OVERFLOW PRAGMA_DISABLE_WARNING(-Wstringop-overflow)
75
#define PRAGMA_DISABLE_WARNING_INT_OVERFLOW
76
#define PRAGMA_DISABLE_WARNING_RESTRICT PRAGMA_DISABLE_WARNING(-Wrestrict)
77
#define PRAGMA_DISABLE_WARNING_PEDANTIC PRAGMA_DISABLE_WARNING(-Wpedantic)
78
#define PRAGMA_DISABLE_WARNING_ZERO_LENGTH_ARRAY
79
#define PRAGMA_DISABLE_WARNING_TYPE_RANGE_LIMIT PRAGMA_DISABLE_WARNING(-Wtype-limits) PRAGMA_DISABLE_WARNING(-Wtautological-compare)
80
#else
81
#define PRAGMA_DISABLE_WARNING_PMF_CONVERSIONS
82
#define PRAGMA_DISABLE_WARNING_STRINGOP_OVERFLOW
83
#define PRAGMA_DISABLE_WARNING_INT_OVERFLOW PRAGMA_DISABLE_WARNING(-Winteger-overflow)
84
#define PRAGMA_DISABLE_WARNING_RESTRICT
85
#define PRAGMA_DISABLE_WARNING_PEDANTIC PRAGMA_DISABLE_WARNING(-Wpedantic)
86
#define PRAGMA_DISABLE_WARNING_ZERO_LENGTH_ARRAY PRAGMA_DISABLE_WARNING(-Wzero-length-array)
87
#define PRAGMA_DISABLE_WARNING_TYPE_RANGE_LIMIT PRAGMA_DISABLE_WARNING(-Wtype-limits) PRAGMA_DISABLE_WARNING(-Wtautological-compare) \
88
PRAGMA_DISABLE_WARNING(-Wtautological-type-limit-compare)
89
#endif
90
91
#else
92
#define PRAGMA_DISABLE_WARNING_PUSH
93
#define PRAGMA_DISABLE_WARNING_POP
94
#define PRAGMA_DISABLE_WARNING_UNREFERENCED_FORMAL_PARAMETER
95
#define PRAGMA_DISABLE_WARNING_UNREFERENCED_FUNCTION
96
#define PRAGMA_DISABLE_WARNING_CPP
97
#define PRAGMA_DISABLE_WARNING_MULTICHAR
98
#define PRAGMA_DISABLE_WARNING_NULL_DEREFERENCE
99
#define PRAGMA_DISABLE_WARNING_ARRAY_BOUNDS
100
#define PRAGMA_DISABLE_WARNING_FORMAT_OVERFLOW
101
#define PRAGMA_DISABLE_WARNING_FORMAT_NONLITERAL
102
#define PRAGMA_DISABLE_WARNING_FORMAT_SECURITY
103
#define PRAGMA_DISABLE_WARNING_PMF_CONVERSIONS
104
#define PRAGMA_DISABLE_WARNING_STRINGOP_OVERFLOW
105
#define PRAGMA_DISABLE_WARNING_INT_OVERFLOW
106
#define PRAGMA_DISABLE_WARNING_RESTRICT
107
#define PRAGMA_DISABLE_WARNING_PEDANTIC
108
#define PRAGMA_DISABLE_WARNING_ZERO_LENGTH_ARRAY
109
#define PRAGMA_DISABLE_WARNING_TYPE_RANGE_LIMIT
110
111
#endif
112
113
/**@}*/
114
115
}
// namespace jau
116
117
#endif
/* CPP_PRAGMA_HPP_ */
jau
__pack(...): Produces MSVC, clang and gcc compatible lead-in and -out macros.
Definition
backtrace.hpp:32
include
jau
cpp_pragma.hpp
Generated by
1.13.2