]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/common/diagnostics.h
dwarf2read: Silence -Wenum-compare-switch warning
[thirdparty/binutils-gdb.git] / gdb / common / diagnostics.h
CommitLineData
f4906a9a
PA
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
8b5a7a6e
SM
34#if defined (__clang__) /* clang */
35
f4906a9a 36# define DIAGNOSTIC_IGNORE_SELF_MOVE DIAGNOSTIC_IGNORE ("-Wself-move")
d1435379
SM
37# define DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER \
38 DIAGNOSTIC_IGNORE ("-Wdeprecated-register")
8b5a7a6e
SM
39# define DIAGNOSTIC_IGNORE_UNUSED_FUNCTION \
40 DIAGNOSTIC_IGNORE ("-Wunused-function")
0436426c
SM
41# define DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES \
42 DIAGNOSTIC_IGNORE ("-Wenum-compare-switch")
8b5a7a6e
SM
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")
0436426c 50# define DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES
8b5a7a6e
SM
51
52#else /* Other compilers */
53
f4906a9a 54# define DIAGNOSTIC_IGNORE_SELF_MOVE
d1435379 55# define DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER
8b5a7a6e 56# define DIAGNOSTIC_IGNORE_UNUSED_FUNCTION
0436426c
SM
57# define DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES
58
f4906a9a
PA
59#endif
60
61#endif /* COMMON_DIAGNOSTICS_H */