diff options
author | Tsukasa OI <research_trasio@irq.a4lg.com> | 2022-09-12 07:07:49 +0000 |
---|---|---|
committer | Tsukasa OI <research_trasio@irq.a4lg.com> | 2022-09-22 10:53:24 +0000 |
commit | c59ea02cc3cbc89cde1fcb72e4267b73cdaf7f55 (patch) | |
tree | eb62353b16e0aef85ad41809c87d7b8cf4e88042 /include | |
parent | gdb/python: restrict the names accepted by gdb.register_window_type (diff) | |
download | binutils-gdb-c59ea02cc3cbc89cde1fcb72e4267b73cdaf7f55.tar.gz binutils-gdb-c59ea02cc3cbc89cde1fcb72e4267b73cdaf7f55.tar.bz2 binutils-gdb-c59ea02cc3cbc89cde1fcb72e4267b73cdaf7f55.zip |
include: Add macro to ignore -Wuser-defined-warnings
User-defined warnings (on Clang, "-Wuser-defined-warnings") can be harmful
if we have specified "-Werror" and we have no control to disable the warning
ourself. The particular example is Gnulib.
Gnulib generates a warning if the system version of certain functions
are used (to redirect the developer to use Gnulib version). However,
it can be harmful if we cannot easily replace them (e.g. the target is in
the standard C++ library).
The new DIAGNOSTIC_IGNORE_USER_DEFINED_WARNINGS macro can be helpful on such
cases. A typical use of this macro is to place this macro before including
certain system headers.
include/ChangeLog:
* diagnostics.h (DIAGNOSTIC_IGNORE_USER_DEFINED_WARNINGS): New.
Diffstat (limited to 'include')
-rw-r--r-- | include/diagnostics.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/diagnostics.h b/include/diagnostics.h index 3da88282261..dbe6288d3d6 100644 --- a/include/diagnostics.h +++ b/include/diagnostics.h @@ -63,6 +63,11 @@ # define DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL \ DIAGNOSTIC_IGNORE ("-Wformat-nonliteral") +# if __has_warning ("-Wuser-defined-warnings") +# define DIAGNOSTIC_IGNORE_USER_DEFINED_WARNINGS \ + DIAGNOSTIC_IGNORE ("-Wuser-defined-warnings") +# endif + # define DIAGNOSTIC_ERROR_SWITCH \ DIAGNOSTIC_ERROR ("-Wswitch") @@ -121,6 +126,10 @@ # define DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL #endif +#ifndef DIAGNOSTIC_IGNORE_USER_DEFINED_WARNINGS +# define DIAGNOSTIC_IGNORE_USER_DEFINED_WARNINGS +#endif + #ifndef DIAGNOSTIC_ERROR_SWITCH # define DIAGNOSTIC_ERROR_SWITCH #endif |