diff options
author | Alan Modra <amodra@gmail.com> | 2018-04-23 09:42:44 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2018-04-23 18:10:41 +0930 |
commit | 5a6312e8c015d4a98020038f3b6e144db230f3ca (patch) | |
tree | dfb7f8695c3388aad94dec6d7f60ce152c6ba338 /gas | |
parent | 5373441d20b652d5b0332b6cada74524af3ae707 (diff) | |
download | fsf-binutils-gdb-5a6312e8c015d4a98020038f3b6e144db230f3ca.zip fsf-binutils-gdb-5a6312e8c015d4a98020038f3b6e144db230f3ca.tar.gz fsf-binutils-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 'gas')
-rw-r--r-- | gas/ChangeLog | 7 | ||||
-rw-r--r-- | gas/config/tc-cr16.c | 5 | ||||
-rw-r--r-- | gas/config/tc-crx.c | 7 | ||||
-rw-r--r-- | gas/stabs.c | 4 |
4 files changed, 17 insertions, 6 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 21d09f8..ba3d8b5 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +2018-04-23 Alan Modra <amodra@gmail.com> + + * 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. + 2018-04-20 Kito Cheng <kito.cheng@gmail.com> * config/tc-riscv.c (options): Add OPTION_RELAX and diff --git a/gas/config/tc-cr16.c b/gas/config/tc-cr16.c index 0b73003..d25afcc 100644 --- a/gas/config/tc-cr16.c +++ b/gas/config/tc-cr16.c @@ -1124,8 +1124,7 @@ getreg_image (reg r) /* Issue a error message when register is illegal. */ #define IMAGE_ERR \ as_bad (_("Illegal register (`%s') in Instruction: `%s'"), \ - reg_name, ins_parse); \ - break; + reg_name, ins_parse); switch (rreg->type) { @@ -1134,6 +1133,7 @@ getreg_image (reg r) return rreg->image; else IMAGE_ERR; + break; case CR16_P_REGTYPE: return rreg->image; @@ -1141,6 +1141,7 @@ getreg_image (reg r) default: IMAGE_ERR; + break; } return 0; diff --git a/gas/config/tc-crx.c b/gas/config/tc-crx.c index ce8cbce..8cf4af4 100644 --- a/gas/config/tc-crx.c +++ b/gas/config/tc-crx.c @@ -1135,8 +1135,7 @@ getreg_image (reg r) /* Issue a error message when register is illegal. */ #define IMAGE_ERR \ as_bad (_("Illegal register (`%s') in instruction: `%s'"), \ - reg_name, ins_parse); \ - break; + reg_name, ins_parse); switch (rreg->type) { @@ -1145,18 +1144,21 @@ getreg_image (reg r) return rreg->image; else IMAGE_ERR; + break; case CRX_CFG_REGTYPE: if (is_procreg) return rreg->image; else IMAGE_ERR; + break; case CRX_R_REGTYPE: if (! is_procreg) return rreg->image; else IMAGE_ERR; + break; case CRX_C_REGTYPE: case CRX_CS_REGTYPE: @@ -1165,6 +1167,7 @@ getreg_image (reg r) default: IMAGE_ERR; + break; } return 0; diff --git a/gas/stabs.c b/gas/stabs.c index d82de31..6ddbdad 100644 --- a/gas/stabs.c +++ b/gas/stabs.c @@ -543,12 +543,12 @@ generate_asm_file (int type, const char *file) while (tmp < file_endp) { const char *bslash = strchr (tmp, '\\'); - size_t len = (bslash) ? (size_t) (bslash - tmp + 1) : strlen (tmp); + size_t len = bslash != NULL ? bslash - tmp + 1 : file_endp - tmp; /* Double all backslashes, since demand_copy_C_string (used by s_stab to extract the part in quotes) will try to replace them as escape sequences. backslash may appear in a filespec. */ - strncpy (bufp, tmp, len); + memcpy (bufp, tmp, len); tmp += len; bufp += len; |