GDBserver

diagnostics.h
Go to the documentation of this file.
1 /* Copyright (C) 2017-2018 Free Software Foundation, Inc.
2
3 This file is part of GDB.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
10 This program 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 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17
18 #ifndef COMMON_DIAGNOSTICS_H
19 #define COMMON_DIAGNOSTICS_H
20
21 #include "common/preprocessor.h"
22
23 #ifdef __GNUC__
24 # define DIAGNOSTIC_PUSH _Pragma ("GCC diagnostic push")
25 # define DIAGNOSTIC_POP _Pragma ("GCC diagnostic pop")
26 # define DIAGNOSTIC_IGNORE(option) \
27 _Pragma (STRINGIFY (GCC diagnostic ignored option))
28 #else
29 # define DIAGNOSTIC_PUSH
30 # define DIAGNOSTIC_POP
31 # define DIAGNOSTIC_IGNORE(option)
32 #endif
33
34 #if defined (__clang__) /* clang */
35
36 # define DIAGNOSTIC_IGNORE_SELF_MOVE DIAGNOSTIC_IGNORE ("-Wself-move")
37 # define DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER \
38 DIAGNOSTIC_IGNORE ("-Wdeprecated-register")
39 # define DIAGNOSTIC_IGNORE_UNUSED_FUNCTION \
40 DIAGNOSTIC_IGNORE ("-Wunused-function")
41 # if __has_warning ("-Wenum-compare-switch")
42 # define DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES \
43 DIAGNOSTIC_IGNORE ("-Wenum-compare-switch")
44 # else
45 # define DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES
46 # endif
47 #elif defined (__GNUC__) /* GCC */
48
49 # define DIAGNOSTIC_IGNORE_SELF_MOVE
50 # define DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER
51 # define DIAGNOSTIC_IGNORE_UNUSED_FUNCTION \
52 DIAGNOSTIC_IGNORE ("-Wunused-function")
53 # define DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES
54
55 #else /* Other compilers */
56
57 # define DIAGNOSTIC_IGNORE_SELF_MOVE
58 # define DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER
59 # define DIAGNOSTIC_IGNORE_UNUSED_FUNCTION
60 # define DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES
61
62 #endif
63
64 #endif /* COMMON_DIAGNOSTICS_H */
preprocessor.h