libquentier
0.5.0
The library for rich desktop clients of Evernote service
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( STRINGIFY( clang diagnostic ignored #warning ) ) \
49
// CLANG_IGNORE_WARNING
50
51
#undef SAVE_WARNINGS
52
53
#define SAVE_WARNINGS \
54
_Pragma("clang diagnostic push") \
55
// SAVE_WARNINGS
56
57
#undef RESTORE_WARNINGS
58
59
#define RESTORE_WARNINGS \
60
_Pragma("clang diagnostic pop") \
61
// RESTORE_WARNINGS
62
63
#endif // clang
64
66
// GCC implementation
68
69
// Clang can mimic gcc so need to ensure it's indeed gcc
70
#if defined(__GNUC__) && !defined(__clang__)
71
72
#undef GCC_SUPPRESS_WARNING
73
74
#define GCC_SUPPRESS_WARNING(warning) \
75
_Pragma( STRINGIFY( GCC diagnostic ignored #warning ) ) \
76
// GCC_SUPPRESS_WARNING
77
78
#undef SAVE_WARNINGS
79
80
#define SAVE_WARNINGS \
81
_Pragma("GCC diagnostic push") \
82
// SAVE_WARNINGS
83
84
#undef RESTORE_WARNINGS
85
86
#define RESTORE_WARNINGS \
87
_Pragma("GCC diagnostic pop") \
88
// RESTORE_WARNINGS
89
90
#endif // GCC
91
93
// MSVC implementation
95
96
#if defined(_MSC_VER)
97
98
#undef MSVC_SUPPRESS_WARNING
99
100
#define MSVC_SUPPRESS_WARNING(number) \
101
__pragma(warning(disable:number)) \
102
// MSVC_SUPPRESS_WARNING
103
104
#undef SAVE_WARNINGS
105
106
#define SAVE_WARNINGS \
107
__pragma(warning(push)) \
108
// SAVE_WARNINGS
109
110
#undef RESTORE_WARNINGS \
111
112
#define RESTORE_WARNINGS \
113
__pragma(warning(pop)) \
114
// RESTORE_WARNINGS
115
116
#endif // MSVC
117
118
#endif // LIB_QUENTIER_UTILITY_SUPPRESS_WARNINGS_H
Generated on Wed Jun 17 2020 18:33:52 for libquentier by
1.8.17