diff options
author | Alan Modra <amodra@gmail.com> | 2021-03-31 10:02:08 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2021-03-31 10:47:59 +1030 |
commit | 57ae980e3290c0c1a9fb4a93144cc5b24457f05a (patch) | |
tree | b639bd1f64e84addc898ae6a29c97ffbe7c757ad | |
parent | edf71419e06105a73c59a95d3e74557a6c6f313b (diff) | |
download | gdb-57ae980e3290c0c1a9fb4a93144cc5b24457f05a.zip gdb-57ae980e3290c0c1a9fb4a93144cc5b24457f05a.tar.gz gdb-57ae980e3290c0c1a9fb4a93144cc5b24457f05a.tar.bz2 |
Include string.h in bfd.h and delete LITMEMCPY, LITSTRCPY
This fixes the issue that startswith depends on strncpy being
declared, and not all projects using bfd.h include string.h before
bfd.h. I've also deleted some macros that don't find much use
anywhere.
bfd/
* bfd-in.h: Include string.h.
(LITMEMCPY, LITSTRCPY): Delete.
* bfd-in2.h: Regenerate.
binutils/
* prdbg.c (pr_function_type): Replace LITSTTCPY with strcpy.
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/bfd-in.h | 8 | ||||
-rw-r--r-- | bfd/bfd-in2.h | 8 | ||||
-rw-r--r-- | binutils/ChangeLog | 4 | ||||
-rw-r--r-- | binutils/prdbg.c | 2 |
5 files changed, 13 insertions, 15 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index a94223d..5936279 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2021-03-31 Alan Modra <amodra@gmail.com> + + * bfd-in.h: Include string.h. + (LITMEMCPY, LITSTRCPY): Delete. + * bfd-in2.h: Regenerate. + 2021-03-30 Alan Modra <amodra@gmail.com> * elflink.c (elf_link_add_object_symbols): Don't set h->indx diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index fda9fe0..f90f718 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -37,6 +37,7 @@ extern "C" { #include "bfd_stdint.h" #include "diagnostics.h" #include <stdarg.h> +#include <string.h> #include <sys/stat.h> #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) @@ -57,13 +58,6 @@ extern "C" { is error prone, so using this macro is safer. */ #define STRING_COMMA_LEN(STR) (STR), (sizeof (STR) - 1) - /* strcpy() can have a similar problem, but since we know we are - copying a constant string, we can use memcpy which will be faster - since there is no need to check for a NUL byte inside STR. We - can also save time if we do not need to copy the terminating NUL. */ -#define LITMEMCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2) - 1) -#define LITSTRCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2)) - #define BFD_SUPPORTS_PLUGINS @supports_plugins@ /* The word size used by BFD on the host. This may be 64 with a 32 diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 8874da8..426ab86d 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -44,6 +44,7 @@ extern "C" { #include "bfd_stdint.h" #include "diagnostics.h" #include <stdarg.h> +#include <string.h> #include <sys/stat.h> #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) @@ -64,13 +65,6 @@ extern "C" { is error prone, so using this macro is safer. */ #define STRING_COMMA_LEN(STR) (STR), (sizeof (STR) - 1) - /* strcpy() can have a similar problem, but since we know we are - copying a constant string, we can use memcpy which will be faster - since there is no need to check for a NUL byte inside STR. We - can also save time if we do not need to copy the terminating NUL. */ -#define LITMEMCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2) - 1) -#define LITSTRCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2)) - #define BFD_SUPPORTS_PLUGINS @supports_plugins@ /* The word size used by BFD on the host. This may be 64 with a 32 diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 8928e23..b62f115 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,7 @@ +2021-03-31 Alan Modra <amodra@gmail.com> + + * prdbg.c (pr_function_type): Replace LITSTTCPY with strcpy. + 2021-03-29 Alan Modra <amodra@gmail.com> * dlltool.c (main): Don't use "boolean_condition ? TRUE : FALSE". diff --git a/binutils/prdbg.c b/binutils/prdbg.c index 614d7f9..521dfa0 100644 --- a/binutils/prdbg.c +++ b/binutils/prdbg.c @@ -752,7 +752,7 @@ pr_function_type (void *p, int argcount, bfd_boolean varargs) /* Now the return type is on the top of the stack. */ s = (char *) xmalloc (len); - LITSTRCPY (s, "(|) ("); + strcpy (s, "(|) ("); if (argcount < 0) strcat (s, "/* unknown */"); |