libquentier
0.5.0
The library for rich desktop clients of Evernote service
Loading...
Searching...
No Matches
headers
quentier
utility
SuppressWarnings.h
1
/*
2
* Copyright 2020 Dmitry Ivanov
3
*
4
* This file is part of libquentier
5
*
6
* libquentier is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU Lesser General Public License as published by
8
* the Free Software Foundation, version 3 of the License.
9
*
10
* libquentier is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU Lesser General Public License for more details.
14
*
15
* You should have received a copy of the GNU Lesser General Public License
16
* along with libquentier. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
#ifndef LIB_QUENTIER_UTILITY_SUPPRESS_WARNINGS_H
20
#define LIB_QUENTIER_UTILITY_SUPPRESS_WARNINGS_H
21
23
// Common macros
25
26
#define STRINGIFY(a) #a
27
28
// Define empty macros doing nothing for supported compilers, they would be used
29
// as fallback when any of these compilers are not actually used
30
31
#define SAVE_WARNINGS
32
33
#define CLANG_SUPPRESS_WARNING(warning)
34
#define GCC_SUPPRESS_WARNING(warning)
35
#define MSVC_SUPPRESS_WARNING(warning)
36
37
#define RESTORE_WARNINGS
38
40
// Clang implementation
42
43
#if defined(__clang__)
44
45
#undef CLANG_SUPPRESS_WARNING
46
47
#define CLANG_SUPPRESS_WARNING(warning) \
48
_Pragma( \
49
STRINGIFY(clang diagnostic ignored #warning))
// CLANG_IGNORE_WARNING
50
51
#undef SAVE_WARNINGS
52
53
#define SAVE_WARNINGS _Pragma("clang diagnostic push"
)
// SAVE_WARNINGS
54
55
#undef RESTORE_WARNINGS
56
57
#define RESTORE_WARNINGS _Pragma("clang diagnostic pop"
)
// RESTORE_WARNINGS
58
59
#endif
// clang
60
62
// GCC implementation
64
65
// Clang can mimic gcc so need to ensure it's indeed gcc
66
#if defined(__GNUC__) && !defined(__clang__)
67
68
#undef GCC_SUPPRESS_WARNING
69
70
#define GCC_SUPPRESS_WARNING(warning) \
71
_Pragma(STRINGIFY(GCC diagnostic ignored #warning))
// GCC_SUPPRESS_WARNING
72
73
#undef SAVE_WARNINGS
74
75
#define SAVE_WARNINGS _Pragma("GCC diagnostic push"
)
// SAVE_WARNINGS
76
77
#undef RESTORE_WARNINGS
78
79
#define RESTORE_WARNINGS _Pragma("GCC diagnostic pop"
)
// RESTORE_WARNINGS
80
81
#endif
// GCC
82
84
// MSVC implementation
86
87
#if defined(_MSC_VER)
88
89
#undef MSVC_SUPPRESS_WARNING
90
91
#define MSVC_SUPPRESS_WARNING(number) \
92
__pragma(warning(disable : number))
// MSVC_SUPPRESS_WARNING
93
94
#undef SAVE_WARNINGS
95
96
#define SAVE_WARNINGS __pragma(warning(push))
// SAVE_WARNINGS
97
98
#undef RESTORE_WARNINGS
99
100
#define RESTORE_WARNINGS __pragma(warning(pop))
// RESTORE_WARNINGS
101
102
#endif
// MSVC
103
104
#endif
// LIB_QUENTIER_UTILITY_SUPPRESS_WARNINGS_H
Generated on Thu Jul 20 2023 00:00:00 for libquentier by
1.9.7