diff options
author | Alan Modra <amodra@gmail.com> | 2018-07-06 15:07:08 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2018-07-06 15:18:59 +0930 |
commit | fe75810f8e0cc33384f22d0479506711d4014c60 (patch) | |
tree | d24b2e14f08d21666a173a16789e4ec5e28b7080 /include | |
parent | 724436fccb68156ff53b7b03cb7f41547a65c30c (diff) | |
download | gdb-fe75810f8e0cc33384f22d0479506711d4014c60.zip gdb-fe75810f8e0cc33384f22d0479506711d4014c60.tar.gz gdb-fe75810f8e0cc33384f22d0479506711d4014c60.tar.bz2 |
Fix diagnostic errors
Fixes a number of build errors like the following
.../elf32-arm.c: In function 'elf32_arm_nabi_write_core_note':
.../elf32-arm.c:2177: error: #pragma GCC diagnostic not allowed inside functions
.../elf32-arm.c:2186: error: #pragma GCC diagnostic not allowed inside functions
See the comment in diagnostics.h.
include/
* diagnostics.h: Comment on macro usage.
bfd/
* elf32-arm.c (elf32_arm_nabi_write_core_note): Don't use
DIAGNOTIC_PUSH and DIAGNOSTIC_POP unconditionally.
* elf32-ppc.c (ppc_elf_write_core_note): Likewise.
* elf32-s390.c (elf_s390_write_core_note): Likewise.
* elf64-ppc.c (ppc64_elf_write_core_note): Likewise.
* elf64-s390.c (elf_s390_write_core_note): Likewise.
* elfxx-aarch64.c (_bfd_aarch64_elf_write_core_note): Likewise.
Diffstat (limited to 'include')
-rw-r--r-- | include/ChangeLog | 4 | ||||
-rw-r--r-- | include/diagnostics.h | 14 |
2 files changed, 18 insertions, 0 deletions
diff --git a/include/ChangeLog b/include/ChangeLog index e7d6d66..035b3ca 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,7 @@ +2018-07-06 Alan Modra <amodra@gmail.com> + + * diagnostics.h: Comment on macro usage. + 2018-07-05 Simon Marchi <simon.marchi@polymtl.ca> * diagnostics.h (DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS): diff --git a/include/diagnostics.h b/include/diagnostics.h index 34fc01b..9e9d1a8 100644 --- a/include/diagnostics.h +++ b/include/diagnostics.h @@ -16,6 +16,20 @@ #ifndef DIAGNOSTICS_H #define DIAGNOSTICS_H +/* If at all possible, fix the source rather than using these macros + to silence warnings. If you do use these macros be aware that + you'll need to condition their use on particular compiler versions, + which can be done for gcc using ansidecl.h's GCC_VERSION macro. + + gcc versions between 4.2 and 4.6 do not allow pragma control of + diagnostics inside functions, giving a hard error if you try to use + the finer control available with later versions. + gcc prior to 4.2 warns about diagnostic push and pop. + + The other macros have restrictions too, for example gcc-5, gcc-6 + and gcc-7 warn that -Wstringop-truncation is unknown, unless you + also add DIAGNOSTIC_IGNORE ("-Wpragma"). */ + #ifdef __GNUC__ # define DIAGNOSTIC_PUSH _Pragma ("GCC diagnostic push") # define DIAGNOSTIC_POP _Pragma ("GCC diagnostic pop") |