f7412d4a38ffcdfa94a65a524dd591cc05037433
[deliverable/binutils-gdb.git] / include / diagnostics.h
1 /* Copyright (C) 2017-2018 Free Software Foundation, Inc.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 3 of the License, or
6 (at your option) any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program. If not, see <http://www.gnu.org/licenses/>. */
15
16 #ifndef DIAGNOSTICS_H
17 #define DIAGNOSTICS_H
18
19 #ifdef __GNUC__
20 # define DIAGNOSTIC_PUSH _Pragma ("GCC diagnostic push")
21 # define DIAGNOSTIC_POP _Pragma ("GCC diagnostic pop")
22
23 /* Stringification. */
24 # define DIAGNOSTIC_STRINGIFY_1(x) #x
25 # define DIAGNOSTIC_STRINGIFY(x) DIAGNOSTIC_STRINGIFY_1 (x)
26
27 # define DIAGNOSTIC_IGNORE(option) \
28 _Pragma (DIAGNOSTIC_STRINGIFY (GCC diagnostic ignored option))
29 #else
30 # define DIAGNOSTIC_PUSH
31 # define DIAGNOSTIC_POP
32 # define DIAGNOSTIC_IGNORE(option)
33 #endif
34
35 #if defined (__clang__) /* clang */
36
37 # define DIAGNOSTIC_IGNORE_SELF_MOVE DIAGNOSTIC_IGNORE ("-Wself-move")
38 # define DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER \
39 DIAGNOSTIC_IGNORE ("-Wdeprecated-register")
40 # define DIAGNOSTIC_IGNORE_UNUSED_FUNCTION \
41 DIAGNOSTIC_IGNORE ("-Wunused-function")
42 # if __has_warning ("-Wenum-compare-switch")
43 # define DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES \
44 DIAGNOSTIC_IGNORE ("-Wenum-compare-switch")
45 # endif
46 #elif defined (__GNUC__) /* GCC */
47
48 # define DIAGNOSTIC_IGNORE_UNUSED_FUNCTION \
49 DIAGNOSTIC_IGNORE ("-Wunused-function")
50
51 # if __GNUC__ == 8 && __GNUC_MINOR__ < 2
52 # define DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION \
53 DIAGNOSTIC_IGNORE ("-Wstringop-truncation")
54 # endif
55 #endif
56
57 #ifndef DIAGNOSTIC_IGNORE_SELF_MOVE
58 # define DIAGNOSTIC_IGNORE_SELF_MOVE
59 #endif
60
61 #ifndef DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER
62 # define DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER
63 #endif
64
65 #ifndef DIAGNOSTIC_IGNORE_UNUSED_FUNCTION
66 # define DIAGNOSTIC_IGNORE_UNUSED_FUNCTION
67 #endif
68
69 #ifndef DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES
70 # define DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES
71 #endif
72
73 #ifndef DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION
74 # define DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION
75 #endif
76
77 #endif /* DIAGNOSTICS_H */
This page took 0.030678 seconds and 3 git commands to generate.