aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2018-07-06 15:07:08 +0930
committerAlan Modra <amodra@gmail.com>2018-07-06 15:18:59 +0930
commitfe75810f8e0cc33384f22d0479506711d4014c60 (patch)
treed24b2e14f08d21666a173a16789e4ec5e28b7080 /bfd
parent724436fccb68156ff53b7b03cb7f41547a65c30c (diff)
downloadgdb-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 'bfd')
-rw-r--r--bfd/ChangeLog10
-rw-r--r--bfd/elf32-arm.c4
-rw-r--r--bfd/elf32-ppc.c4
-rw-r--r--bfd/elf32-s390.c4
-rw-r--r--bfd/elf64-ppc.c4
-rw-r--r--bfd/elf64-s390.c4
-rw-r--r--bfd/elfxx-aarch64.c4
7 files changed, 28 insertions, 6 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 650258e..b844965 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,13 @@
+2018-07-06 Alan Modra <amodra@gmail.com>
+
+ * 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.
+
2018-07-05 Jim Wilson <jimw@sifive.com>
* config.bfd (riscv32*-*-*): Renamed from riscv32-*-*.
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index b21901c..9c61181 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -2174,16 +2174,18 @@ elf32_arm_nabi_write_core_note (bfd *abfd, char *buf, int *bufsiz,
va_start (ap, note_type);
memset (data, 0, sizeof (data));
strncpy (data + 28, va_arg (ap, const char *), 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 + 44, va_arg (ap, const char *), 80);
+#if GCC_VERSION == 8001
DIAGNOSTIC_POP;
+#endif
va_end (ap);
return elfcore_write_note (abfd, buf, bufsiz,
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 3024674..5e9251b 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -2411,16 +2411,18 @@ ppc_elf_write_core_note (bfd *abfd, char *buf, int *bufsiz, int note_type, ...)
va_start (ap, note_type);
memset (data, 0, sizeof (data));
strncpy (data + 32, va_arg (ap, const char *), 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 + 48, va_arg (ap, const char *), 80);
+#if GCC_VERSION == 8001
DIAGNOSTIC_POP;
+#endif
va_end (ap);
return elfcore_write_note (abfd, buf, bufsiz,
"CORE", note_type, data, sizeof (data));
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index ebda1da..56008a1 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -3951,16 +3951,18 @@ elf_s390_write_core_note (bfd *abfd, char *buf, int *bufsiz,
va_end (ap);
strncpy (data + 28, 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 + 44, psargs, 80);
+#if GCC_VERSION == 8001
DIAGNOSTIC_POP;
+#endif
return elfcore_write_note (abfd, buf, bufsiz, "CORE", note_type,
&data, sizeof (data));
}
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index b780f1a..45d8177 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -3041,16 +3041,18 @@ ppc64_elf_write_core_note (bfd *abfd, char *buf, int *bufsiz, int note_type,
va_start (ap, note_type);
memset (data, 0, sizeof (data));
strncpy (data + 40, va_arg (ap, const char *), 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, va_arg (ap, const char *), 80);
+#if GCC_VERSION == 8001
DIAGNOSTIC_POP;
+#endif
va_end (ap);
return elfcore_write_note (abfd, buf, bufsiz,
"CORE", note_type, data, sizeof (data));
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));
}
diff --git a/bfd/elfxx-aarch64.c b/bfd/elfxx-aarch64.c
index 61a5ffb..af02f2e 100644
--- a/bfd/elfxx-aarch64.c
+++ b/bfd/elfxx-aarch64.c
@@ -640,16 +640,18 @@ _bfd_aarch64_elf_write_core_note (bfd *abfd, char *buf, int *bufsiz, int note_ty
va_start (ap, note_type);
memset (data, 0, sizeof (data));
strncpy (data + 40, va_arg (ap, const char *), 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, va_arg (ap, const char *), 80);
+#if GCC_VERSION == 8001
DIAGNOSTIC_POP;
+#endif
va_end (ap);
return elfcore_write_note (abfd, buf, bufsiz, "CORE",