30c0fd6172a16a5f05bebfa4889855dfc5336be9
[external/binutils.git] / gdb / common / diagnostics.h
1 /* Copyright (C) 2017 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 # define DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES \
42   DIAGNOSTIC_IGNORE ("-Wenum-compare-switch")
43
44 #elif defined (__GNUC__) /* GCC */
45
46 # define DIAGNOSTIC_IGNORE_SELF_MOVE
47 # define DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER
48 # define DIAGNOSTIC_IGNORE_UNUSED_FUNCTION \
49   DIAGNOSTIC_IGNORE ("-Wunused-function")
50 # define DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES
51
52 #else /* Other compilers */
53
54 # define DIAGNOSTIC_IGNORE_SELF_MOVE
55 # define DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER
56 # define DIAGNOSTIC_IGNORE_UNUSED_FUNCTION
57 # define DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES
58
59 #endif
60
61 #endif /* COMMON_DIAGNOSTICS_H */