From fe75810f8e0cc33384f22d0479506711d4014c60 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 6 Jul 2018 15:07:08 +0930 Subject: 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. --- bfd/elf64-s390.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'bfd/elf64-s390.c') diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index 93a3c7c..ea10a89 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -3760,16 +3760,18 @@ elf_s390_write_core_note (bfd *abfd, char *buf, int *bufsiz, va_end (ap); strncpy (data + 40, fname, 16); +#if GCC_VERSION == 8001 DIAGNOSTIC_PUSH; /* GCC 8.1 warns about 80 equals destination size with -Wstringop-truncation: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85643 */ -#if GCC_VERSION == 8001 DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION; #endif strncpy (data + 56, psargs, 80); +#if GCC_VERSION == 8001 DIAGNOSTIC_POP; +#endif return elfcore_write_note (abfd, buf, bufsiz, "CORE", note_type, &data, sizeof (data)); } -- cgit v1.1