aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2018-04-23 09:42:44 +0930
committerAlan Modra <amodra@gmail.com>2018-04-23 18:10:41 +0930
commit5a6312e8c015d4a98020038f3b6e144db230f3ca (patch)
treedfb7f8695c3388aad94dec6d7f60ce152c6ba338 /bfd
parent5373441d20b652d5b0332b6cada74524af3ae707 (diff)
downloadgdb-5a6312e8c015d4a98020038f3b6e144db230f3ca.zip
gdb-5a6312e8c015d4a98020038f3b6e144db230f3ca.tar.gz
gdb-5a6312e8c015d4a98020038f3b6e144db230f3ca.tar.bz2
Silence gcc-8 warnings
All of these warnings were false positives. -Wstringop-truncation is particularly annoying when it warns about strncpy used quite correctly. bfd/ * elf-linux-core.h (swap_linux_prpsinfo32_ugid32_out): Disable gcc-8 string truncation warning. (swap_linux_prpsinfo32_ugid16_out): Likewise. (swap_linux_prpsinfo64_ugid32_out): Likewise. (swap_linux_prpsinfo64_ugid16_out): Likewise. * elf.c (elfcore_write_prpsinfo): Likewise. gas/ * stabs.c (generate_asm_file): Use memcpy rather than strncpy. Remove call to strlen inside loop. * config/tc-cr16.c (getreg_image): Warning fix. * config/tc-crx.c (getreg_image): Warning fix.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog9
-rw-r--r--bfd/elf-linux-core.h16
-rw-r--r--bfd/elf.c4
3 files changed, 29 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index fa26810..7cc35f3 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,12 @@
+2018-04-23 Alan Modra <amodra@gmail.com>
+
+ * elf-linux-core.h (swap_linux_prpsinfo32_ugid32_out): Disable
+ gcc-8 string truncation warning.
+ (swap_linux_prpsinfo32_ugid16_out): Likewise.
+ (swap_linux_prpsinfo64_ugid32_out): Likewise.
+ (swap_linux_prpsinfo64_ugid16_out): Likewise.
+ * elf.c (elfcore_write_prpsinfo): Likewise.
+
2018-04-20 Alan Modra <amodra@gmail.com>
PR 22978
diff --git a/bfd/elf-linux-core.h b/bfd/elf-linux-core.h
index 0a5d76f..25d33f6 100644
--- a/bfd/elf-linux-core.h
+++ b/bfd/elf-linux-core.h
@@ -69,8 +69,12 @@ swap_linux_prpsinfo32_ugid32_out
bfd_put_32 (obfd, from->pr_ppid, to->pr_ppid);
bfd_put_32 (obfd, from->pr_pgrp, to->pr_pgrp);
bfd_put_32 (obfd, from->pr_sid, to->pr_sid);
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpragmas"
+#pragma GCC diagnostic ignored "-Wstringop-truncation"
strncpy (to->pr_fname, from->pr_fname, sizeof (to->pr_fname));
strncpy (to->pr_psargs, from->pr_psargs, sizeof (to->pr_psargs));
+#pragma GCC diagnostic pop
}
/* External 32-bit structure for PRPSINFO. This structure is
@@ -121,8 +125,12 @@ swap_linux_prpsinfo32_ugid16_out
bfd_put_32 (obfd, from->pr_ppid, to->pr_ppid);
bfd_put_32 (obfd, from->pr_pgrp, to->pr_pgrp);
bfd_put_32 (obfd, from->pr_sid, to->pr_sid);
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpragmas"
+#pragma GCC diagnostic ignored "-Wstringop-truncation"
strncpy (to->pr_fname, from->pr_fname, sizeof (to->pr_fname));
strncpy (to->pr_psargs, from->pr_psargs, sizeof (to->pr_psargs));
+#pragma GCC diagnostic pop
}
/* External 64-bit structure for PRPSINFO. This structure is
@@ -174,8 +182,12 @@ swap_linux_prpsinfo64_ugid32_out
bfd_put_32 (obfd, from->pr_ppid, to->pr_ppid);
bfd_put_32 (obfd, from->pr_pgrp, to->pr_pgrp);
bfd_put_32 (obfd, from->pr_sid, to->pr_sid);
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpragmas"
+#pragma GCC diagnostic ignored "-Wstringop-truncation"
strncpy (to->pr_fname, from->pr_fname, sizeof (to->pr_fname));
strncpy (to->pr_psargs, from->pr_psargs, sizeof (to->pr_psargs));
+#pragma GCC diagnostic pop
}
/* External 64-bit structure for PRPSINFO. This structure is
@@ -227,8 +239,12 @@ swap_linux_prpsinfo64_ugid16_out
bfd_put_32 (obfd, from->pr_ppid, to->pr_ppid);
bfd_put_32 (obfd, from->pr_pgrp, to->pr_pgrp);
bfd_put_32 (obfd, from->pr_sid, to->pr_sid);
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpragmas"
+#pragma GCC diagnostic ignored "-Wstringop-truncation"
strncpy (to->pr_fname, from->pr_fname, sizeof (to->pr_fname));
strncpy (to->pr_psargs, from->pr_psargs, sizeof (to->pr_psargs));
+#pragma GCC diagnostic pop
}
#endif
diff --git a/bfd/elf.c b/bfd/elf.c
index 8ea5a81..b4549ea 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -10549,8 +10549,12 @@ elfcore_write_prpsinfo (bfd *abfd,
#endif
memset (&data, 0, sizeof (data));
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpragmas"
+#pragma GCC diagnostic ignored "-Wstringop-truncation"
strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
+#pragma GCC diagnostic pop
return elfcore_write_note (abfd, buf, bufsiz,
"CORE", note_type, &data, sizeof (data));
}