Commit | Line | Data |
---|---|---|
e2882c85 | 1 | /* Copyright (C) 2017-2018 Free Software Foundation, Inc. |
f4906a9a | 2 | |
f4906a9a PA |
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 | ||
e9cb46ab L |
16 | #ifndef DIAGNOSTICS_H |
17 | #define DIAGNOSTICS_H | |
f4906a9a PA |
18 | |
19 | #ifdef __GNUC__ | |
20 | # define DIAGNOSTIC_PUSH _Pragma ("GCC diagnostic push") | |
21 | # define DIAGNOSTIC_POP _Pragma ("GCC diagnostic pop") | |
23081219 L |
22 | |
23 | /* Stringification. */ | |
24 | # define DIAGNOSTIC_STRINGIFY_1(x) #x | |
25 | # define DIAGNOSTIC_STRINGIFY(x) DIAGNOSTIC_STRINGIFY_1 (x) | |
26 | ||
f4906a9a | 27 | # define DIAGNOSTIC_IGNORE(option) \ |
23081219 | 28 | _Pragma (DIAGNOSTIC_STRINGIFY (GCC diagnostic ignored option)) |
f4906a9a PA |
29 | #else |
30 | # define DIAGNOSTIC_PUSH | |
31 | # define DIAGNOSTIC_POP | |
32 | # define DIAGNOSTIC_IGNORE(option) | |
33 | #endif | |
34 | ||
8b5a7a6e SM |
35 | #if defined (__clang__) /* clang */ |
36 | ||
f4906a9a | 37 | # define DIAGNOSTIC_IGNORE_SELF_MOVE DIAGNOSTIC_IGNORE ("-Wself-move") |
6821842f SM |
38 | # define DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS \ |
39 | DIAGNOSTIC_IGNORE ("-Wdeprecated-declarations") | |
d1435379 SM |
40 | # define DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER \ |
41 | DIAGNOSTIC_IGNORE ("-Wdeprecated-register") | |
8b5a7a6e SM |
42 | # define DIAGNOSTIC_IGNORE_UNUSED_FUNCTION \ |
43 | DIAGNOSTIC_IGNORE ("-Wunused-function") | |
cfa27c39 SM |
44 | # if __has_warning ("-Wenum-compare-switch") |
45 | # define DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES \ | |
46 | DIAGNOSTIC_IGNORE ("-Wenum-compare-switch") | |
cfa27c39 | 47 | # endif |
8b5a7a6e SM |
48 | #elif defined (__GNUC__) /* GCC */ |
49 | ||
8b5a7a6e SM |
50 | # define DIAGNOSTIC_IGNORE_UNUSED_FUNCTION \ |
51 | DIAGNOSTIC_IGNORE ("-Wunused-function") | |
52 | ||
95da9854 | 53 | # define DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION \ |
23081219 | 54 | DIAGNOSTIC_IGNORE ("-Wstringop-truncation") |
23081219 | 55 | #endif |
8b5a7a6e | 56 | |
23081219 | 57 | #ifndef DIAGNOSTIC_IGNORE_SELF_MOVE |
f4906a9a | 58 | # define DIAGNOSTIC_IGNORE_SELF_MOVE |
23081219 L |
59 | #endif |
60 | ||
6821842f SM |
61 | #ifndef DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS |
62 | # define DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS | |
63 | #endif | |
64 | ||
23081219 | 65 | #ifndef DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER |
d1435379 | 66 | # define DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER |
23081219 L |
67 | #endif |
68 | ||
69 | #ifndef DIAGNOSTIC_IGNORE_UNUSED_FUNCTION | |
8b5a7a6e | 70 | # define DIAGNOSTIC_IGNORE_UNUSED_FUNCTION |
23081219 L |
71 | #endif |
72 | ||
73 | #ifndef DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES | |
0436426c | 74 | # define DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES |
23081219 | 75 | #endif |
0436426c | 76 | |
23081219 L |
77 | #ifndef DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION |
78 | # define DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION | |
f4906a9a PA |
79 | #endif |
80 | ||
e9cb46ab | 81 | #endif /* DIAGNOSTICS_H */ |