aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2021-03-22 14:56:16 +0100
committerMartin Liska <mliska@suse.cz>2021-04-01 15:00:56 +0200
commite9b095a538c189369b4792662ea455d2314b0492 (patch)
tree8a6918add18cd366abcee7964b40605471ce18df /gas
parentd34049e8bb32ae2dd717dbac88dbcebefe2d6c09 (diff)
downloadgdb-e9b095a538c189369b4792662ea455d2314b0492.zip
gdb-e9b095a538c189369b4792662ea455d2314b0492.tar.gz
gdb-e9b095a538c189369b4792662ea455d2314b0492.tar.bz2
Remove strneq macro and use startswith.
bfd/ChangeLog: * ecoff.c (strneq): Remove strneq and use startswith. (_bfd_ecoff_slurp_armap): Likewise. binutils/ChangeLog: * elfcomm.h (strneq): Remove strneq and use startswith. * readelf.c (ia64_process_unwind): Likewise. (process_note): Likewise. gas/ChangeLog: * config/obj-coff.c (strneq): Remove strneq and use startswith. (weak_is_altname): Likewise. (obj_coff_section): Likewise. * config/tc-cr16.c (process_label_constant): Likewise. * config/tc-crx.c (strneq): Likewise. include/ChangeLog: * opcode/cr16.h (strneq): Remove strneq and use startswith. ld/ChangeLog: * ldbuildid.c (strneq): Remove strneq and use startswith. (validate_build_id_style): Likewise. (compute_build_id_size): Likewise. opcodes/ChangeLog: * arm-dis.c (strneq): Remove strneq and use startswith. * cr16-dis.c (print_insn_cr16): Likewise. * score-dis.c (streq): Likewise. (strneq): Likewise. * score7-dis.c (strneq): Likewise.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog8
-rw-r--r--gas/config/obj-coff.c5
-rw-r--r--gas/config/tc-cr16.c26
-rw-r--r--gas/config/tc-crx.c1
4 files changed, 23 insertions, 17 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 98918d6..b011f1c 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,13 @@
2021-04-01 Martin Liska <mliska@suse.cz>
+ * config/obj-coff.c (strneq): Remove strneq and use startswith.
+ (weak_is_altname): Likewise.
+ (obj_coff_section): Likewise.
+ * config/tc-cr16.c (process_label_constant): Likewise.
+ * config/tc-crx.c (strneq): Likewise.
+
+2021-04-01 Martin Liska <mliska@suse.cz>
+
* as.c (select_emulation_mode): Use startswith.
* config/m68k-parse.y: Likewise.
* config/obj-aout.c (obj_aout_type): Likewise.
diff --git a/gas/config/obj-coff.c b/gas/config/obj-coff.c
index 3c008a3..f3cc327 100644
--- a/gas/config/obj-coff.c
+++ b/gas/config/obj-coff.c
@@ -33,7 +33,6 @@
#endif
#define streq(a,b) (strcmp ((a), (b)) == 0)
-#define strneq(a,b,n) (strncmp ((a), (b), (n)) == 0)
/* I think this is probably always correct. */
#ifndef KEEP_RELOC_INFO
@@ -1058,7 +1057,7 @@ obj_coff_val (int ignore ATTRIBUTE_UNUSED)
static int
weak_is_altname (const char * name)
{
- return strneq (name, weak_altprefix, sizeof (weak_altprefix) - 1);
+ return startswith (name, weak_altprefix);
}
/* Return the name of the alternate symbol
@@ -1667,7 +1666,7 @@ obj_coff_section (int ignore ATTRIBUTE_UNUSED)
/* Add SEC_LINK_ONCE and SEC_LINK_DUPLICATES_DISCARD to .gnu.linkonce
sections so adjust_reloc_syms in write.c will correctly handle
relocs which refer to non-local symbols in these sections. */
- if (strneq (name, ".gnu.linkonce", sizeof (".gnu.linkonce") - 1))
+ if (startswith (name, ".gnu.linkonce"))
flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
#endif
diff --git a/gas/config/tc-cr16.c b/gas/config/tc-cr16.c
index 733b08e..1f6b1fe 100644
--- a/gas/config/tc-cr16.c
+++ b/gas/config/tc-cr16.c
@@ -905,34 +905,34 @@ process_label_constant (char *str, ins * cr16_ins)
cr16_ins->rtype = BFD_RELOC_NONE;
relocatable = 1;
- if (strneq (input_line_pointer, "@c", 2))
+ if (startswith (input_line_pointer, "@c"))
symbol_with_at = 1;
- if (strneq (input_line_pointer, "@l", 2)
- || strneq (input_line_pointer, ":l", 2))
+ if (startswith (input_line_pointer, "@l")
+ || startswith (input_line_pointer, ":l"))
symbol_with_l = 1;
- if (strneq (input_line_pointer, "@m", 2)
- || strneq (input_line_pointer, ":m", 2))
+ if (startswith (input_line_pointer, "@m")
+ || startswith (input_line_pointer, ":m"))
symbol_with_m = 1;
- if (strneq (input_line_pointer, "@s", 2)
- || strneq (input_line_pointer, ":s", 2))
+ if (startswith (input_line_pointer, "@s")
+ || startswith (input_line_pointer, ":s"))
symbol_with_s = 1;
- if (strneq (input_line_pointer, "@cGOT", 5)
- || strneq (input_line_pointer, "@cgot", 5))
+ if (startswith (input_line_pointer, "@cGOT")
+ || startswith (input_line_pointer, "@cgot"))
{
if (GOT_symbol == NULL)
GOT_symbol = symbol_find_or_make (GLOBAL_OFFSET_TABLE_NAME);
symbol_with_at_gotc = 1;
}
- else if (strneq (input_line_pointer, "@GOT", 4)
- || strneq (input_line_pointer, "@got", 4))
+ else if (startswith (input_line_pointer, "@GOT")
+ || startswith (input_line_pointer, "@got"))
{
- if ((strneq (input_line_pointer, "+", 1))
- || (strneq (input_line_pointer, "-", 1)))
+ if ((startswith (input_line_pointer, "+"))
+ || (startswith (input_line_pointer, "-")))
as_warn (_("GOT bad expression with %s."), input_line_pointer);
if (GOT_symbol == NULL)
diff --git a/gas/config/tc-crx.c b/gas/config/tc-crx.c
index a82acb5..d33a0bf 100644
--- a/gas/config/tc-crx.c
+++ b/gas/config/tc-crx.c
@@ -43,7 +43,6 @@
/* Utility macros for string comparison. */
#define streq(a, b) (strcmp (a, b) == 0)
-#define strneq(a, b, c) (strncmp (a, b, c) == 0)
/* Assign a number NUM, shifted by SHIFT bytes, into a location
pointed by index BYTE of array 'output_opcode'. */