]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb, gdbserver, gdbsupport: replace many uses of strcmp with streq
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 16 Mar 2026 15:23:19 +0000 (11:23 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 16 Mar 2026 17:24:00 +0000 (13:24 -0400)
Replace all occurrences of:

  strcmp (...) == 0
  strcmp (...) != 0
  !strcmp (...)
  0 == strcmp (...)
  strcmp (...) directly used as a boolean predicate

with the equivalent expression using streq.

This is for consistency (we already use streq as some places in the
testsuite) but also for clarity.  I think that streq is clearer on the
intent than strcmp.  It's also a bit shorter.

Change-Id: Ibbf5261b1872c240bc0c982c147f6a5477275a91
Approved-By: Andrew Burgess <aburgess@redhat.com>
207 files changed:
gdb/aarch64-tdep.c
gdb/ada-exp.y
gdb/ada-lang.c
gdb/amd64-dicos-tdep.c
gdb/amd64-gnu-tdep.c
gdb/amd64-linux-tdep.c
gdb/amd64-obsd-tdep.c
gdb/amd64-windows-tdep.c
gdb/arch-utils.c
gdb/arm-pikeos-tdep.c
gdb/arm-tdep.c
gdb/arm-wince-tdep.c
gdb/auto-load.c
gdb/avr-tdep.c
gdb/ax-gdb.c
gdb/bfin-tdep.c
gdb/break-catch-sig.c
gdb/break-cond-parse.c
gdb/breakpoint.c
gdb/bt-utils.c
gdb/btrace.c
gdb/c-lang.c
gdb/c-typeprint.c
gdb/c-valprint.c
gdb/charset.c
gdb/cli/cli-cmds.c
gdb/cli/cli-decode.c
gdb/cli/cli-dump.c
gdb/cli/cli-option.c
gdb/cli/cli-script.c
gdb/cli/cli-style.c
gdb/coff-pe-read.c
gdb/compile/compile-object-load.c
gdb/compile/compile.c
gdb/completer.c
gdb/corelow.c
gdb/cp-abi.c
gdb/cp-name-parser.y
gdb/cp-namespace.c
gdb/cp-support.c
gdb/cp-valprint.c
gdb/csky-tdep.c
gdb/ctfread.c
gdb/d-namespace.c
gdb/d-valprint.c
gdb/darwin-nat-info.c
gdb/dicos-tdep.c
gdb/dictionary.c
gdb/disasm.c
gdb/dtrace-probe.c
gdb/dwarf2/cooked-index-shard.c
gdb/dwarf2/cooked-index.c
gdb/dwarf2/cooked-indexer.c
gdb/dwarf2/cu.c
gdb/dwarf2/index-write.c
gdb/dwarf2/read-gdb-index.c
gdb/dwarf2/read.c
gdb/dwarf2/sect-names.h
gdb/elfread.c
gdb/eval.c
gdb/event-top.c
gdb/exec.c
gdb/extension.c
gdb/f-typeprint.c
gdb/f-valprint.c
gdb/fbsd-nat.c
gdb/fbsd-tdep.c
gdb/frame.c
gdb/frv-tdep.c
gdb/ft32-tdep.c
gdb/gcore-elf.c
gdb/gcore.c
gdb/gdb-demangle.c
gdb/gdb_bfd.c
gdb/gdbtypes.c
gdb/gnu-nat.c
gdb/gnu-v2-abi.c
gdb/go-lang.c
gdb/go32-nat.c
gdb/guile/scm-lazy-string.c
gdb/guile/scm-param.c
gdb/hppa-bsd-tdep.c
gdb/hppa-linux-tdep.c
gdb/hppa-tdep.c
gdb/i386-dicos-tdep.c
gdb/i386-gnu-tdep.c
gdb/i386-go32-tdep.c
gdb/i386-linux-tdep.c
gdb/i386-obsd-tdep.c
gdb/i386-tdep.c
gdb/i386-windows-tdep.c
gdb/ia64-tdep.c
gdb/infrun.c
gdb/interps.c
gdb/language.c
gdb/linespec.c
gdb/linux-tdep.c
gdb/linux-thread-db.c
gdb/m2-typeprint.c
gdb/m32c-tdep.c
gdb/m32r-linux-tdep.c
gdb/machoread.c
gdb/macrocmd.c
gdb/macroexp.c
gdb/macrotab.c
gdb/main.c
gdb/memattr.c
gdb/mi/mi-cmd-disas.c
gdb/mi/mi-cmd-var.c
gdb/mi/mi-getopt.c
gdb/mi/mi-main.c
gdb/mi/mi-parse.c
gdb/minsyms.c
gdb/mips-sde-tdep.c
gdb/mips-tdep.c
gdb/namespace.c
gdb/nat/linux-btrace.c
gdb/nat/linux-osdata.c
gdb/nat/linux-procfs.c
gdb/nds32-tdep.c
gdb/objc-lang.c
gdb/objfiles.c
gdb/opencl-lang.c
gdb/osabi.c
gdb/p-exp.y
gdb/p-lang.c
gdb/p-valprint.c
gdb/ppc-linux-tdep.c
gdb/ppc64-tdep.c
gdb/probe.c
gdb/python/py-breakpoint.c
gdb/python/py-lazy-string.c
gdb/python/py-micmd.c
gdb/python/py-param.c
gdb/python/py-prettyprint.c
gdb/python/py-style.c
gdb/python/python.c
gdb/record.c
gdb/regformats/regdef.h
gdb/reggroups.c
gdb/remote-fileio.c
gdb/remote.c
gdb/riscv-tdep.c
gdb/rs6000-tdep.c
gdb/rust-lang.c
gdb/rust-parse.c
gdb/s390-tdep.c
gdb/selftest-arch.c
gdb/serial.c
gdb/sh-tdep.c
gdb/sol2-tdep.c
gdb/solib-aix.c
gdb/solib-darwin.c
gdb/solib-dsbt.c
gdb/solib-frv.c
gdb/solib-svr4.c
gdb/solib-target.c
gdb/solib.c
gdb/source.c
gdb/sparc64-fbsd-tdep.c
gdb/sparc64-obsd-tdep.c
gdb/stack.c
gdb/stap-probe.c
gdb/symfile.c
gdb/symmisc.c
gdb/symtab.c
gdb/target.c
gdb/top.c
gdb/tracectf.c
gdb/tracefile-tfile.c
gdb/tracefile.c
gdb/tracepoint.c
gdb/tui/tui-layout.c
gdb/tui/tui-win.c
gdb/tui/tui.c
gdb/ui-style.c
gdb/unittests/child-path-selftests.c
gdb/unittests/cli-utils-selftests.c
gdb/unittests/copy_bitwise-selftests.c
gdb/unittests/environ-selftests.c
gdb/unittests/intrusive_list-selftests.c
gdb/unittests/lookup_name_info-selftests.c
gdb/unittests/scoped_mmap-selftests.c
gdb/unittests/unique_xmalloc_ptr_char.c
gdb/utils.c
gdb/valops.c
gdb/varobj.c
gdb/windows-tdep.c
gdb/x86-tdep.c
gdb/xcoffread.c
gdb/xml-support.c
gdb/xml-syscall.c
gdb/xml-tdesc.c
gdb/xstormy16-tdep.c
gdbserver/gdbreplay.cc
gdbserver/linux-arc-low.cc
gdbserver/linux-low.cc
gdbserver/linux-x86-low.cc
gdbserver/linux-x86-tdesc.cc
gdbserver/regcache.cc
gdbserver/remote-utils.cc
gdbserver/server.cc
gdbserver/thread-db.cc
gdbserver/tracepoint.cc
gdbsupport/common-exceptions.h
gdbsupport/osabi.cc
gdbsupport/signals.cc

index de0d7ddb73b9dd1a6b43229e9c70028498980660..ce00f518299265fe5eb517cb0556f76138511e63 100644 (file)
@@ -355,8 +355,7 @@ aarch64_analyze_prologue (struct gdbarch *gdbarch,
        break;
 
       if (inst.opcode->iclass == addsub_imm
-         && (inst.opcode->op == OP_ADD
-             || strcmp ("sub", inst.opcode->name) == 0))
+         && (inst.opcode->op == OP_ADD || streq ("sub", inst.opcode->name)))
        {
          unsigned rd = inst.operands[0].reg.regno;
          unsigned rn = inst.operands[1].reg.regno;
@@ -382,7 +381,7 @@ aarch64_analyze_prologue (struct gdbarch *gdbarch,
            seen_stack_set = true;
        }
       else if (inst.opcode->iclass == addsub_ext
-              && strcmp ("sub", inst.opcode->name) == 0)
+              && streq ("sub", inst.opcode->name))
        {
          unsigned rd = inst.operands[0].reg.regno;
          unsigned rn = inst.operands[1].reg.regno;
@@ -433,7 +432,7 @@ aarch64_analyze_prologue (struct gdbarch *gdbarch,
                                  << inst.operands[1].shifter.amount);
        }
       else if (inst.opcode->iclass == log_shift
-              && strcmp (inst.opcode->name, "orr") == 0)
+              && streq (inst.opcode->name, "orr"))
        {
          unsigned rd = inst.operands[0].reg.regno;
          unsigned rn = inst.operands[1].reg.regno;
@@ -477,7 +476,7 @@ aarch64_analyze_prologue (struct gdbarch *gdbarch,
       else if ((inst.opcode->iclass == ldstpair_off
                || (inst.opcode->iclass == ldstpair_indexed
                    && inst.operands[2].addr.preind))
-              && strcmp ("stp", inst.opcode->name) == 0)
+              && streq ("stp", inst.opcode->name))
        {
          /* STP with addressing mode Pre-indexed and Base register.  */
          unsigned rt1;
@@ -526,7 +525,7 @@ aarch64_analyze_prologue (struct gdbarch *gdbarch,
                    && (inst.opcode->op == OP_STR_POS
                        || inst.opcode->op == OP_STRF_POS)))
               && inst.operands[1].addr.base_regno == AARCH64_SP_REGNUM
-              && strcmp ("str", inst.opcode->name) == 0)
+              && streq ("str", inst.opcode->name))
        {
          /* STR (immediate) */
          unsigned int rt = inst.operands[0].reg.regno;
index 0663de01fda17e78913c595dc44a1c6150b2b31c..7c691d5a09902200c9b9285c7192f053dcb94899 100644 (file)
@@ -563,7 +563,7 @@ exp1        :       exp
 
 primary :      primary DOT_ID
                        {
-                         if (strcmp ($2.ptr, "all") == 0)
+                         if (streq ($2.ptr, "all"))
                            ada_wrap<ada_unop_ind_operation> ();
                          else
                            {
@@ -1553,7 +1553,7 @@ find_primitive_type (struct parser_state *par_state, const char *name)
   type = language_lookup_primitive_type (par_state->language (),
                                         par_state->gdbarch (),
                                         name);
-  if (type == NULL && strcmp ("system__address", name) == 0)
+  if (type == NULL && streq ("system__address", name))
     type = type_system_address (par_state);
 
   if (type != NULL)
index 908b33d9c72a4079e7f31977857113a1cc8992b5..ddffc2973e455fc75abface0d6d42907c82eff6c 100644 (file)
@@ -454,12 +454,11 @@ field_name_match (const char *field_name, const char *target)
 {
   int len = strlen (target);
 
-  return
-    (strncmp (field_name, target, len) == 0
-     && (field_name[len] == '\0'
-        || (startswith (field_name + len, "___")
-            && strcmp (field_name + strlen (field_name) - 6,
-                       "___XVN") != 0)));
+  return (strncmp (field_name, target, len) == 0
+         && (field_name[len] == '\0'
+             || (startswith (field_name + len, "___")
+                 && !streq (field_name + strlen (field_name) - 6,
+                            "___XVN"))));
 }
 
 
@@ -519,7 +518,7 @@ is_suffix (const char *str, const char *suffix)
     return false;
   len1 = strlen (str);
   len2 = strlen (suffix);
-  return len1 >= len2 && strcmp (str + len1 - len2, suffix) == 0;
+  return len1 >= len2 && streq (str + len1 - len2, suffix);
 }
 
 /* The contents of value VAL, treated as a value of type TYPE.  The
@@ -1699,8 +1698,8 @@ ada_fixup_array_indexes_type (struct type *index_desc_type)
      the field type should be a meaningless integer type whose name
      is not equal to the field name.  */
   if (index_desc_type->field (0).type ()->name () != NULL
-      && strcmp (index_desc_type->field (0).type ()->name (),
-                index_desc_type->field (0).name ()) == 0)
+      && streq (index_desc_type->field (0).type ()->name (),
+               index_desc_type->field (0).name ()))
     return;
 
   /* Fixup each field of INDEX_DESC_TYPE.  */
@@ -3850,7 +3849,7 @@ ada_resolve_enum (std::vector<struct block_symbol> &syms,
       /* We let an anonymous enum type match a non-anonymous one.  */
       if (type1->name () != nullptr
          && type2->name () != nullptr
-         && strcmp (type1->name (), type2->name ()) != 0)
+         && !streq (type1->name (), type2->name ()))
        continue;
       if (ada_identical_enum_types_p (type1, type2))
        return i;
@@ -4847,10 +4846,9 @@ equiv_types (struct type *type0, struct type *type1)
   if (type0 == NULL || type1 == NULL
       || type0->code () != type1->code ())
     return false;
-  if ((type0->code () == TYPE_CODE_STRUCT
-       || type0->code () == TYPE_CODE_ENUM)
+  if ((type0->code () == TYPE_CODE_STRUCT || type0->code () == TYPE_CODE_ENUM)
       && ada_type_name (type0) != NULL && ada_type_name (type1) != NULL
-      && strcmp (ada_type_name (type0), ada_type_name (type1)) == 0)
+      && streq (ada_type_name (type0), ada_type_name (type1)))
     return true;
 
   return false;
@@ -4894,7 +4892,7 @@ lesseq_defined_than (struct symbol *sym0, struct symbol *sym1)
       {
        const char *name0 = sym0->linkage_name ();
        const char *name1 = sym1->linkage_name ();
-       return (strcmp (name0, name1) == 0
+       return (streq (name0, name1)
                && sym0->value_address () == sym1->value_address ());
       }
 
@@ -4983,7 +4981,7 @@ is_nondebugging_type (struct type *type)
 {
   const char *name = ada_type_name (type);
 
-  return (name != NULL && strcmp (name, "<variable, no debug info>") == 0);
+  return (name != NULL && streq (name, "<variable, no debug info>"));
 }
 
 /* Return true if TYPE1 and TYPE2 are two enumeration types
@@ -5112,8 +5110,8 @@ remove_extra_symbols (std::vector<struct block_symbol> &syms)
              if (j != i
                  && !syms[j].symbol->type ()->is_stub ()
                  && syms[j].symbol->linkage_name () != NULL
-                 && strcmp (syms[i].symbol->linkage_name (),
-                            syms[j].symbol->linkage_name ()) == 0)
+                 && streq (syms[i].symbol->linkage_name (),
+                           syms[j].symbol->linkage_name ()))
                remove_p = true;
            }
        }
@@ -5129,12 +5127,12 @@ remove_extra_symbols (std::vector<struct block_symbol> &syms)
            {
              if (i != j
                  && syms[j].symbol->linkage_name () != NULL
-                 && strcmp (syms[i].symbol->linkage_name (),
-                            syms[j].symbol->linkage_name ()) == 0
+                 && streq (syms[i].symbol->linkage_name (),
+                           syms[j].symbol->linkage_name ())
                  && (syms[i].symbol->loc_class ()
                      == syms[j].symbol->loc_class ())
-                 && syms[i].symbol->value_address ()
-                 == syms[j].symbol->value_address ())
+                 && (syms[i].symbol->value_address ()
+                     == syms[j].symbol->value_address ()))
                remove_p = true;
            }
        }
@@ -5820,7 +5818,7 @@ is_name_suffix (const char *str)
 
   /* "TKB" suffixes are used for subprograms implementing task bodies.  */
 
-  if (strcmp (str, "TKB") == 0)
+  if (streq (str, "TKB"))
     return true;
 
 #if 0
@@ -5876,14 +5874,14 @@ is_name_suffix (const char *str)
        return false;
       if (str[2] == '_')
        {
-         if (strcmp (str + 3, "JM") == 0)
+         if (streq (str + 3, "JM"))
            return true;
          /* FIXME: brobecker/2004-09-30: GNAT will soon stop using
             the LJM suffix in favor of the JM one.  But we will
             still accept LJM as a valid suffix for a reasonable
             amount of time, just to allow ourselves to debug programs
             compiled using an older version of GNAT.  */
-         if (strcmp (str + 3, "LJM") == 0)
+         if (streq (str + 3, "LJM"))
            return true;
          if (str[3] != 'X')
            return false;
@@ -6211,7 +6209,7 @@ ada_is_dispatch_table_ptr_type (struct type *type)
   if (name == NULL)
     return false;
 
-  return (strcmp (name, "ada__tags__dispatch_table") == 0);
+  return (streq (name, "ada__tags__dispatch_table"));
 }
 
 /* Return true if TYPE is an interface tag.  */
@@ -6224,7 +6222,7 @@ ada_is_interface_tag (struct type *type)
   if (name == nullptr)
     return false;
 
-  return (strcmp (name, "ada__tags__interface_tag") == 0);
+  return (streq (name, "ada__tags__interface_tag"));
 }
 
 /* True if field number FIELD_NUM in struct or union type TYPE is supposed
@@ -6304,8 +6302,7 @@ ada_is_tag_type (struct type *type)
     {
       const char *name = ada_type_name (type->target_type ());
 
-      return (name != NULL
-             && strcmp (name, "ada__tags__dispatch_table") == 0);
+      return name != nullptr && streq (name, "ada__tags__dispatch_table");
     }
 }
 
@@ -6654,7 +6651,7 @@ ada_is_wrapper_field (struct type *type, int field_num)
 {
   const char *name = type->field (field_num).name ();
 
-  if (name != NULL && strcmp (name, "RETVAL") == 0)
+  if (name != NULL && streq (name, "RETVAL"))
     {
       /* This happens in functions with "out" or "in out" parameters
         which are passed by copy.  For such functions, GNAT describes
@@ -6667,7 +6664,7 @@ ada_is_wrapper_field (struct type *type, int field_num)
 
   return (name != NULL
          && (startswith (name, "PARENT")
-             || strcmp (name, "REP") == 0
+             || streq (name, "REP")
              || startswith (name, "_parent")
              || name[0] == 'S' || name[0] == 'R' || name[0] == 'O'));
 }
@@ -7565,7 +7562,7 @@ find_parallel_type_by_descriptive_type (struct type *type, const char *name)
        }
 
       /* If the names match, stop.  */
-      if (strcmp (result_name, name) == 0)
+      if (streq (result_name, name))
        break;
 
       /* Otherwise, look at the next item on the list, if any.  */
@@ -7652,7 +7649,7 @@ dynamic_template_type (struct type *type)
     {
       int len = strlen (ada_type_name (type));
 
-      if (len > 6 && strcmp (ada_type_name (type) + len - 6, "___XVE") == 0)
+      if (len > 6 && streq (ada_type_name (type) + len - 6, "___XVE"))
        return type;
       else
        return ada_find_parallel_type (type, "___XVE");
@@ -8873,10 +8870,10 @@ ada_is_character_type (struct type *type)
   return (name != NULL
          && (type->code () == TYPE_CODE_INT
              || type->code () == TYPE_CODE_RANGE)
-         && (strcmp (name, "character") == 0
-             || strcmp (name, "wide_character") == 0
-             || strcmp (name, "wide_wide_character") == 0
-             || strcmp (name, "unsigned char") == 0));
+         && (streq (name, "character")
+             || streq (name, "wide_character")
+             || streq (name, "wide_wide_character")
+             || streq (name, "unsigned char")));
 }
 
 /* True if TYPE appears to be an Ada string type.  */
@@ -8924,7 +8921,7 @@ ada_is_aligner_type (struct type *type)
 
   return (type->code () == TYPE_CODE_STRUCT
          && type->num_fields () == 1
-         && strcmp (type->field (0).name (), "F") == 0);
+         && streq (type->field (0).name (), "F"));
 }
 
 /* If there is an ___XVS-convention type parallel to SUBTYPE, return
@@ -10646,7 +10643,7 @@ convert_char_literal (struct type *type, LONGEST val)
       const char *ename = field.name ();
       size_t elen = strlen (ename);
 
-      if (elen >= len && strcmp (name, ename + elen - len) == 0)
+      if (elen >= len && streq (name, ename + elen - len))
        return field.loc_enumval ();
     }
   return val;
@@ -11432,7 +11429,7 @@ ada_ternop_slice_operation::resolve (struct expression *exp,
 bool
 ada_is_system_address_type (struct type *type)
 {
-  return (type->name () && strcmp (type->name (), "system__address") == 0);
+  return (type->name () && streq (type->name (), "system__address"));
 }
 
 \f
@@ -12020,8 +12017,8 @@ ada_unhandled_exception_name_addr_from_raise (void)
        = find_frame_funname (fi, &func_lang, NULL);
       if (func_name != NULL)
        {
-         if (strcmp (func_name.get (),
-                     data->exception_info->catch_exception_sym) == 0)
+         if (streq (func_name.get (),
+                    data->exception_info->catch_exception_sym))
            break; /* We found the frame we were looking for...  */
        }
       fi = get_prev_frame (fi);
@@ -12773,7 +12770,7 @@ ada_exception_catchpoint_cond_string (const char *excep_string,
 
   for (const char *name : standard_exc)
     {
-      if (strcmp (name, excep_string) == 0)
+      if (streq (name, excep_string))
        {
          is_standard_exc = true;
          break;
@@ -12981,7 +12978,7 @@ ada_is_exception_sym (struct symbol *sym)
          && sym->loc_class () != LOC_BLOCK
          && sym->loc_class () != LOC_CONST
          && sym->loc_class () != LOC_UNRESOLVED
-         && type_name != NULL && strcmp (type_name, "exception") == 0);
+         && type_name != nullptr && streq (type_name, "exception"));
 }
 
 /* Given a global symbol SYM, return non-zero iff SYM is a non-standard
@@ -12995,13 +12992,13 @@ ada_is_non_standard_exception_sym (struct symbol *sym)
     return false;
 
   for (const char *name : standard_exc)
-    if (strcmp (sym->linkage_name (), name) == 0)
+    if (streq (sym->linkage_name (), name))
       return false;  /* A standard exception.  */
 
   /* Numeric_Error is also a standard exception, so exclude it.
      See the STANDARD_EXC description for more details as to why
      this exception is not listed in that array.  */
-  if (strcmp (sym->linkage_name (), "numeric_error") == 0)
+  if (streq (sym->linkage_name (), "numeric_error"))
     return false;
 
   return true;
@@ -13029,7 +13026,7 @@ ada_exc_info::operator< (const ada_exc_info &other) const
 bool
 ada_exc_info::operator== (const ada_exc_info &other) const
 {
-  return addr == other.addr && strcmp (name, other.name) == 0;
+  return addr == other.addr && streq (name, other.name);
 }
 
 /* Sort EXCEPTIONS using compare_ada_exception_info as the comparison
@@ -13373,7 +13370,7 @@ do_exact_match (const char *symbol_search_name,
                const lookup_name_info &lookup_name,
                completion_match_result *comp_match_res)
 {
-  return strcmp (symbol_search_name, ada_lookup_name (lookup_name)) == 0;
+  return streq (symbol_search_name, ada_lookup_name (lookup_name));
 }
 
 /* Build the Ada lookup name for LOOKUP_NAME.  */
index 915d1141110afd47f1c4e30267a0f0501254225b..259d4e86c003cf614ba006efc6a31c35531bc339 100644 (file)
@@ -38,8 +38,7 @@ amd64_dicos_osabi_sniffer (bfd *abfd)
 
   /* On amd64-DICOS, the Load Module's "header" section is 72
      bytes.  */
-  if (strcmp (target_name, "elf64-x86-64") == 0
-      && dicos_load_module_p (abfd, 72))
+  if (streq (target_name, "elf64-x86-64") && dicos_load_module_p (abfd, 72))
     return GDB_OSABI_DICOS;
 
   return GDB_OSABI_UNKNOWN;
index 963ca791b1003d0222d12043ff4ea655feeb5cfd..366cc4584adab861c71f56b0d3cc53296dc43195 100644 (file)
@@ -90,7 +90,7 @@ amd64_gnu_sigtramp_p (const frame_info_ptr &this_frame)
   find_pc_partial_function (pc, &name, NULL, NULL);
 
   /* If we have a NAME, we can check for the trampoline function */
-  if (name != NULL && strcmp (name, "trampoline") == 0)
+  if (name != NULL && streq (name, "trampoline"))
     return 1;
 
   return amd64_gnu_sigtramp_start (this_frame) != 0;
index ff0c58464f251202cd0181cb670300c983d93424..17d9f78f32d1a532048cbe749169ea8476f51f07 100644 (file)
@@ -206,7 +206,7 @@ amd64_linux_sigtramp_p (const frame_info_ptr &this_frame)
   if (name == NULL || strstr (name, "sigaction") != NULL)
     return (amd64_linux_sigtramp_start (this_frame) != 0);
 
-  return (strcmp ("__restore_rt", name) == 0);
+  return (streq ("__restore_rt", name));
 }
 
 /* Offset to struct sigcontext in ucontext, from <asm/ucontext.h>.  */
index 81bc5f5d93ca572f81be817a2f760449f2e4091f..0dbc47be6f9abb952a5961fe2ed36dd05afe7f6a 100644 (file)
@@ -396,10 +396,9 @@ amd64obsd_trapframe_sniffer (const struct frame_unwind *self,
     return 0;
 
   find_pc_partial_function (get_frame_pc (this_frame), &name, NULL, NULL);
-  return (name && ((strcmp (name, "calltrap") == 0)
-                  || (strcmp (name, "osyscall1") == 0)
-                  || (strcmp (name, "Xsyscall") == 0)
-                  || (startswith (name, "Xintr"))));
+  return (name != nullptr
+         && (streq (name, "calltrap") || streq (name, "osyscall1")
+             || streq (name, "Xsyscall") || startswith (name, "Xintr")));
 }
 
 static const struct frame_unwind_legacy amd64obsd_trapframe_unwind (
index a9ca7b2ac79bb0ca8274b12727e1b52a10e7b2a6..85f7ac51a4f9a7c7801965a395cf1982e89be512 100644 (file)
@@ -444,7 +444,7 @@ amd64_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
          bound_minimal_symbol s = lookup_minimal_symbol_by_pc (call_dest);
          if (s.minsym != NULL
              && s.minsym->linkage_name () != NULL
-             && strcmp (s.minsym->linkage_name (), "__main") == 0)
+             && streq (s.minsym->linkage_name (), "__main"))
            pc += 5;
        }
     }
@@ -1379,7 +1379,7 @@ amd64_cygwin_core_osabi_sniffer (bfd *abfd)
 
   /* Cygwin uses elf core dumps.  Do not claim all ELF executables,
      check whether there is a .reg section of proper size.  */
-  if (strcmp (target_name, "elf64-x86-64") == 0)
+  if (streq (target_name, "elf64-x86-64"))
     {
       asection *section = bfd_get_section_by_name (abfd, ".reg");
       if (section != nullptr
index 8de7655e6384ff88fa7dfe6d87cb5dd3db3c3283..ea0b3c111f99b51afed6f78372f6c9cf055758e2 100644 (file)
@@ -295,7 +295,7 @@ default_floatformat_for_type (struct gdbarch *gdbarch,
   /* Check if this is a bfloat16 type.  It has the same size as the
      IEEE half float type, so we use the base type name to tell them
      apart.  */
-  if (name != nullptr && strcmp (name, "__bf16") == 0
+  if (name != nullptr && streq (name, "__bf16")
       && len == gdbarch_bfloat16_bit (gdbarch))
     format = gdbarch_bfloat16_format (gdbarch);
   else if (len == gdbarch_half_bit (gdbarch))
@@ -553,7 +553,7 @@ set_architecture (const char *ignore_args,
 {
   struct gdbarch_info info;
 
-  if (strcmp (set_architecture_string, "auto") == 0)
+  if (streq (set_architecture_string, "auto"))
     {
       target_architecture_user = NULL;
       if (!gdbarch_update_p (current_inferior (), info))
index ce7297d51bea8269213cbc9a3b5f0b9ec0f3c5b2..8b84cc3f68a1216c9a1dd0523ab594c246b2c76c 100644 (file)
@@ -58,12 +58,10 @@ arm_pikeos_osabi_sniffer (bfd *abfd)
     {
       const char *name = bfd_asymbol_name (sym);
 
-      if (strcmp (name, "_vm_stack") == 0
-         || strcmp (name, "__p4_stack") == 0)
+      if (streq (name, "_vm_stack") || streq (name, "__p4_stack"))
        pikeos_stack_found = 1;
 
-      if (strcmp (name, "_vm_stack_size") == 0
-         || strcmp (name, "__p4_stack_end") == 0)
+      if (streq (name, "_vm_stack_size") || streq (name, "__p4_stack_end"))
        pikeos_stack_size_found = 1;
     }
 
index dabae0aec0f005a5e739584828bd41e925070bb2..83dc71cc9da89da4c8176ae8d87b1d846e6aa6b4 100644 (file)
@@ -734,9 +734,9 @@ arm_pc_is_thumb (struct gdbarch *gdbarch, CORE_ADDR memaddr)
     return 1;
 
   /* If the user wants to override the symbol table, let him.  */
-  if (strcmp (arm_force_mode_string, "arm") == 0)
+  if (streq (arm_force_mode_string, "arm"))
     return 0;
-  if (strcmp (arm_force_mode_string, "thumb") == 0)
+  if (streq (arm_force_mode_string, "thumb"))
     return 1;
 
   /* ARM v6-M and v7-M are always in Thumb mode.  */
@@ -754,9 +754,9 @@ arm_pc_is_thumb (struct gdbarch *gdbarch, CORE_ADDR memaddr)
     return (MSYMBOL_IS_SPECIAL (sym.minsym));
 
   /* If the user wants to override the fallback mode, let them.  */
-  if (strcmp (arm_fallback_mode_string, "arm") == 0)
+  if (streq (arm_fallback_mode_string, "arm"))
     return 0;
-  if (strcmp (arm_fallback_mode_string, "thumb") == 0)
+  if (streq (arm_fallback_mode_string, "thumb"))
     return 1;
 
   /* If we couldn't find any symbol, but we're talking to a running
@@ -9408,7 +9408,7 @@ arm_skip_stub (const frame_info_ptr &frame, CORE_ADDR pc)
       int offset = strlen (name) - 2;
 
       for (regno = 0; regno <= 14; regno++)
-       if (strcmp (&name[offset], table[regno]) == 0)
+       if (streq (&name[offset], table[regno]))
          return get_frame_register_unsigned (frame, regno);
     }
 
@@ -9476,7 +9476,7 @@ set_fp_model_sfunc (const char *args, int from_tty,
   int fp_model;
 
   for (fp_model = ARM_FLOAT_AUTO; fp_model != ARM_FLOAT_LAST; fp_model++)
-    if (strcmp (current_fp_model, fp_model_strings[fp_model]) == 0)
+    if (streq (current_fp_model, fp_model_strings[fp_model]))
       {
        arm_fp_model = (enum arm_float_model) fp_model;
        break;
@@ -9516,7 +9516,7 @@ arm_set_abi (const char *args, int from_tty,
   int arm_abi;
 
   for (arm_abi = ARM_ABI_AUTO; arm_abi != ARM_ABI_LAST; arm_abi++)
-    if (strcmp (arm_abi_string, arm_abi_strings[arm_abi]) == 0)
+    if (streq (arm_abi_string, arm_abi_strings[arm_abi]))
       {
        arm_abi_global = (enum arm_abi_kind) arm_abi;
        break;
@@ -10043,7 +10043,7 @@ arm_code_of_frame_writable (struct gdbarch *gdbarch, const frame_info_ptr &frame
 static const char *
 arm_gnu_triplet_regexp (struct gdbarch *gdbarch)
 {
-  if (strcmp (gdbarch_bfd_arch_info (gdbarch)->arch_name, "arm") == 0)
+  if (streq (gdbarch_bfd_arch_info (gdbarch)->arch_name, "arm"))
     return "arm(v[^- ]*)?";
   return gdbarch_bfd_arch_info (gdbarch)->arch_name;
 }
@@ -11010,7 +11010,7 @@ INIT_GDB_FILE (arm_tdep)
        size_t offset = strlen ("reg-names-");
        const char *style = disasm_options->name[i];
        valid_disassembly_styles[j++] = &style[offset];
-       if (strcmp (&style[offset], "std") == 0)
+       if (streq (&style[offset], "std"))
          disassembly_style = &style[offset];
        length = snprintf (rdptr, rest, "%s - %s\n", &style[offset],
                           disasm_options->description[i]);
index 39593f4c3f374f667d538695655fc25dee5150c6..1a03e63bb681c7ca667336ee3c152428dc84d395 100644 (file)
@@ -103,7 +103,7 @@ arm_wince_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
 
       if (s.minsym != NULL
          && s.minsym->linkage_name () != NULL
-         && strcmp (s.minsym->linkage_name (), "__gccmain") == 0)
+         && streq (s.minsym->linkage_name (), "__gccmain"))
        pc += 4;
     }
 
@@ -143,7 +143,7 @@ arm_wince_osabi_sniffer (bfd *abfd)
 {
   const char *target_name = bfd_get_target (abfd);
 
-  if (strcmp (target_name, "pei-arm-wince-little") == 0)
+  if (streq (target_name, "pei-arm-wince-little"))
     return GDB_OSABI_WINCE;
 
   return GDB_OSABI_UNKNOWN;
index b5fec13743cbc834c601745c6d6c76838a934fea..7bb062ed432220cb979f79498821427409937167 100644 (file)
@@ -279,7 +279,7 @@ auto_load_safe_path_vec_update (void)
 
       if (debug_auto_load)
        {
-         if (strcmp (in_vec.get (), original.get ()) == 0)
+         if (streq (in_vec.get (), original.get ()))
            auto_load_debug_printf ("Using directory \"%s\".",
                                    in_vec.get ());
          else
@@ -288,7 +288,7 @@ auto_load_safe_path_vec_update (void)
        }
 
       /* If gdb_realpath returns a different content, append it.  */
-      if (strcmp (real_path.get (), in_vec.get ()) != 0)
+      if (!streq (real_path.get (), in_vec.get ()))
        {
          auto_load_debug_printf ("And canonicalized as \"%s\".",
                                  real_path.get ());
@@ -468,12 +468,12 @@ filename_is_in_auto_load_safe_path_vec (const char *filename,
       if (*filename_realp == NULL)
        {
          *filename_realp = gdb_realpath (filename);
-         if (debug_auto_load && strcmp (filename_realp->get (), filename) != 0)
+         if (debug_auto_load && !streq (filename_realp->get (), filename))
            auto_load_debug_printf ("Resolved file \"%s\" as \"%s\".",
                                    filename, filename_realp->get ());
        }
 
-      if (strcmp (filename_realp->get (), filename) != 0)
+      if (!streq (filename_realp->get (), filename))
        for (const gdb::unique_xmalloc_ptr<char> &p : auto_load_safe_path_vec)
          if (filename_is_in_pattern (filename_realp->get (), p.get ()))
            {
@@ -629,7 +629,7 @@ eq_loaded_script_entry (const void *a, const void *b)
   const struct loaded_script *ea = (const struct loaded_script *) a;
   const struct loaded_script *eb = (const struct loaded_script *) b;
 
-  return strcmp (ea->name, eb->name) == 0 && ea->language == eb->language;
+  return streq (ea->name, eb->name) && ea->language == eb->language;
 }
 
 /* Initialize the table to track loaded scripts.
@@ -915,7 +915,7 @@ auto_load_objfile_script (struct objfile *objfile,
        (bfd_get_debug_link_info (parent->obfd.get (), &crc32));
 
       if (debuglink.get () != nullptr
-         && strcmp (debuglink.get (), lbasename (realname.get ())) != 0)
+         && !streq (debuglink.get (), lbasename (realname.get ())))
        {
          /* Replace the last component of the parent's path with the
             debuglink name.  */
@@ -1261,8 +1261,7 @@ print_script (struct loaded_script *script)
   uiout->text ("\n");
 
   /* If the name isn't the full path, print it too.  */
-  if (script->full_path != NULL
-      && strcmp (script->name, script->full_path) != 0)
+  if (script->full_path != NULL && !streq (script->name, script->full_path))
     {
       uiout->text ("\tfull name: ");
       uiout->field_string ("full_path", script->full_path);
index 8b88f69a04f2a2333247bd52535afa91a0aeb4cc..f445a2db6ba784fc7f8092da4b1a9725f423a68a 100644 (file)
@@ -1412,7 +1412,7 @@ avr_address_class_name_to_type_flags (struct gdbarch *gdbarch,
                                      const char* name,
                                      type_instance_flags *type_flags_ptr)
 {
-  if (strcmp (name, "flash") == 0)
+  if (streq (name, "flash"))
     {
       *type_flags_ptr = AVR_TYPE_INSTANCE_FLAG_ADDRESS_CLASS_FLASH;
       return true;
index 2a96ff1c62133872cdce4b65099a9c3622e0531f..498a307c86882c982fbab067ec202c6bf47f7729 100644 (file)
@@ -1345,7 +1345,7 @@ gen_struct_ref_recursive (struct agent_expr *ax, struct axs_value *value,
 
       if (this_name)
        {
-         if (strcmp (field, this_name) == 0)
+         if (streq (field, this_name))
            {
              /* Note that bytecodes for the struct's base (aka
                 "this") will have been generated already, which will
@@ -1486,7 +1486,7 @@ gen_struct_elt_for_reference (struct agent_expr *ax, struct axs_value *value,
     {
       const char *t_field_name = t->field (i).name ();
 
-      if (t_field_name && strcmp (t_field_name, fieldname) == 0)
+      if (t_field_name && streq (t_field_name, fieldname))
        {
          if (t->field (i).is_static ())
            {
@@ -2478,7 +2478,7 @@ agent_eval_command_one (const char *exp, int eval, CORE_ADDR pc)
   agent_expr_up agent;
 
   arg = exp;
-  if (!eval && strcmp (arg, "$_ret") == 0)
+  if (!eval && streq (arg, "$_ret"))
     {
       agent = gen_trace_for_return_address (pc, get_current_arch (),
                                            trace_string);
index 5e133016645864c87e3bbafad56b3ff3e0f7624b..2a9e458e51cd0ab3107aa2b8efe26773928fb039 100644 (file)
@@ -597,7 +597,7 @@ bfin_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
 
   *size = kind;
 
-  if (strcmp (target_shortname (), "sim") == 0)
+  if (streq (target_shortname (), "sim"))
     return bfin_sim_breakpoint;
   else
     return bfin_breakpoint;
index fbc4458145a2de08e63d03dc22c57828ab5a3129..ea85083b6f863983763bcde0e6cd8191c1c33e7d 100644 (file)
@@ -87,7 +87,7 @@ signal_to_name_or_int (enum gdb_signal sig)
 {
   const char *result = gdb_signal_to_name (sig);
 
-  if (strcmp (result, "?") == 0)
+  if (streq (result, "?"))
     result = plongest (sig);
 
   return result;
index e2283a8d59f46d8feab66ecdbf73b51ae0513415..4fec4dbef94ffbb8b55d1b78077125667394c3d3 100644 (file)
@@ -588,9 +588,9 @@ test (const char *input, const char *condition, int thread = -1,
 
   if ((condition == nullptr) != (extracted_condition.get () == nullptr)
       || (condition != nullptr
-         && strcmp (condition, extracted_condition.get ()) != 0)
+         && !streq (condition, extracted_condition.get ()))
       || (rest == nullptr) != (extracted_rest.get () == nullptr)
-      || (rest != nullptr && strcmp (rest, extracted_rest.get ()) != 0)
+      || (rest != nullptr && !streq (rest, extracted_rest.get ()))
       || thread != extracted_thread
       || inferior != extracted_inferior
       || task != extracted_task
index a48a2ceb4f3bcf88d185dc00946a506d19fe66d3..d7be1b44229e2c24422b499f73308c3db6989068 100644 (file)
@@ -4836,7 +4836,7 @@ breakpoint_about_to_proceed (void)
 static bool
 command_line_is_silent (struct command_line *cmd)
 {
-  return cmd && (strcmp ("silent", cmd->line) == 0);
+  return cmd && (streq ("silent", cmd->line));
 }
 
 /* Sets the $_hit_bpnum and $_hit_locno to bpnum and locno.
@@ -6325,7 +6325,7 @@ wrap_indent_at_field (struct ui_out *uiout, const char *col_name)
   total_width = 0;
   for (i = 1; uiout->query_table_field (i, &width, &align, &text); i++)
     {
-      if (strcmp (text, col_name) == 0)
+      if (streq (text, col_name))
        return total_width;
 
       total_width += width + 1;
@@ -8723,9 +8723,9 @@ update_dprintf_command_list (struct breakpoint *b)
   if (*dprintf_args != '"')
     error (_("Bad format string, missing '\"'."));
 
-  if (strcmp (dprintf_style, dprintf_style_gdb) == 0)
+  if (streq (dprintf_style, dprintf_style_gdb))
     printf_line = xstrprintf ("printf %s", dprintf_args);
-  else if (strcmp (dprintf_style, dprintf_style_call) == 0)
+  else if (streq (dprintf_style, dprintf_style_call))
     {
       if (dprintf_function.empty ())
        error (_("No function supplied for dprintf call"));
@@ -8740,7 +8740,7 @@ update_dprintf_command_list (struct breakpoint *b)
                                  dprintf_function.c_str (),
                                  dprintf_args);
     }
-  else if (strcmp (dprintf_style, dprintf_style_agent) == 0)
+  else if (streq (dprintf_style, dprintf_style_agent))
     {
       if (target_can_run_breakpoint_commands ())
        printf_line = xstrprintf ("agent-printf %s", dprintf_args);
@@ -13102,8 +13102,7 @@ update_breakpoint_locations (code_breakpoint *b,
        {
          for (bp_location &l : b->locations ())
            if (l.function_name
-               && strcmp (e.function_name.get (),
-                          l.function_name.get ()) == 0)
+               && streq (e.function_name.get (), l.function_name.get ()))
              {
                l.enabled = e.enabled;
                break;
index c2566931bf2fc0dca7ff32f670781cb656606073..7fc8d04f306bb8e4df458f5a7d3a87b8c9af1980 100644 (file)
@@ -104,7 +104,7 @@ libbacktrace_print (void *data, uintptr_t pc, const char *filename,
     }
   sig_write ("\n");
 
-  return function != nullptr && strcmp (function, "main") == 0;
+  return function != nullptr && streq (function, "main");
 }
 
 /* Write a backtrace to GDB's stderr in an async safe manner.  This is a
index 27487f526ab524e15ab233b7be84731e0c024b8e..6a8f0f549d1a7eac16d32b8b41f161f64f2f47d9 100644 (file)
@@ -196,7 +196,7 @@ ftrace_function_switched (const struct btrace_function *bfun,
 
   /* If the minimal symbol changed, we certainly switched functions.  */
   if (mfun != NULL && msym != NULL
-      && strcmp (mfun->linkage_name (), msym->linkage_name ()) != 0)
+      && !streq (mfun->linkage_name (), msym->linkage_name ()))
     return 1;
 
   /* If the symbol changed, we certainly switched functions.  */
@@ -205,7 +205,7 @@ ftrace_function_switched (const struct btrace_function *bfun,
       const char *bfname, *fname;
 
       /* Check the function name.  */
-      if (strcmp (fun->linkage_name (), sym->linkage_name ()) != 0)
+      if (!streq (fun->linkage_name (), sym->linkage_name ()))
        return 1;
 
       /* Check the location of those functions, as well.  */
@@ -604,7 +604,7 @@ ftrace_update_function (struct btrace_thread_info *btinfo,
               create a stack back trace with the same function names but
               different frame id's.  This will confuse stepping.  */
            fname = ftrace_print_function_name (bfun);
-           if (strcmp (fname, "_dl_runtime_resolve") == 0)
+           if (streq (fname, "_dl_runtime_resolve"))
              return ftrace_new_tailcall (btinfo, mfun, fun);
 
            return ftrace_new_return (btinfo, mfun, fun);
@@ -3316,7 +3316,7 @@ maint_btrace_packet_history_cmd (const char *arg, int from_tty)
       return;
     }
 
-  if (arg == NULL || *arg == 0 || strcmp (arg, "+") == 0)
+  if (arg == NULL || *arg == 0 || streq (arg, "+"))
     {
       from = to;
 
@@ -3324,7 +3324,7 @@ maint_btrace_packet_history_cmd (const char *arg, int from_tty)
        size = end - from;
       to = from + size;
     }
-  else if (strcmp (arg, "-") == 0)
+  else if (streq (arg, "-"))
     {
       to = from;
 
index a8e3a467bec41f9ddd592466372e79131c576c94..fdb5be7b2b7a75f09edd6f438943cdf47e91823e 100644 (file)
@@ -90,19 +90,19 @@ classify_type (struct type *elttype, struct gdbarch *gdbarch,
          goto done;
        }
 
-      if (!strcmp (name, "wchar_t"))
+      if (streq (name, "wchar_t"))
        {
          result = C_WIDE_CHAR;
          goto done;
        }
 
-      if (!strcmp (name, "char16_t"))
+      if (streq (name, "char16_t"))
        {
          result = C_CHAR_16;
          goto done;
        }
 
-      if (!strcmp (name, "char32_t"))
+      if (streq (name, "char32_t"))
        {
          result = C_CHAR_32;
          goto done;
index 76472c23254feaeca5ead8608e03727d85d161ca..821b78becf416a1cf3e255edd8d7c0ae25581ad4 100644 (file)
@@ -128,7 +128,7 @@ c_print_type_1 (struct type *type,
                  || code == TYPE_CODE_METHODPTR
                  || TYPE_IS_REFERENCE (type))))
        gdb_puts (" ", stream);
-      need_post_space = (varstring != NULL && strcmp (varstring, "") != 0);
+      need_post_space = (varstring != NULL && !streq (varstring, ""));
       c_type_print_varspec_prefix (type, stream, show, 0, need_post_space,
                                   language, flags, podata);
     }
@@ -181,8 +181,7 @@ c_print_typedef (struct type *type,
   gdb_printf (stream, "typedef ");
   type_print (type, "", stream, -1);
   if ((new_symbol->type ())->name () == 0
-      || strcmp ((new_symbol->type ())->name (),
-                new_symbol->linkage_name ()) != 0
+      || !streq ((new_symbol->type ())->name (), new_symbol->linkage_name ())
       || new_symbol->type ()->code () == TYPE_CODE_TYPEDEF)
     gdb_printf (stream, " %s", new_symbol->print_name ());
   gdb_printf (stream, ";");
@@ -1100,8 +1099,7 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
          int j, len2 = TYPE_FN_FIELDLIST_LENGTH (type, i);
          const char *method_name = TYPE_FN_FIELDLIST_NAME (type, i);
          const char *name = type->name ();
-         int is_constructor = name && strcmp (method_name,
-                                              name) == 0;
+         int is_constructor = name != nullptr && streq (method_name, name);
 
          for (j = 0; j < len2; j++)
            {
index 522b42497d12e5433637a21f24651f076eae75f7..9f9f61ea2e0d12fc4b9ba07bcab8be6a3005e56f 100644 (file)
@@ -38,9 +38,9 @@
 static int
 textual_name (const char *name)
 {
-  return (!strcmp (name, "wchar_t")
-         || !strcmp (name, "char16_t")
-         || !strcmp (name, "char32_t"));
+  return (streq (name, "wchar_t")
+         || streq (name, "char16_t")
+         || streq (name, "char32_t"));
 }
 
 /* Apply a heuristic to decide whether an array of TYPE or a pointer
@@ -500,8 +500,7 @@ c_value_print (struct value *val, struct ui_file *stream,
       if (original_type->code () == TYPE_CODE_PTR
          && original_type->name () == NULL
          && original_type->target_type ()->name () != NULL
-         && (strcmp (original_type->target_type ()->name (),
-                     "char") == 0
+         && (streq (original_type->target_type ()->name (), "char")
              || textual_name (original_type->target_type ()->name ())))
        {
          /* Print nothing.  */
index 2f0ceafd57d0124a6dd56f4c3b74021c4db730d0..1b0725b50783d45e03f0734f4d4a77565e90144e 100644 (file)
 static iconv_t
 phony_iconv_open (const char *to, const char *from)
 {
-  if (strcmp (to, "wchar_t") && strcmp (to, GDB_DEFAULT_HOST_CHARSET))
+  if (!streq (to, "wchar_t") && !streq (to, GDB_DEFAULT_HOST_CHARSET))
     return -1;
 
-  if (!strcmp (from, "UTF-32BE") || !strcmp (from, "UTF-32"))
+  if (streq (from, "UTF-32BE") || streq (from, "UTF-32"))
     return 1;
 
-  if (!strcmp (from, "UTF-32LE"))
+  if (streq (from, "UTF-32LE"))
     return 2;
 
-  if (strcmp (from, "wchar_t") && strcmp (from, GDB_DEFAULT_HOST_CHARSET))
+  if (!streq (from, "wchar_t") && !streq (from, GDB_DEFAULT_HOST_CHARSET))
     return -1;
 
   return 0;
@@ -232,7 +232,7 @@ show_host_charset_name (struct ui_file *file, int from_tty,
                        struct cmd_list_element *c,
                        const char *value)
 {
-  if (!strcmp (value, "auto"))
+  if (streq (value, "auto"))
     gdb_printf (file,
                _("The host character set is \"auto; currently %s\".\n"),
                auto_host_charset_name);
@@ -245,7 +245,7 @@ static void
 show_target_charset_name (struct ui_file *file, int from_tty,
                          struct cmd_list_element *c, const char *value)
 {
-  if (!strcmp (value, "auto"))
+  if (streq (value, "auto"))
     gdb_printf (file,
                _("The target character set is \"auto; "
                  "currently %s\".\n"),
@@ -262,7 +262,7 @@ show_target_wide_charset_name (struct ui_file *file,
                               struct cmd_list_element *c,
                               const char *value)
 {
-  if (!strcmp (value, "auto"))
+  if (streq (value, "auto"))
     gdb_printf (file,
                _("The target wide character set is \"auto; "
                  "currently %s\".\n"),
@@ -311,7 +311,7 @@ set_be_le_names (struct gdbarch *gdbarch)
   target_wide_charset_be_name = NULL;
 
   target_wide = target_wide_charset_name;
-  if (!strcmp (target_wide, "auto"))
+  if (streq (target_wide, "auto"))
     target_wide = gdbarch_auto_wide_charset (gdbarch);
 
   len = strlen (target_wide);
@@ -344,7 +344,7 @@ validate (struct gdbarch *gdbarch)
   const char *target_cset = target_charset (gdbarch);
   const char *target_wide_cset = target_wide_charset_name;
 
-  if (!strcmp (target_wide_cset, "auto"))
+  if (streq (target_wide_cset, "auto"))
     target_wide_cset = gdbarch_auto_wide_charset (gdbarch);
 
   desc = iconv_open (target_wide_cset, host_cset);
@@ -416,7 +416,7 @@ show_charset (struct ui_file *file, int from_tty,
 const char *
 host_charset (void)
 {
-  if (!strcmp (host_charset_name, "auto"))
+  if (streq (host_charset_name, "auto"))
     return auto_host_charset_name;
   return host_charset_name;
 }
@@ -424,7 +424,7 @@ host_charset (void)
 const char *
 target_charset (struct gdbarch *gdbarch)
 {
-  if (!strcmp (target_charset_name, "auto"))
+  if (streq (target_charset_name, "auto"))
     return default_auto_charset ();
   return target_charset_name;
 }
@@ -446,7 +446,7 @@ target_wide_charset (struct gdbarch *gdbarch)
        return target_wide_charset_le_name;
     }
 
-  if (!strcmp (target_wide_charset_name, "auto"))
+  if (streq (target_wide_charset_name, "auto"))
     return gdbarch_auto_wide_charset (gdbarch);
 
   return target_wide_charset_name;
@@ -505,7 +505,7 @@ convert_between_encodings (const char *from, const char *to,
   unsigned int space_request;
 
   /* Often, the host and target charsets will be the same.  */
-  if (!strcmp (from, to))
+  if (streq (from, to))
     {
       obstack_grow (output, bytes, num_bytes);
       return;
@@ -1004,7 +1004,7 @@ INIT_GDB_FILE (charset)
   /* Solaris will return `646' here -- but the Solaris iconv then does
      not accept this.  Darwin (and maybe FreeBSD) may return "" here,
      which GNU libiconv doesn't like (infinite loop).  */
-  if (!strcmp (auto_host_charset_name, "646") || !*auto_host_charset_name)
+  if (streq (auto_host_charset_name, "646") || !*auto_host_charset_name)
     auto_host_charset_name = "ASCII";
   auto_target_charset_name = auto_host_charset_name;
 #elif defined (USE_WIN32API)
@@ -1031,7 +1031,7 @@ INIT_GDB_FILE (charset)
     auto_target_charset_name = auto_host_charset_name;
 
     /* Windows Terminal supports Emoji when using UTF-8 output.  */
-    if (strcmp (w32_host_default_charset, "UTF-8") != 0)
+    if (!streq (w32_host_default_charset, "UTF-8"))
       no_emojis ();
   }
 #endif
@@ -1039,7 +1039,7 @@ INIT_GDB_FILE (charset)
 
   /* Recall that the first element is always "auto".  */
   host_charset_name = charset_enum[0];
-  gdb_assert (strcmp (host_charset_name, "auto") == 0);
+  gdb_assert (streq (host_charset_name, "auto"));
   add_setshow_enum_cmd ("charset", class_support,
                        charset_enum, &host_charset_name, _("\
 Set the host and target character sets."), _("\
@@ -1070,7 +1070,7 @@ To see a list of the character sets GDB supports, type `set host-charset <TAB>'.
 
   /* Recall that the first element is always "auto".  */
   target_charset_name = charset_enum[0];
-  gdb_assert (strcmp (target_charset_name, "auto") == 0);
+  gdb_assert (streq (target_charset_name, "auto"));
   add_setshow_enum_cmd ("target-charset", class_support,
                        charset_enum, &target_charset_name, _("\
 Set the target character set."), _("\
@@ -1085,7 +1085,7 @@ To see a list of the character sets GDB supports, type `set target-charset'<TAB>
 
   /* Recall that the first element is always "auto".  */
   target_wide_charset_name = charset_enum[0];
-  gdb_assert (strcmp (target_wide_charset_name, "auto") == 0);
+  gdb_assert (streq (target_wide_charset_name, "auto"));
   add_setshow_enum_cmd ("target-wide-charset", class_support,
                        charset_enum, &target_wide_charset_name,
                        _("\
index 760889fbc720edf4c13e6984019e2cfea9a1a9ac..e58553245b3186722ecdc2a697a0263811aa3afc 100644 (file)
@@ -497,7 +497,7 @@ pwd_command (const char *args, int from_tty)
     error (_("Error finding name of working directory: %s"),
           safe_strerror (errno));
 
-  if (strcmp (cwd.get (), current_directory) != 0)
+  if (!streq (cwd.get (), current_directory))
     gdb_printf (_("Working directory %ps\n (canonically %ps).\n"),
                styled_string (file_name_style.style (),
                               current_directory),
@@ -2193,13 +2193,12 @@ alias_command (const char *args, int from_tty)
 
        if (alias_cmd != nullptr
            && alias_cmd->prefix == prefix_cmd
-           && strcmp (alias_name, alias_cmd->name) == 0)
+           && streq (alias_name, alias_cmd->name))
          error (_("Alias already exists: %s"), alias);
 
        /* Check ALIAS differs from the found CMD.  */
 
-       if (cmd->prefix == prefix_cmd
-           && strcmp (alias_name, cmd->name) == 0)
+       if (cmd->prefix == prefix_cmd && streq (alias_name, cmd->name))
          error (_("Alias %s is the name of an existing command"), alias);
       }
   }
index 285f5f1f0c40583bf89d25f7fb45d54a11f73496..de40faeed591931a3c54e027ddaae4e6724dc36a 100644 (file)
@@ -1528,7 +1528,7 @@ delete_cmd (const char *name, struct cmd_list_element **list,
 
   for (iter = *previous_chain_ptr; iter; iter = *previous_chain_ptr)
     {
-      if (strcmp (iter->name, name) == 0)
+      if (streq (iter->name, name))
        {
          if (iter->destroyer)
            iter->destroyer (iter, iter->context ());
@@ -1638,8 +1638,7 @@ user_documented_alias (const cmd_list_element &alias)
   gdb_assert (alias.is_alias ());
   /* Alias is user documented if it has an allocated documentation
      that differs from the aliased command.  */
-  return (alias.doc_allocated
-         && strcmp (alias.doc, alias.alias_target->doc) != 0);
+  return alias.doc_allocated && !streq (alias.doc, alias.alias_target->doc);
 }
 
 /* Print the definition of alias C using title style for alias
@@ -1838,7 +1837,7 @@ help_cmd (const char *command, struct ui_file *stream)
       return;
     }
 
-  if (strcmp (command, "all") == 0)
+  if (streq (command, "all"))
     {
       help_all (stream);
       return;
@@ -2502,7 +2501,7 @@ lookup_cmd_exact (const char *name,
   const char *tem = name;
   struct cmd_list_element *cmd = lookup_cmd (&tem, list, "", NULL, -1,
                                             ignore_help_classes);
-  if (cmd != nullptr && strcmp (name, cmd->name) != 0)
+  if (cmd != nullptr && !streq (name, cmd->name))
     cmd = nullptr;
   return cmd;
 }
index 3084aa111288b21c513b61624e7b5b8ff4e8694b..59c5827c0939049f5b83ac68263e8a7273e60ffe 100644 (file)
@@ -193,7 +193,7 @@ dump_memory_to_file (const char *cmd, const char *mode, const char *file_format)
   read_memory (lo, buf.data (), count);
 
   /* Have everything.  Open/write the data.  */
-  if (file_format == NULL || strcmp (file_format, "binary") == 0)
+  if (file_format == NULL || streq (file_format, "binary"))
     dump_binary_file (filename.get (), mode, buf.data (), count);
   else
     dump_bfd_file (filename.get (), mode, file_format, lo, buf.data (), count);
@@ -221,7 +221,7 @@ dump_value_to_file (const char *cmd, const char *mode, const char *file_format)
     error (_("Invalid expression."));
 
   /* Have everything.  Open/write the data.  */
-  if (file_format == NULL || strcmp (file_format, "binary") == 0)
+  if (file_format == NULL || streq (file_format, "binary"))
     dump_binary_file (filename.get (), mode, val->contents ().data (),
                      val->type ()->length ());
   else
index 24409d0e0075cd7c04ac5224799d3319bf0acb8e..ded79adaa1411de5a2f2f74990c65ad94377ec18 100644 (file)
@@ -588,12 +588,12 @@ complete_options (completion_tracker &tracker,
          *args = skip_spaces (*args);
          completion_info.word = *args;
 
-         if (strcmp (*args, "-") == 0)
+         if (streq (*args, "-"))
            {
              complete_on_options (options_group, tracker, *args + 1,
                                   completion_info.word);
            }
-         else if (strcmp (*args, "--") == 0)
+         else if (streq (*args, "--"))
            {
              tracker.add_completion (make_unique_xstrdup (*args));
            }
index e403f7e9b5e7ae56db21ff7892ca88d3bc4048e4..253e63af570f1367ace99d258f41a3f0c6c5fd74 100644 (file)
@@ -1662,7 +1662,7 @@ commands_equal (const command_line *a, const command_line *b)
        }
 
       /* Check lines are identical.  */
-      if (a->line != nullptr && strcmp (a->line, b->line) != 0)
+      if (a->line != nullptr && !streq (a->line, b->line))
        return false;
 
       /* Check body_list_0.  */
index ac4fb27e725ba72ec9b758c9d6972da61b5a9bff..272e857c2a5ed56f9327cebea97c69e018120cf6 100644 (file)
@@ -89,13 +89,13 @@ terminal_supports_styling ()
   /* Windows doesn't by default define $TERM, but can support styles
      regardless.  */
 #ifndef _WIN32
-  if (term == nullptr || strcmp (term, "dumb") == 0)
+  if (term == nullptr || streq (term, "dumb"))
     return false;
 #else
   /* But if they do define $TERM, let us behave the same as on Posix
      platforms, for the benefit of programs which invoke GDB as their
      back-end.  */
-  if (term != nullptr && strcmp (term, "dumb") == 0)
+  if (term != nullptr && streq (term, "dumb"))
     return false;
 #endif
 
@@ -438,7 +438,7 @@ emojis_ok ()
     return false;
   if (emoji_styling == AUTO_BOOLEAN_TRUE)
     return true;
-  return strcmp (host_charset (), "UTF-8") == 0;
+  return streq (host_charset (), "UTF-8");
 }
 
 /* See cli-style.h.  */
index 5073a4b0c4b702b90175355485af9764b4a6b667..48963ff8d054d6ef04be13f92d8ac79578e4b578 100644 (file)
@@ -71,17 +71,17 @@ struct read_pe_section_data
 static int
 read_pe_section_index (const char *section_name)
 {
-  if (strcmp (section_name, ".text") == 0)
+  if (streq (section_name, ".text"))
     {
       return PE_SECTION_INDEX_TEXT;
     }
 
-  else if (strcmp (section_name, ".data") == 0)
+  else if (streq (section_name, ".data"))
     {
       return PE_SECTION_INDEX_DATA;
     }
 
-  else if (strcmp (section_name, ".bss") == 0)
+  else if (streq (section_name, ".bss"))
     {
       return PE_SECTION_INDEX_BSS;
     }
@@ -336,15 +336,15 @@ read_pe_exported_syms (minimal_symbol_reader &reader,
   section_data[PE_SECTION_INDEX_BSS].ms_type = mst_bss;
   section_data[PE_SECTION_INDEX_BSS].section_name = ".bss";
 
-  is_pe64 = (strcmp (target, "pe-x86-64") == 0
-            || strcmp (target, "pei-x86-64") == 0
-            || strcmp (target, "pe-aarch64") == 0
-            || strcmp (target, "pei-aarch64") == 0
-            || strcmp (target, "pei-aarch64-little") == 0);
-  is_pe32 = (strcmp (target, "pe-i386") == 0
-            || strcmp (target, "pei-i386") == 0
-            || strcmp (target, "pe-arm-wince-little") == 0
-            || strcmp (target, "pei-arm-wince-little") == 0);
+  is_pe64 = (streq (target, "pe-x86-64")
+            || streq (target, "pei-x86-64")
+            || streq (target, "pe-aarch64")
+            || streq (target, "pei-aarch64")
+            || streq (target, "pei-aarch64-little"));
+  is_pe32 = (streq (target, "pe-i386")
+            || streq (target, "pei-i386")
+            || streq (target, "pe-arm-wince-little")
+            || streq (target, "pei-arm-wince-little"));
 
   /* Possibly print a debug message about DLL not having a valid format.  */
   auto maybe_print_debug_msg = [&] () -> void {
@@ -406,10 +406,10 @@ read_pe_exported_syms (minimal_symbol_reader &reader,
          || bfd_read (sname, sizeof (sname), dll) != sizeof (sname))
        return maybe_print_debug_msg ();
 
-      if ((strcmp (sname, ".edata") == 0)
+      if (streq (sname, ".edata")
          || (vaddr <= export_opthdrrva && export_opthdrrva < vaddr + vsize))
        {
-         if (strcmp (sname, ".edata") != 0)
+         if (!streq (sname, ".edata"))
            {
              if (debug_coff_pe_read)
                gdb_printf (gdb_stdlog, _("Export RVA for dll "
@@ -636,15 +636,15 @@ pe_text_section_offset (struct bfd *abfd)
 
   target = bfd_get_target (abfd);
 
-  is_pe64 = (strcmp (target, "pe-x86-64") == 0
-            || strcmp (target, "pei-x86-64") == 0
-            || strcmp (target, "pe-aarch64") == 0
-            || strcmp (target, "pei-aarch64") == 0
-            || strcmp (target, "pei-aarch64-little") == 0);
-  is_pe32 = (strcmp (target, "pe-i386") == 0
-            || strcmp (target, "pei-i386") == 0
-            || strcmp (target, "pe-arm-wince-little") == 0
-            || strcmp (target, "pei-arm-wince-little") == 0);
+  is_pe64 = (streq (target, "pe-x86-64")
+            || streq (target, "pei-x86-64")
+            || streq (target, "pe-aarch64")
+            || streq (target, "pei-aarch64")
+            || streq (target, "pei-aarch64-little"));
+  is_pe32 = (streq (target, "pe-i386")
+            || streq (target, "pei-i386")
+            || streq (target, "pe-arm-wince-little")
+            || streq (target, "pei-arm-wince-little"));
 
   if (!is_pe32 && !is_pe64)
     {
@@ -677,7 +677,7 @@ pe_text_section_offset (struct bfd *abfd)
          || bfd_read (sname, SCNNMLEN, abfd) != SCNNMLEN)
        return DEFAULT_COFF_PE_TEXT_SECTION_OFFSET;
       sname[SCNNMLEN] = '\0';
-      if (strcmp (sname, ".text") == 0)
+      if (streq (sname, ".text"))
        return vaddr;
     }
 
index bbee2f7cc5603a1d02055c8723e19a9d3362402d..fe48979e4f684b2bab62738d12675c34f20556eb 100644 (file)
@@ -561,7 +561,7 @@ store_regs (struct type *regs_type, CORE_ADDR regs_base)
       struct value *regval;
       CORE_ADDR inferior_addr;
 
-      if (strcmp (reg_name, COMPILE_I_SIMPLE_REGISTER_DUMMY) == 0)
+      if (streq (reg_name, COMPILE_I_SIMPLE_REGISTER_DUMMY))
        continue;
 
       if ((reg_bitpos % 8) != 0 || reg_bitsize != 0)
@@ -694,7 +694,7 @@ compile_object_load (const compile_file_names &file_names,
        continue;
       sym->flags = BSF_GLOBAL;
       sym->section = bfd_abs_section_ptr;
-      if (strcmp (sym->name, "_GLOBAL_OFFSET_TABLE_") == 0)
+      if (streq (sym->name, "_GLOBAL_OFFSET_TABLE_"))
        {
          if (compile_debug)
            gdb_printf (gdb_stdlog,
@@ -707,7 +707,7 @@ compile_object_load (const compile_file_names &file_names,
          sym->value = 0;
          continue;
        }
-      if (strcmp (sym->name, ".TOC.") == 0)
+      if (streq (sym->name, ".TOC."))
        {
          /* Handle the .TOC. symbol as the linker would do.  Set the .TOC.
             sections value to 0x8000 (see bfd/elf64-ppc.c TOC_BASE_OFF);
index 2a9702ee85262b4921a036bf8607f3292847ca4a..a64297bcbe1c4ca596c147b346dd84914df925f5 100644 (file)
@@ -462,7 +462,7 @@ filter_args (char **argv)
   for (destv = argv; *argv != NULL; argv++)
     {
       /* -fpreprocessed may get in commonly from ccache.  */
-      if (strcmp (*argv, "-fpreprocessed") == 0)
+      if (streq (*argv, "-fpreprocessed"))
        {
          xfree (*argv);
          continue;
@@ -767,7 +767,7 @@ compile_register_name_demangle (struct gdbarch *gdbarch,
   regname += 2;
 
   for (regnum = 0; regnum < gdbarch_num_regs (gdbarch); regnum++)
-    if (strcmp (regname, gdbarch_register_name (gdbarch, regnum)) == 0)
+    if (streq (regname, gdbarch_register_name (gdbarch, regnum)))
       return regnum;
 
   error (_("Cannot find gdbarch register \"%s\"."), regname);
index 01c607c3850c52c06c93170175fc2d8eee14722c..8c70a61cdec6c768b7babee605829dc69cbec0db 100644 (file)
@@ -90,7 +90,7 @@ public:
   /* Return true of the name in this hash entry is STR.  */
   bool is_name_eq (const char *str) const
   {
-    return strcmp (m_name.get (), str) == 0;
+    return streq (m_name.get (), str);
   }
 
   /* Return the hash value based on the name of the entry.  */
@@ -2200,7 +2200,7 @@ signal_completer (struct cmd_list_element *ignore,
       signame = gdb_signal_to_name ((enum gdb_signal) signum);
 
       /* Ignore the unknown signal case.  */
-      if (!signame || strcmp (signame, "?") == 0)
+      if (!signame || streq (signame, "?"))
        continue;
 
       if (strncasecmp (signame, word, len) == 0)
index f6e8179d1f4028887dbdae954a3b39f383daba22..79b902118fab28a1ca8d17f88b55d7cf88770fc5 100644 (file)
@@ -1345,13 +1345,13 @@ get_core_registers_cb (const char *sect_name, int supply_size, int collect_size,
   if (!variable_size_section)
     gdb_assert (supply_size == collect_size);
 
-  if (strcmp (sect_name, ".reg") == 0)
+  if (streq (sect_name, ".reg"))
     {
       required = true;
       if (human_name == NULL)
        human_name = "general-purpose";
     }
-  else if (strcmp (sect_name, ".reg2") == 0)
+  else if (streq (sect_name, ".reg2"))
     {
       if (human_name == NULL)
        human_name = "floating-point";
index 4c2429dafc7b8444ad2a0421b0011e85a063bd52..a2189579cb5ee855969d68e3fd4c34e40ff1f2bd 100644 (file)
@@ -284,7 +284,7 @@ set_cp_abi_as_auto_default (const char *short_name)
   /* Since we copy the current ABI into current_cp_abi instead of
      using a pointer, if auto is currently the default, we need to
      reset it.  */
-  if (strcmp (current_cp_abi.shortname, "auto") == 0)
+  if (streq (current_cp_abi.shortname, "auto"))
     switch_to_cp_abi ("auto");
 }
 
@@ -296,7 +296,7 @@ find_cp_abi (const char *short_name)
   int i;
 
   for (i = 0; i < num_cp_abis; i++)
-    if (strcmp (cp_abis[i]->shortname, short_name) == 0)
+    if (streq (cp_abis[i]->shortname, short_name))
       return cp_abis[i];
 
   return NULL;
index fe3c6dce8ca45ef96a4b52b3d11e5574c278efd1..4be50599762eb67f1ce812830e8721c03f502137 100644 (file)
@@ -2092,7 +2092,7 @@ should_be_the_same (const char *one, const char *two)
   if (cptwo != nullptr)
     two = cptwo.get ();
 
-  SELF_CHECK (strcmp (one, two) == 0);
+  SELF_CHECK (streq (one, two));
 }
 
 static void
index efdb2a2c850ac3c9844746ce4369b683f055c865..c8cd5c245aa7af771d48f6c1b717af6cc9764e87 100644 (file)
@@ -431,7 +431,7 @@ cp_lookup_symbol_via_imports (const char *scope,
                            && (len == 0
                                || scope[len] == ':'
                                || scope[len] == '\0'))
-                        : strcmp (scope, current->import_dest) == 0);
+                        : streq (scope, current->import_dest));
 
       /* If the import destination is the current scope or one of its
         ancestors then it is applicable.  */
@@ -447,9 +447,10 @@ cp_lookup_symbol_via_imports (const char *scope,
             with the sought out name.  If there is a match pass
             current->import_src as NAMESPACE to direct the search
             towards the imported namespace.  */
-         if (current->declaration
-             && strcmp (name, current->alias
-                        ? current->alias : current->declaration) == 0)
+         if (current->declaration != nullptr
+             && streq (name, (current->alias != nullptr
+                              ? current->alias
+                              : current->declaration)))
            sym = cp_lookup_symbol_in_namespace (current->import_src,
                                                 current->declaration,
                                                 block, domain, 1);
@@ -467,13 +468,12 @@ cp_lookup_symbol_via_imports (const char *scope,
 
          /* Do not follow CURRENT if NAME matches its EXCLUDES.  */
          for (excludep = current->excludes; *excludep; excludep++)
-           if (strcmp (name, *excludep) == 0)
+           if (streq (name, *excludep))
              break;
          if (*excludep)
            continue;
 
-         if (current->alias != NULL
-             && strcmp (name, current->alias) == 0)
+         if (current->alias != nullptr && streq (name, current->alias))
            /* If the import is creating an alias and the alias matches
               the sought name.  Pass current->import_src as the NAME to
               direct the search towards the aliased namespace.  */
index 5dfb2a785055b7f08f848748fbf9de8d4807e76b..d321986f72dabc515db27367cf1940adc90f15ef 100644 (file)
@@ -110,9 +110,9 @@ cp_already_canonical (const char *string)
   /* These are the only two identifiers which canonicalize to other
      than themselves or an error: unsigned -> unsigned int and
      signed -> int.  */
-  if (string[0] == 'u' && strcmp (&string[1], "nsigned") == 0)
+  if (string[0] == 'u' && streq (&string[1], "nsigned"))
     return 0;
-  else if (string[0] == 's' && strcmp (&string[1], "igned") == 0)
+  else if (string[0] == 's' && streq (&string[1], "igned"))
     return 0;
 
   /* Identifier character [a-zA-Z0-9_].  */
@@ -165,7 +165,7 @@ inspect_type (struct demangle_parse_info *info,
        {
          const char *new_name = (*finder) (otype, data);
 
-         if (new_name != nullptr && strcmp (new_name, name) != 0)
+         if (new_name != nullptr && !streq (new_name, name))
            {
              ret_comp->u.s_name.s = new_name;
              ret_comp->u.s_name.len = strlen (new_name);
@@ -200,8 +200,7 @@ inspect_type (struct demangle_parse_info *info,
 
             If the symbol is typedef and its type name is the same
             as the symbol's name, e.g., "typedef struct foo foo;".  */
-         if (type->name () != nullptr
-             && strcmp (type->name (), name) == 0)
+         if (type->name () != nullptr && streq (type->name (), name))
            return 0;
 
          is_anon = (type->name () == NULL
@@ -617,7 +616,7 @@ cp_canonicalize_string_full (const char *string,
 
       /* Finally, compare the original string with the computed
         name, returning NULL if they are the same.  */
-      if (strcmp (us.get (), string) == 0)
+      if (streq (us.get (), string))
        return nullptr;
 
       return us;
@@ -666,7 +665,7 @@ cp_canonicalize_string (const char *string)
   if (info->added_parens)
     maybe_strip_parens (us.get ());
 
-  if (strcmp (us.get (), string) == 0)
+  if (streq (us.get (), string))
     return nullptr;
 
   return us;
@@ -1239,7 +1238,7 @@ overload_list_add_symbol (struct symbol *sym,
 
   /* skip any symbols that we've already considered.  */
   for (symbol *listed_sym : *overload_list)
-    if (strcmp (sym->linkage_name (), listed_sym->linkage_name ()) == 0)
+    if (streq (sym->linkage_name (), listed_sym->linkage_name ()))
       return;
 
   /* Get the demangled name without parameters */
@@ -1249,7 +1248,7 @@ overload_list_add_symbol (struct symbol *sym,
     return;
 
   /* skip symbols that cannot match */
-  if (strcmp (sym_name.get (), oload_name) != 0)
+  if (!streq (sym_name.get (), oload_name))
     return;
 
   overload_list->push_back (sym);
@@ -1429,7 +1428,7 @@ add_symbol_overload_list_using (const char *func_name,
        if (current->alias != NULL || current->declaration != NULL)
          continue;
 
-       if (strcmp (the_namespace, current->import_dest) == 0)
+       if (streq (the_namespace, current->import_dest))
          {
            /* Mark this import as searched so that the recursive call
               does not search it again.  */
@@ -2206,9 +2205,8 @@ check_remove_params (const char *file, int line,
   gdb::unique_xmalloc_ptr<char> result
     = cp_remove_params_if_any (name, completion_mode);
 
-  if ((expected == NULL) != (result == NULL)
-      || (expected != NULL
-         && strcmp (result.get (), expected) != 0))
+  if ((expected == nullptr) != (result == nullptr)
+      || (expected != nullptr && !streq (result.get (), expected)))
     {
       error (_("%s:%d: make-paramless self-test failed: (completion=%d) "
               "\"%s\" -> %s, expected %s"),
index 54b992b3b21e9473981b32d6a4184f2234a79960..349a0d6bf9e9224899a57c20dc8d833d54689c0a 100644 (file)
@@ -66,7 +66,7 @@ cp_is_vtbl_ptr_type (struct type *type)
 {
   const char *type_name = type->name ();
 
-  return (type_name != NULL && !strcmp (type_name, vtbl_ptr_name));
+  return (type_name != NULL && streq (type_name, vtbl_ptr_name));
 }
 
 /* Return truth value for the assertion that TYPE is of the type
@@ -247,7 +247,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
 
          /* Do not print leading '=' in case of anonymous
             unions.  */
-         if (strcmp (type->field (i).name (), ""))
+         if (!streq (type->field (i).name (), ""))
            gdb_puts (" = ", stream);
          else
            {
index 33b99bb35e62ff4dda0220c7716083f88e1382e2..e86f79a42eaf67f34546caa5514b82d2a2aab6ad 100644 (file)
@@ -2455,14 +2455,11 @@ csky_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int dw_reg)
 static int
 csky_essential_reg_check (const struct csky_supported_tdesc_register *reg)
 {
-  if ((strcmp (reg->name , "pc") == 0)
-      && (reg->num == CSKY_PC_REGNUM))
+  if (streq (reg->name, "pc") && reg->num == CSKY_PC_REGNUM)
     return CSKY_TDESC_REGS_PC_NUMBERED;
-  else if ((strcmp (reg->name , "r14") == 0)
-      && (reg->num == CSKY_SP_REGNUM))
+  else if (streq (reg->name, "r14") && reg->num == CSKY_SP_REGNUM)
     return CSKY_TDESC_REGS_SP_NUMBERED;
-  else if ((strcmp (reg->name , "r15") == 0)
-      && (reg->num == CSKY_LR_REGNUM))
+  else if (streq (reg->name, "r15") && reg->num == CSKY_LR_REGNUM)
     return CSKY_TDESC_REGS_LR_NUMBERED;
   else
     return 0;
@@ -2474,11 +2471,9 @@ static int
 csky_fr0_fr15_reg_check (const struct csky_supported_tdesc_register *reg) {
   int i = 0;
   for (i = 0; i < 16; i++)
-    {
-      if ((strcmp (reg->name, csky_supported_fpu_regs[i].name) == 0)
-         && (csky_supported_fpu_regs[i].num == reg->num))
-       return (1 << i);
-    }
+    if (streq (reg->name, csky_supported_fpu_regs[i].name)
+       && csky_supported_fpu_regs[i].num == reg->num)
+      return 1 << i;
 
   return 0;
 };
@@ -2489,11 +2484,9 @@ static int
 csky_fr16_fr31_reg_check (const struct csky_supported_tdesc_register *reg) {
   int i = 0;
   for (i = 0; i < 16; i++)
-    {
-      if ((strcmp (reg->name, csky_supported_fpu_regs[i + 16].name) == 0)
-         && (csky_supported_fpu_regs[i + 16].num == reg->num))
-       return (1 << i);
-    }
+    if (streq (reg->name, csky_supported_fpu_regs[i + 16].name)
+       && csky_supported_fpu_regs[i + 16].num == reg->num)
+      return (1 << i);
 
   return 0;
 };
@@ -2504,11 +2497,9 @@ static int
 csky_vr0_vr15_reg_check (const struct csky_supported_tdesc_register *reg) {
   int i = 0;
   for (i = 0; i < 16; i++)
-    {
-      if ((strcmp (reg->name, csky_supported_fpu_regs[i + 32].name) == 0)
-         && (csky_supported_fpu_regs[i + 32].num == reg->num))
-       return (1 << i);
-    }
+    if (streq (reg->name, csky_supported_fpu_regs[i + 32].name)
+       && csky_supported_fpu_regs[i + 32].num == reg->num)
+      return (1 << i);
 
   return 0;
 };
index 3de7e8d54efa77bab13255675d1ce965321cce5a..b95cdbed33c96ad6a3a49826c00566d5a4e5927a 100644 (file)
@@ -543,7 +543,7 @@ read_base_type (struct ctf_context *ccp, ctf_id_t tid)
       type = alloc.new_type (TYPE_CODE_ERROR, cet.cte_bits, name);
     }
 
-  if (name != nullptr && strcmp (name, "char") == 0)
+  if (name != nullptr && streq (name, "char"))
     type->set_has_no_signedness (true);
 
   return set_tid_type (ccp, tid, type);
@@ -1139,7 +1139,7 @@ ctf_add_var_cb (const char *name, ctf_id_t id, void *arg)
   if (kind == CTF_K_FUNCTION)
     {
       sym->set_domain (FUNCTION_DOMAIN);
-      if (name != nullptr && strcmp (name, "main") == 0)
+      if (name != nullptr && streq (name, "main"))
        set_objfile_main_name (objfile, name, language_c);
     }
   else
@@ -1233,12 +1233,12 @@ build_ctf_archive_member (ctf_dict_t *dict, const char *name, void *arg)
   auto *iter_data = static_cast<ctf_archive_iter_data *> (arg);
   ctf_per_objfile &per_objfile = iter_data->per_objfile;
 
-  if (strcmp (name, ".ctf") != 0)
+  if (!streq (name, ".ctf"))
     ctf_import (dict, per_objfile.parent_dict.get ());
 
   objfile *objfile = per_objfile.objfile;
 
-  if (strcmp (name, ".ctf") == 0)
+  if (streq (name, ".ctf"))
     {
       name = bfd_get_filename (objfile->obfd.get ());
       ctf_debug_printf ("is parent, using name='%s'", name);
index 575db0c08b7086014b613eb006047d373576b2a0..34b90c0ed938043a53f9a5d2da4dc997904bf9f3 100644 (file)
@@ -378,7 +378,7 @@ d_lookup_symbol_imports (const char *scope, const char *name,
       const char **excludep;
 
       /* If the import destination is the current scope then search it.  */
-      if (!current->searched && strcmp (scope, current->import_dest) == 0)
+      if (!current->searched && streq (scope, current->import_dest))
        {
          /* Mark this import as searched so that the recursive call
             does not search it again.  */
@@ -390,9 +390,10 @@ d_lookup_symbol_imports (const char *scope, const char *name,
             with the sought out name.  If there is a match pass
             current->import_src as MODULE to direct the search towards
             the imported module.  */
-         if (current->declaration
-             && strcmp (name, current->alias
-                        ? current->alias : current->declaration) == 0)
+         if (current->declaration != nullptr
+             && streq (name, (current->alias != nullptr
+                              ? current->alias
+                              : current->declaration)))
            sym = d_lookup_symbol_in_module (current->import_src,
                                             current->declaration,
                                             block, domain, 1);
@@ -409,7 +410,7 @@ d_lookup_symbol_imports (const char *scope, const char *name,
 
          /* Do not follow CURRENT if NAME matches its EXCLUDES.  */
          for (excludep = current->excludes; *excludep; excludep++)
-           if (strcmp (name, *excludep) == 0)
+           if (streq (name, *excludep))
              break;
          if (*excludep)
            continue;
@@ -417,7 +418,7 @@ d_lookup_symbol_imports (const char *scope, const char *name,
          /* If the import statement is creating an alias.  */
          if (current->alias != NULL)
            {
-             if (strcmp (name, current->alias) == 0)
+             if (streq (name, current->alias))
                {
                  /* If the alias matches the sought name.  Pass
                     current->import_src as the NAME to direct the
index a3dd80a10ec02c47196d18f4a7e3303d9af6d0a1..6e5757192da718a678dc6f62b1536cfa2884a4e2 100644 (file)
@@ -35,8 +35,8 @@ dynamic_array_type (struct type *type,
 {
   if (type->num_fields () == 2
       && type->field (0).type ()->code () == TYPE_CODE_INT
-      && strcmp (type->field (0).name (), "length") == 0
-      && strcmp (type->field (1).name (), "ptr") == 0
+      && streq (type->field (0).name (), "length")
+      && streq (type->field (1).name (), "ptr")
       && !val->bits_any_optimized_out (TARGET_CHAR_BIT * embedded_offset,
                                       TARGET_CHAR_BIT * type->length ()))
     {
index d274c4a4fcc4c5c24a0aaca91bee9ebc56f205eb..d1befa7d8c36cca9f2038222463db866827caa60 100644 (file)
@@ -123,7 +123,7 @@ get_task_from_args (const char *args)
 
       return priv->task;
     }
-  if (strcmp (args, "gdb") == 0)
+  if (streq (args, "gdb"))
     return mach_task_self ();
   task = strtoul (args, &eptr, 0);
   if (*eptr)
@@ -799,7 +799,7 @@ info_mach_exceptions_command (const char *args, int from_tty)
 
   if (args != NULL)
     {
-      if (strcmp (args, "saved") == 0)
+      if (streq (args, "saved"))
        {
          if (inferior_ptid == null_ptid)
            gdb_printf (_("No inferior running\n"));
@@ -809,7 +809,7 @@ info_mach_exceptions_command (const char *args, int from_tty)
          disp_exception (&priv->exception_info);
          return;
        }
-      else if (strcmp (args, "host") == 0)
+      else if (streq (args, "host"))
        {
          /* FIXME: This needs a privileged host port!  */
          kret = host_get_exception_ports
index f6a071184d66b7e2912c52f170f5ced1750de797..805889174d137a74e50ed9e5254f5cb01ee35699 100644 (file)
@@ -80,7 +80,7 @@ dicos_load_module_p (bfd *abfd, int header_size)
     {
       if (sym->name != NULL
          && symname[0] == sym->name[0]
-         && strcmp (symname + 1, sym->name + 1) == 0)
+         && streq (symname + 1, sym->name + 1))
        {
          ret = 1;
          break;
index e3ff053504ee4ab42b5b1731d161b675134cbfc4..4c3d8782368068cd31d9dfb801e6ac2d74354c33 100644 (file)
@@ -791,7 +791,7 @@ language_defn::search_name_hash (const char *string0) const
             ignore the "TKB" suffix because searches for this task body
             subprogram are going to be performed using `pck__t' (the encoded
             version of the natural name `pck.t').  */
-         if (strcmp (string, "TKB") == 0)
+         if (streq (string, "TKB"))
            return hash;
          break;
        }
index 17f281138b2c1673040e4f0c0a6242ef7817931d..81c466c188afe30d75e8716aa25db01210f192b3 100644 (file)
@@ -1311,7 +1311,7 @@ set_disassembler_options (const char *prospective_options)
            if (valid_options->arg[i]->values == NULL)
              break;
            for (j = 0; valid_options->arg[i]->values[j] != NULL; j++)
-             if (strcmp (arg, valid_options->arg[i]->values[j]) == 0)
+             if (streq (arg, valid_options->arg[i]->values[j]))
                {
                  found = true;
                  break;
@@ -1319,7 +1319,7 @@ set_disassembler_options (const char *prospective_options)
            if (found)
              break;
          }
-       else if (strcmp (opt, valid_options->name[i]) == 0)
+       else if (streq (opt, valid_options->name[i]))
          break;
       if (valid_options->name[i] == NULL)
        {
index b42afea5a173be48b13dd1fde0c47c5169c558c9..e69e6f754b4bce6566f784ed91f33c536348980d 100644 (file)
@@ -846,7 +846,7 @@ dtrace_static_probe_ops::get_probes
         that sh_type == SHT_SUNW_dof.  Therefore, in addition to the sh_type
         check, we need to check for sections named .sframe.  */
       if (elf_section_data (sect)->this_hdr.sh_type == SHT_SUNW_dof
-         && strcmp (bfd_section_name (sect), ".sframe") != 0)
+         && !streq (bfd_section_name (sect), ".sframe"))
        {
          bfd_byte *dof;
 
index 938ee8f29694c0b941de66517911fd23a5867fc5..91dc9ab8945555ae970b46e873359dc9557dfb48 100644 (file)
@@ -104,7 +104,7 @@ cooked_index_shard::add (sect_offset die_offset, enum dwarf_tag tag,
           && parent_entry.resolved == nullptr
           && m_main == nullptr
           && language_may_use_plain_main (lang)
-          && strcmp (name, "main") == 0)
+          && streq (name, "main"))
     m_main = result;
 
   return result;
index 9e84e5e65faf1c462c111727ea815e0a80b05f17..167e39ffc89ae70510b60be06915264c8803a5cc 100644 (file)
@@ -197,7 +197,7 @@ cooked_index::get_main () const
                 exception.  */
              if ((entry->lang != language_ada
                   && entry->lang != language_cplus)
-                 || strcmp (entry->name, "main") == 0)
+                 || streq (entry->name, "main"))
                {
                  /* There won't be one better than this.  */
                  return entry;
index 1848b92e2cab927c49363954df5c463c308d1e90..302b4a6d6a0bef323f233d203a58ff795b11cc8a 100644 (file)
@@ -554,7 +554,7 @@ cooked_indexer::index_dies (cutu_reader *reader,
 
       if (abbrev->tag == DW_TAG_namespace
          && m_language == language_cplus
-         && strcmp (name, "::") == 0)
+         && streq (name, "::"))
        {
          /* GCC 4.0 and 4.1 had a bug (PR c++/28460) where they
             generated bogus DW_TAG_namespace DIEs with a name of "::"
index 7dca05b3a810e196bd1c1c3fd0c489ea2e1014ac..c3bfd15f14a1e467a651355ba170afe66c3a4549 100644 (file)
@@ -178,7 +178,7 @@ dwarf2_cu::get_builder ()
 void
 dwarf2_cu::set_producer (const char *producer)
 {
-  gdb_assert (m_producer == nullptr || strcmp (producer, m_producer) == 0);
+  gdb_assert (m_producer == nullptr || streq (producer, m_producer));
   m_producer = producer;
 
   int major, minor;
index c4e75898f4c0b1de51f1e6618d192851e1946c3b..f40e9636a0b2dcb7e9f5429b586d31214040e5a4 100644 (file)
@@ -284,8 +284,7 @@ mapped_symtab::find_slot (const char *name)
 
   for (;;)
     {
-      if (m_data[index].name == NULL
-         || strcmp (name, m_data[index].name) == 0)
+      if (m_data[index].name == nullptr || streq (name, m_data[index].name))
        return m_data[index];
       index = (index + step) & (m_data.size () - 1);
     }
@@ -443,7 +442,7 @@ public:
 
   bool operator== (const c_str_view &other) const
   {
-    return strcmp (m_cstr, other.m_cstr) == 0;
+    return streq (m_cstr, other.m_cstr);
   }
 
   bool operator< (const c_str_view &other) const
index ddbac684675fd9626973634e9c2b2faa48eb26bc..48d1200270be698e645cffe6911b2f08878faa71 100644 (file)
@@ -315,7 +315,7 @@ mapped_gdb_index::build_name_components (dwarf2_per_objfile *per_objfile)
            flags |= IS_STATIC;
          if (main_name != nullptr
              && tag == DW_TAG_subprogram
-             && strcmp (name, main_name) == 0)
+             && streq (name, main_name))
            {
              flags |= IS_MAIN;
              this_lang = main_lang;
index e41f06890d741ecbefdb88a82b602218ecdbe8b0..29c601ef2c328298e4c52c37ca6787bed68fb341 100644 (file)
@@ -433,7 +433,7 @@ dwo_file_eq::operator() (const dwo_file_search &search,
   if (search.comp_dir == nullptr || dwo_file->comp_dir == nullptr)
     return search.comp_dir == dwo_file->comp_dir;
 
-  return std::strcmp (search.comp_dir, dwo_file->comp_dir) == 0;
+  return streq (search.comp_dir, dwo_file->comp_dir);
 }
 
 /* See dwarf2/read.h.  */
@@ -4114,7 +4114,7 @@ fixup_go_packaging (struct dwarf2_cu *cu)
          {
            objfile *objfile = cu->per_objfile->objfile;
 
-           if (strcmp (package_name.get (), this_package_name.get ()) != 0)
+           if (!streq (package_name.get (), this_package_name.get ()))
              complaint (_("Symtab %s has objects from two different Go "
                           "packages: %s and %s"),
                         (sym->symtab () != NULL
@@ -4361,8 +4361,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
              /* Could be data-less variant, so keep going.  */
              disr_type = nullptr;
            }
-         else if (strcmp (disr_type->field (0).name (),
-                          "RUST$ENUM$DISR") != 0)
+         else if (!streq (disr_type->field (0).name (), "RUST$ENUM$DISR"))
            {
              /* Not a Rust enum.  */
              return;
@@ -5418,7 +5417,7 @@ dwarf2_physname (const char *name, struct die_info *die, struct dwarf2_cu *cu)
     {
       const char *physname = dwarf2_compute_name (name, die, cu, 1);
 
-      if (canon != NULL && strcmp (physname, canon) != 0)
+      if (canon != NULL && !streq (physname, canon))
        {
          /* It may not mean a bug in GDB.  The compiler could also
             compute DW_AT_linkage_name incorrectly.  But in such case
@@ -7219,8 +7218,8 @@ open_and_init_dwp_file (dwarf2_per_objfile *per_objfile)
   dwp_name += ".dwp";
 
   gdb_bfd_ref_ptr dbfd (open_dwp_file (per_bfd, dwp_name.c_str ()));
-  if (dbfd == NULL
-      && strcmp (objfile->original_name, objfile_name (objfile)) != 0)
+  if (dbfd == nullptr
+      && !streq (objfile->original_name, objfile_name (objfile)))
     {
       /* Try to find .dwp for the binary file after gdb_realpath resolving.  */
       dwp_name = objfile_name (objfile);
@@ -9947,7 +9946,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
   /* Look up member function name in fieldlist.  */
   for (i = 0; i < fip->fnfieldlists.size (); i++)
     {
-      if (strcmp (fip->fnfieldlists[i].name, fieldname) == 0)
+      if (streq (fip->fnfieldlists[i].name, fieldname))
        {
          flp = &fip->fnfieldlists[i];
          break;
@@ -10183,9 +10182,9 @@ quirk_gcc_member_function_pointer (struct type *type, struct objfile *objfile)
 
   /* Check for __pfn and __delta members.  */
   if (type->field (0).name () == NULL
-      || strcmp (type->field (0).name (), "__pfn") != 0
+      || !streq (type->field (0).name (), "__pfn")
       || type->field (1).name () == NULL
-      || strcmp (type->field (1).name (), "__delta") != 0)
+      || !streq (type->field (1).name (), "__delta"))
     return;
 
   /* Find the type of the method.  */
@@ -10271,9 +10270,9 @@ quirk_ada_thick_pointer_struct (struct die_info *die, struct dwarf2_cu *cu,
 
   /* Check for P_ARRAY and P_BOUNDS members.  */
   if (type->field (0).name () == NULL
-      || strcmp (type->field (0).name (), "P_ARRAY") != 0
+      || !streq (type->field (0).name (), "P_ARRAY")
       || type->field (1).name () == NULL
-      || strcmp (type->field (1).name (), "P_BOUNDS") != 0)
+      || !streq (type->field (1).name (), "P_BOUNDS"))
     return;
 
   /* Make sure we're looking at a pointer to an array.  */
@@ -10843,7 +10842,7 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
                   i >= TYPE_N_BASECLASSES (type);
                   --i)
                {
-                 if (strcmp (type->field (i).name (), "__vfp") == 0)
+                 if (streq (type->field (i).name (), "__vfp"))
                    {
                      set_type_vptr_fieldno (type, i);
                      set_type_vptr_basetype (type, type);
@@ -12653,7 +12652,7 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
                      if (follow_die_ref (die, attr, &arg_cu) == child_die)
                        is_this = 1;
                    }
-                 else if (name && strcmp (name, "this") == 0)
+                 else if (name && streq (name, "this"))
                    /* Function definitions will have the argument names.  */
                    is_this = 1;
                  else if (name == NULL && iparams == 0)
@@ -13038,7 +13037,7 @@ dwarf2_init_integer_type (struct dwarf2_cu *cu, int bits, int unsigned_p,
      at least versions 14, 17, and 18.  */
   type_allocator alloc (objfile, cu->lang ());
   if (bits == 0 && cu->producer_is_icc () && name != nullptr
-      && strcmp (name, "void") == 0)
+      && streq (name, "void"))
     type = alloc.copy_type (builtin_type (objfile)->builtin_void);
   else
     type = init_integer_type (alloc, bits, unsigned_p, name);
@@ -13329,7 +13328,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
 
   if (type->code () == TYPE_CODE_INT
       && name != nullptr
-      && strcmp (name, "char") == 0)
+      && streq (name, "char"))
     type->set_has_no_signedness (true);
 
   maybe_set_alignment (cu, die, type);
@@ -16375,7 +16374,7 @@ guess_full_die_structure_name (struct die_info *die, struct dwarf2_cu *cu)
                  const char *die_name = dwarf2_name (die, cu);
 
                  if (die_name != NULL
-                     && strcmp (die_name, actual_name.get ()) != 0)
+                     && !streq (die_name, actual_name.get ()))
                    {
                      /* Strip off the class name from the full name.
                         We want the prefix.  */
@@ -16554,7 +16553,7 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu)
           DW_TAG_namespace DIEs with a name of "::" for the global namespace.
           Work around this problem here.  */
        if (cu->lang () == language_cplus
-           && strcmp (parent_type->name (), "::") == 0)
+           && streq (parent_type->name (), "::"))
          return "";
        /* We give a name to even anonymous namespaces.  */
        return parent_type->name ();
@@ -16638,7 +16637,7 @@ typename_concat (const char *prefix, const char *suffix, int physname,
     {
       /* For D, the 'main' function could be defined in any module, but it
         should never be prefixed.  */
-      if (strcmp (suffix, "D main") == 0)
+      if (streq (suffix, "D main"))
        {
          prefix = "";
          sep = "";
@@ -18179,7 +18178,7 @@ cutu_reader::prepare_one_comp_unit (struct dwarf2_cu *cu,
   if (attr != nullptr
       && cu->producer_is_gcc ()
       && attr->as_string () != nullptr
-      && strcmp (attr->as_string (), "<artificial>") == 0)
+      && streq (attr->as_string (), "<artificial>"))
     cu->per_cu->lto_artificial = true;
 
   switch (m_top_level_die->tag)
index 54e29c2a106a547b58b58c236a168daf8ff0c023..a2c007f7e69052c80b0a9ab216a6f6c9042d3986 100644 (file)
@@ -35,8 +35,8 @@ struct dwarf2_section_names {
   /* Return true if NAME matches either of this section's names.  */
   bool matches (const char *name) const
   {
-    return ((normal != nullptr && strcmp (name, normal) == 0)
-           || (compressed != nullptr && strcmp (name, compressed) == 0));
+    return ((normal != nullptr && streq (name, normal))
+           || (compressed != nullptr && streq (name, compressed)));
   }
 };
 
index 8924bb6ba2455f2f0d17878b31f4c4ca3d348fc7..7e2f4fe8f3f60923664a049a75c07e690841a053 100644 (file)
@@ -191,15 +191,15 @@ elf_symfile_segments (bfd *abfd)
 static void
 elf_locate_sections (asection *sectp, struct elfinfo *ei)
 {
-  if (strcmp (sectp->name, ".stab") == 0)
+  if (streq (sectp->name, ".stab"))
     {
       ei->stabsect = sectp;
     }
-  else if (strcmp (sectp->name, ".mdebug") == 0)
+  else if (streq (sectp->name, ".mdebug"))
     {
       ei->mdebugsect = sectp;
     }
-  else if (strcmp (sectp->name, ".ctf") == 0)
+  else if (streq (sectp->name, ".ctf"))
     {
       ei->ctfsect = sectp;
     }
@@ -508,7 +508,7 @@ elf_symtab_read (minimal_symbol_reader &reader,
            {
              const char *atsign = strchr (sym->name, '@');
              bool is_at_symbol = atsign != nullptr && atsign > sym->name;
-             bool is_plt = is_at_symbol && strcmp (atsign, "@plt") == 0;
+             bool is_plt = is_at_symbol && streq (atsign, "@plt");
              int len = is_at_symbol ? atsign - sym->name : 0;
 
              if (is_at_symbol
@@ -708,14 +708,14 @@ elf_gnu_ifunc_record_cache (const char *name, CORE_ADDR addr)
   /* Note we check the symbol's name instead of checking whether the
      symbol is in the .plt section because some systems have @plt
      symbols in the .text section.  */
-  if (len > 4 && strcmp (target_name + len - 4, "@plt") == 0)
+  if (len > 4 && streq (target_name + len - 4, "@plt"))
     {
       gnu_ifunc_debug_printf ("target \"%s\" is a PLT stub, not caching",
                              target_name);
       return 0;
     }
 
-  if (strcmp (target_name, "_PROCEDURE_LINKAGE_TABLE_") == 0)
+  if (streq (target_name, "_PROCEDURE_LINKAGE_TABLE_"))
     {
       gnu_ifunc_debug_printf ("target is _PROCEDURE_LINKAGE_TABLE_, "
                              "not caching");
index c13f3cb170d3fc9555dddc723ca7f26f6e24a779..c47ac2614c5ee14a9da8d7332d185e84e1bea0e7 100644 (file)
@@ -1015,7 +1015,7 @@ add_struct_fields (struct type *type, completion_list &output,
              computed_type_name = 1;
            }
          /* Omit constructors from the completion list.  */
-         if (!type_name || strcmp (type_name, name))
+         if (!type_name || !streq (type_name, name))
            output.emplace_back (concat (prefix, name, nullptr));
        }
     }
index d27ce02e61cbd217d8eae1966ff0260d9cc2d32e..48dfb34c47fe28f721a15fdf8127a65159b88495 100644 (file)
@@ -821,7 +821,7 @@ command_line_handler (gdb::unique_xmalloc_ptr<char> &&rl)
         Which we will get with a newer readline, but this really is the
         best we can do with older versions of readline.  */
       const char *value = rl_variable_value ("enable-bracketed-paste");
-      if (value != nullptr && strcmp (value, "on") == 0
+      if (value != nullptr && streq (value, "on")
          && ((rl_readline_version >> 8) & 0xff) > 0x07)
        printf_unfiltered ("\n");
       printf_unfiltered ("quit\n");
index 94051ddab2324fcfcd82ae50b8dc179cc1c0cb9b..5d297bfee563a2747a092620ed24e28c690a94ca 100644 (file)
@@ -114,7 +114,7 @@ set_exec_file_mismatch_command (const char *ignore,
        ;
        mode = static_cast<enum exec_file_mismatch_mode>(1 + (int) mode))
     {
-      if (strcmp (exec_file_mismatch, exec_file_mismatch_names[mode]) == 0)
+      if (streq (exec_file_mismatch, exec_file_mismatch_names[mode]))
        {
          exec_file_mismatch_mode = mode;
          return;
@@ -512,8 +512,8 @@ exec_file_attach (const char *filename, int from_tty)
   bfd *curr_bfd = current_program_space->exec_bfd ();
   bool reload_p = (((prev_bfd != nullptr) == (curr_bfd != nullptr))
                   && (prev_bfd == nullptr
-                      || (strcmp (bfd_get_filename (prev_bfd),
-                                  bfd_get_filename (curr_bfd)) == 0)));
+                      || (streq (bfd_get_filename (prev_bfd),
+                                 bfd_get_filename (curr_bfd)))));
 
   gdb::observers::executable_changed.notify (current_program_space, reload_p);
 }
index 2560ff91e893905421f793e7b8eb7e7e01cabc43..d8ef8123ab597a40a4ba23dda405ee0b0108b4b0 100644 (file)
@@ -123,7 +123,7 @@ has_extension (const char *file, const char *extension)
   int extension_len = strlen (extension);
 
   return (file_len > extension_len
-         && strcmp (&file[file_len - extension_len], extension) == 0);
+         && streq (&file[file_len - extension_len], extension));
 }
 
 /* Return the extension language of FILE, or NULL if
index f9309066936132e71608b38fe93d78d09f102c32..123d9995c39c1354520cdd75e1e6146a32749c5d 100644 (file)
@@ -378,7 +378,7 @@ f_language::f_type_print_base (struct type *type, struct ui_file *stream,
         through as TYPE_CODE_INT since dbxstclass.h is so
         C-oriented, we must change these to "character" from "char".  */
 
-      if (strcmp (type->name (), "char") == 0)
+      if (streq (type->name (), "char"))
        gdb_printf (stream, "%*scharacter", level, "");
       else
        goto default_case;
index c66e90c04029104a1911e100e272a046f5383b8f..13921c03a48de5b2edf4bc3da9947db7b23122fb 100644 (file)
@@ -634,8 +634,9 @@ info_common_command_for_block (const struct block *block, const char *comname,
 
        gdb_assert (sym->loc_class () == LOC_COMMON_BLOCK);
 
-       if (comname && (!sym->linkage_name ()
-                       || strcmp (comname, sym->linkage_name ()) != 0))
+       if (comname != nullptr
+           && (sym->linkage_name () == nullptr
+               || !streq (comname, sym->linkage_name ())))
          continue;
 
        if (*any_printed)
index 80116553d9be082dd9c7ee60285e6c0adc97e0c5..dc486139861a8565a010e1ab1d9b91977eb7e684 100644 (file)
@@ -897,7 +897,7 @@ fbsd_nat_target::thread_name (struct thread_info *thr)
     return nullptr;
   if (ptrace (PT_LWPINFO, lwp, (caddr_t) &pl, sizeof pl) == -1)
     return nullptr;
-  if (strcmp (kp.ki_comm, pl.pl_tdname) == 0)
+  if (streq (kp.ki_comm, pl.pl_tdname))
     return NULL;
   xsnprintf (buf, sizeof buf, "%s", pl.pl_tdname);
   return buf;
index e3c78aaff5ddb10aeaec03a8ed21568037db907a..4bbe0c120e6a22a370a9a8f7e38562d2c4f24d07 100644 (file)
@@ -573,7 +573,7 @@ fbsd_core_thread_name (struct gdbarch *gdbarch, bfd &cbfd,
                 as its thread name instead of an empty name if a name
                 has not been set explicitly.  Return a NULL name in
                 that case.  */
-             if (strcmp (buf, elf_tdata (&cbfd)->core->program) != 0)
+             if (!streq (buf, elf_tdata (&cbfd)->core->program))
                return buf;
            }
        }
index 746d7d06ec1f04cd95a92153c98f1b532f17190d..70621cf6e206ec9369cbcbbfc8c9fa3b09927e2e 100644 (file)
@@ -2439,7 +2439,7 @@ get_prev_frame_always_1 (const frame_info_ptr &this_frame)
       morestack_msym = lookup_minimal_symbol_by_pc (this_pc_in_block).minsym;
       if (morestack_msym)
        morestack_name = morestack_msym->linkage_name ();
-      if (!morestack_name || strcmp (morestack_name, "__morestack") != 0)
+      if (!morestack_name || !streq (morestack_name, "__morestack"))
        {
          frame_debug_printf ("  -> nullptr // this frame ID is inner");
          this_frame->stop_reason = UNWIND_INNER_ID;
index 94d3db68ae9c2b606fe225cc3bda9945d2c54cbf..33a270497f3cc0de4dc78fd7cb484d35e63ef05d 100644 (file)
@@ -1071,9 +1071,9 @@ frv_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
       call_dest = pc + 4 * displ;
       bound_minimal_symbol s = lookup_minimal_symbol_by_pc (call_dest);
 
-      if (s.minsym != NULL
-         && s.minsym->linkage_name () != NULL
-         && strcmp (s.minsym->linkage_name (), "__main") == 0)
+      if (s.minsym != nullptr
+         && s.minsym->linkage_name () != nullptr
+         && streq (s.minsym->linkage_name (), "__main"))
        {
          pc += 4;
          return pc;
index 5a1f3315c7f2ca6dcf78f70296cf0ac4b96a1c5b..ba0a0882a0ad7915ab75ef0da86e3277c79b4e47 100644 (file)
@@ -377,7 +377,7 @@ ft32_address_class_name_to_type_flags (struct gdbarch *gdbarch,
                                       const char* name,
                                       type_instance_flags *type_flags_ptr)
 {
-  if (strcmp (name, "flash") == 0)
+  if (streq (name, "flash"))
     {
       *type_flags_ptr = TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1;
       return true;
index 2157fea18dc39ea1ee9c839b721f020db2b5aa03..f7c9003a0df8c9757c3882216c5fafb393cd6b8a 100644 (file)
@@ -85,7 +85,7 @@ gcore_elf_collect_regset_section_cb (const char *sect_name,
                          collect_size);
 
   /* PRSTATUS still needs to be treated specially.  */
-  if (strcmp (sect_name, ".reg") == 0)
+  if (streq (sect_name, ".reg"))
     data->note_data->reset (elfcore_write_prstatus
                            (data->obfd, data->note_data->release (),
                             data->note_size, data->lwp,
index 2bf300c0d29f1133c50f15fce1c63f19de953dbb..98883a0fd4c19009f3310a5434248f09c19eacf3 100644 (file)
@@ -336,7 +336,7 @@ derive_heap_segment (bfd *abfd, bfd_vma *bottom, bfd_vma *top)
   for (sec = abfd->sections; sec; sec = sec->next)
     {
       if (bfd_section_flags (sec) & SEC_DATA
-         || strcmp (".bss", bfd_section_name (sec)) == 0)
+         || streq (".bss", bfd_section_name (sec)))
        {
          sec_vaddr = bfd_section_vma (sec);
          sec_size = bfd_section_size (sec);
index 1f1d672a83794b078040ef82721c20dccfc8df85..d02b80ab621df26759fd70e5adaf688bf99603d2 100644 (file)
@@ -118,8 +118,7 @@ set_demangling_command (const char *ignore,
        dem->demangling_style != unknown_demangling;
        dem++)
     {
-      if (strcmp (current_demangling_style_string,
-                 dem->demangling_style_name) == 0)
+      if (streq (current_demangling_style_string, dem->demangling_style_name))
        {
          current_demangling_style = dem->demangling_style;
          current_demangling_style_string = demangling_style_names[i];
@@ -227,7 +226,7 @@ INIT_GDB_FILE (gdb_demangle)
        = xstrdup (libiberty_demanglers[i].demangling_style_name);
 
       if (current_demangling_style_string == NULL
-         && strcmp (DEFAULT_DEMANGLING_STYLE, demangling_style_names[i]) == 0)
+         && streq (DEFAULT_DEMANGLING_STYLE, demangling_style_names[i]))
        current_demangling_style_string = demangling_style_names[i];
     }
 
index bada133da80177773aac754cd36976313ca7e9aa..342957273cd7b7e78aeb88d926bb603b1b707e6c 100644 (file)
@@ -230,7 +230,7 @@ struct bfd_cache_eq
            && gdata->size == s.size
            && gdata->inode == s.inode
            && gdata->device_id == s.device_id
-           && strcmp (bfd_get_filename (abfd), s.filename) == 0);
+           && streq (bfd_get_filename (abfd), s.filename));
   }
 };
 
index 5e07e290f67ed4804bb802c9d89fb2436d624d22..0ad06f56c30d3830ddbc12097a64f1889101f89d 100644 (file)
@@ -545,9 +545,9 @@ address_space_name_to_type_instance_flags (struct gdbarch *gdbarch,
   type_instance_flags type_flags;
 
   /* Check for known address space delimiters.  */
-  if (!strcmp (space_identifier, "code"))
+  if (streq (space_identifier, "code"))
     return TYPE_INSTANCE_FLAG_CODE_SPACE;
-  else if (!strcmp (space_identifier, "data"))
+  else if (streq (space_identifier, "data"))
     return TYPE_INSTANCE_FLAG_DATA_SPACE;
   else if (gdbarch_address_class_name_to_type_flags_p (gdbarch)
           && gdbarch_address_class_name_to_type_flags (gdbarch,
@@ -3616,8 +3616,9 @@ int
 class_types_same_p (const struct type *a, const struct type *b)
 {
   return (TYPE_MAIN_TYPE (a) == TYPE_MAIN_TYPE (b)
-         || (a->name () && b->name ()
-             && !strcmp (a->name (), b->name ())));
+         || (a->name () != nullptr
+             && b->name () != nullptr
+             && streq (a->name (), b->name ())));
 }
 
 /* If BASE is an ancestor of DCLASS return the distance between them.
@@ -4008,8 +4009,9 @@ types_equal (struct type *a, struct type *b)
      stubs.  The types won't point to the same address, but they
      really are the same.  */
 
-  if (a->name () && b->name ()
-      && strcmp (a->name (), b->name ()) == 0)
+  if (a->name () != nullptr
+      && b->name () != nullptr
+      && streq (a->name (), b->name ()))
     return true;
 
   /* Two function types are equal if their argument and return types
@@ -4070,7 +4072,7 @@ compare_maybe_null_strings (const char *s, const char *t)
 {
   if (s == NULL || t == NULL)
     return s == t;
-  return strcmp (s, t) == 0;
+  return streq (s, t);
 }
 
 /* A helper function for check_types_worklist that checks two types for
index e5706b75b1cdd11638f0222e0cd8c540c0047ef0..123f237b7217abd354f96233d714f8cf7a0c5969 100644 (file)
@@ -2708,9 +2708,9 @@ static int
 _parse_bool_arg (const char *args, const char *t_val, const char *f_val,
                 const char *cmd_prefix)
 {
-  if (!args || strcmp (args, t_val) == 0)
+  if (!args || streq (args, t_val))
     return 1;
-  else if (strcmp (args, f_val) == 0)
+  else if (streq (args, f_val))
     return 0;
   else
     error (_("Illegal argument for \"%s\" command, "
@@ -2925,11 +2925,11 @@ set_sig_thread_cmd (const char *args, int from_tty)
 {
   struct inf *inf = cur_inf ();
 
-  if (!args || (!c_isdigit (*args) && strcmp (args, "none") != 0))
+  if (!args || (!c_isdigit (*args) && !streq (args, "none")))
     error (_("Illegal argument to \"set signal-thread\" command.\n"
             "Should be a thread ID, or \"none\"."));
 
-  if (strcmp (args, "none") == 0)
+  if (streq (args, "none"))
     inf->signal_thread = 0;
   else
     {
index e5dcbd69c0bf302fbbf40c814be0c4db28baeeb1..4e98f7d06fffd096eda3ef2b6e16fe8abc47fda6 100644 (file)
@@ -316,12 +316,9 @@ vb_match (struct type *type, int index, struct type *basetype)
   if (fieldtype->target_type () == basetype)
     return 1;
 
-  if (basetype->name () != NULL
-      && fieldtype->target_type ()->name () != NULL
-      && strcmp (basetype->name (),
-                fieldtype->target_type ()->name ()) == 0)
-    return 1;
-  return 0;
+  return (basetype->name () != nullptr
+         && fieldtype->target_type ()->name () != nullptr
+         && streq (basetype->name (), fieldtype->target_type ()->name ()));
 }
 
 /* Compute the offset of the baseclass which is the INDEXth baseclass
index 60033c8eca7d290b2ff7285511e37a1b7e90f29c..3b388c961fabd455f9bb65b4f3529ffc4d0183a5 100644 (file)
@@ -79,9 +79,9 @@ gccgo_string_p (struct type *type)
       type1 = check_typedef (type1);
 
       if (type0->code () == TYPE_CODE_PTR
-         && strcmp (type->field (0).name (), "__data") == 0
+         && streq (type->field (0).name (), "__data")
          && type1->code () == TYPE_CODE_INT
-         && strcmp (type->field (1).name (), "__length") == 0)
+         && streq (type->field (1).name (), "__length"))
        {
          struct type *target_type = type0->target_type ();
 
@@ -89,7 +89,7 @@ gccgo_string_p (struct type *type)
 
          if (target_type->code () == TYPE_CODE_INT
              && target_type->length () == 1
-             && strcmp (target_type->name (), "uint8") == 0)
+             && streq (target_type->name (), "uint8"))
            return 1;
        }
     }
@@ -103,12 +103,9 @@ gccgo_string_p (struct type *type)
 static int
 sixg_string_p (struct type *type)
 {
-  if (type->num_fields () == 2
-      && type->name () != NULL
-      && strcmp (type->name (), "string") == 0)
-    return 1;
-
-  return 0;
+  return (type->num_fields () == 2
+         && type->name () != nullptr
+         && streq (type->name (), "string"));
 }
 
 /* Classify the kind of Go object that TYPE is.
@@ -201,7 +198,7 @@ unpack_mangled_go_symbol (const char *mangled_name,
   *method_type_is_pointerp = 0;
 
   /* main.init is mangled specially.  */
-  if (strcmp (mangled_name, "__go_init_main") == 0)
+  if (streq (mangled_name, "__go_init_main"))
     {
       gdb::unique_xmalloc_ptr<char> package
        = make_unique_xstrdup ("main");
@@ -212,7 +209,7 @@ unpack_mangled_go_symbol (const char *mangled_name,
     }
 
   /* main.main is mangled specially (missing prefix).  */
-  if (strcmp (mangled_name, "main.main") == 0)
+  if (streq (mangled_name, "main.main"))
     {
       gdb::unique_xmalloc_ptr<char> package
        = make_unique_xstrdup ("main");
index d0d0c6f2a74bb7d958e3de5ed06b675620a8dc1d..b3ea5c1fd5ceba052e7dc00ed96f92c1d82741e6 100644 (file)
@@ -1141,9 +1141,9 @@ go32_sysinfo (const char *arg, int from_tty)
       char cpu_string[80];
       char cpu_brand[20];
       unsigned brand_idx;
-      int intel_p = strcmp (cpuid_vendor, "GenuineIntel") == 0;
-      int amd_p = strcmp (cpuid_vendor, "AuthenticAMD") == 0;
-      int hygon_p = strcmp (cpuid_vendor, "HygonGenuine") == 0;
+      int intel_p = streq (cpuid_vendor, "GenuineIntel");
+      int amd_p = streq (cpuid_vendor, "AuthenticAMD");
+      int hygon_p = streq (cpuid_vendor, "HygonGenuine");
       unsigned cpu_family, cpu_model;
 
 #if 0
index 0c9dd7c967e9b7185dc34a4f7d1d604de674b71f..a13567eaa32bd6ef92feb5ed1f89d96a012cb703 100644 (file)
@@ -119,7 +119,7 @@ lsscm_make_lazy_string_smob (CORE_ADDR address, int length,
 
   ls_smob->address = address;
   ls_smob->length = length;
-  if (encoding == NULL || strcmp (encoding, "") == 0)
+  if (encoding == NULL || streq (encoding, ""))
     ls_smob->encoding = NULL;
   else
     ls_smob->encoding = xstrdup (encoding);
index b31efbf529f21857180548d7b273df84aef9a510..ee74321782821f5d4b78ec8d5c7c677bdc36243b 100644 (file)
@@ -795,7 +795,7 @@ pascm_set_param_value_x (param_smob *p_smob,
          gdbscm_throw (exception);
        for (i = 0; enumeration[i]; ++i)
          {
-           if (strcmp (enumeration[i], str.get ()) == 0)
+           if (streq (enumeration[i], str.get ()))
              break;
          }
        if (enumeration[i] == nullptr)
index c0e984ab0349e24715a74e656884b121b8e35769..c24e246cecc794b4845eb9a365f789148891b323 100644 (file)
@@ -56,7 +56,7 @@ hppabsd_find_global_pointer (struct gdbarch *gdbarch, struct value *function)
     {
       for (struct obj_section &sec : faddr_sec->objfile->sections ())
        {
-         if (strcmp (sec.the_bfd_section->name, ".dynamic") == 0)
+         if (streq (sec.the_bfd_section->name, ".dynamic"))
            {
              CORE_ADDR addr = sec.addr ();
              CORE_ADDR endaddr = sec.endaddr ();
index e99e395787599a1fda678212b8dc57a231b19b49..2141841d1c8062f6b1bb92cd173729ba8b0067db 100644 (file)
@@ -363,7 +363,7 @@ hppa_linux_find_global_pointer (struct gdbarch *gdbarch,
     {
       for (obj_section &osect : faddr_sect->objfile->sections ())
        {
-         if (strcmp (osect.the_bfd_section->name, ".dynamic") == 0)
+         if (streq (osect.the_bfd_section->name, ".dynamic"))
            {
              CORE_ADDR addr, endaddr;
 
index 140e31422582bd0fb247845486c7cf5cb474ec10..a2df05b4d293fc7d6279c7ed391a11bca0f2a7e2 100644 (file)
@@ -369,8 +369,8 @@ read_unwind_info (struct objfile *objfile)
        unwind_sec;
        unwind_sec = unwind_sec->next)
     {
-      if (strcmp (unwind_sec->name, "$UNWIND_START$") == 0
-         || strcmp (unwind_sec->name, ".PARISC.unwind") == 0)
+      if (streq (unwind_sec->name, "$UNWIND_START$")
+         || streq (unwind_sec->name, ".PARISC.unwind"))
        {
          unwind_size = bfd_section_size (unwind_sec);
          unwind_entries = unwind_size / UNWIND_ENTRY_SIZE;
@@ -411,8 +411,8 @@ read_unwind_info (struct objfile *objfile)
        unwind_sec;
        unwind_sec = unwind_sec->next)
     {
-      if (strcmp (unwind_sec->name, "$UNWIND_START$") == 0
-         || strcmp (unwind_sec->name, ".PARISC.unwind") == 0)
+      if (streq (unwind_sec->name, "$UNWIND_START$")
+         || streq (unwind_sec->name, ".PARISC.unwind"))
        {
          unwind_size = bfd_section_size (unwind_sec);
          unwind_entries = unwind_size / UNWIND_ENTRY_SIZE;
@@ -925,7 +925,7 @@ hppa64_convert_code_addr_to_fptr (struct gdbarch *gdbarch, CORE_ADDR code)
 
   for (obj_section &opd : sec->objfile->sections ())
     {
-      if (strcmp (opd.the_bfd_section->name, ".opd") == 0)
+      if (streq (opd.the_bfd_section->name, ".opd"))
        {
          for (CORE_ADDR addr = opd.addr ();
               addr < opd.endaddr ();
index a61a376796a6a5b9649c9f7116c0a247ce4e42e3..e5defef92c5bf789399bd313e962842b752c9092 100644 (file)
@@ -33,8 +33,7 @@ i386_dicos_osabi_sniffer (bfd *abfd)
   const char *target_name = bfd_get_target (abfd);
 
   /* On x86-DICOS, the Load Module's "header" section is 36 bytes.  */
-  if (strcmp (target_name, "elf32-i386") == 0
-      && dicos_load_module_p (abfd, 36))
+  if (streq (target_name, "elf32-i386") && dicos_load_module_p (abfd, 36))
     return GDB_OSABI_DICOS;
 
   return GDB_OSABI_UNKNOWN;
index 5774aaf8dfa2f38e121d72fda21bb8553b031404..c351debff07af968bf7937a82e469a34d30102de 100644 (file)
@@ -84,7 +84,7 @@ i386_gnu_sigtramp_p (const frame_info_ptr &this_frame)
   find_pc_partial_function (pc, &name, NULL, NULL);
 
   /* If we have a NAME, we can check for the trampoline function */
-  if (name != NULL && strcmp (name, "trampoline") == 0)
+  if (name != NULL && streq (name, "trampoline"))
     return 1;
 
   return i386_gnu_sigtramp_start (this_frame) != 0;
index 13c4b51c3f9e607021aeb1c5dc981ae507b0b6b3..7a6294d4133e25e58b26be59d5133c74f9067ae0 100644 (file)
@@ -46,8 +46,8 @@ i386_go32_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 static enum gdb_osabi
 i386_coff_osabi_sniffer (bfd *abfd)
 {
-  if (strcmp (bfd_get_target (abfd), "coff-go32-exe") == 0
-      || strcmp (bfd_get_target (abfd), "coff-go32") == 0)
+  if (streq (bfd_get_target (abfd), "coff-go32-exe")
+      || streq (bfd_get_target (abfd), "coff-go32"))
     return GDB_OSABI_GO32;
 
   return GDB_OSABI_UNKNOWN;
index dae4a7b7eeba89de83068ab3af0618346f88c2f4..23aeccac9fc64e608baa2f1b74e42c03e1821f86 100644 (file)
@@ -246,8 +246,7 @@ i386_linux_sigtramp_p (const frame_info_ptr &this_frame)
     return (i386_linux_sigtramp_start (this_frame) != 0
            || i386_linux_rt_sigtramp_start (this_frame) != 0);
 
-  return (strcmp ("__restore", name) == 0
-         || strcmp ("__restore_rt", name) == 0);
+  return streq ("__restore", name) || streq ("__restore_rt", name);
 }
 
 /* Return true if the PC of THIS_FRAME is in a signal trampoline which
index a361ab1ae6a992243a15cedb99da58358f24a1bd..0fc2fab3ed8419176b76b60ee6a17faf2a0920d6 100644 (file)
@@ -384,10 +384,11 @@ i386obsd_trapframe_sniffer (const struct frame_unwind *self,
     return 0;
 
   find_pc_partial_function (get_frame_pc (this_frame), &name, NULL, NULL);
-  return (name && (strcmp (name, "calltrap") == 0
-                  || strcmp (name, "syscall1") == 0
-                  || startswith (name, "Xintr")
-                  || startswith (name, "Xsoft")));
+  return (name != nullptr
+         && (streq (name, "calltrap")
+             || streq (name, "syscall1")
+             || startswith (name, "Xintr")
+             || startswith (name, "Xsoft")));
 }
 
 static const struct frame_unwind_legacy i386obsd_trapframe_unwind (
index 9cee112facd8cf1c7622863ef0c146d8f97e32fa..b9013e183c2930323c321ac590c4e9ea421c7009 100644 (file)
@@ -1869,9 +1869,9 @@ i386_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
          call_dest = pc + 5 + extract_signed_integer (buf, 4, byte_order);
          call_dest = call_dest & 0xffffffffU;
          bound_minimal_symbol s = lookup_minimal_symbol_by_pc (call_dest);
-         if (s.minsym != NULL
-             && s.minsym->linkage_name () != NULL
-             && strcmp (s.minsym->linkage_name (), "__main") == 0)
+         if (s.minsym != nullptr
+             && s.minsym->linkage_name () != nullptr
+             && streq (s.minsym->linkage_name (), "__main"))
            pc += 5;
        }
     }
@@ -3772,7 +3772,7 @@ i386_sigtramp_p (const frame_info_ptr &this_frame)
   const char *name;
 
   find_pc_partial_function (pc, &name, NULL, NULL);
-  return (name && strcmp ("_sigtramp", name) == 0);
+  return (name && streq ("_sigtramp", name));
 }
 \f
 
@@ -3809,8 +3809,9 @@ i386_svr4_sigtramp_p (const frame_info_ptr &this_frame)
 
   /* The origin of these symbols is currently unknown.  */
   find_pc_partial_function (pc, &name, NULL, NULL);
-  return (name && (strcmp ("_sigreturn", name) == 0
-                  || strcmp ("sigvechandler", name) == 0));
+  return (name != nullptr
+         && (streq ("_sigreturn", name)
+             || streq ("sigvechandler", name)));
 }
 
 /* Assuming THIS_FRAME is for a SVR4 sigtramp routine, return the
@@ -8450,19 +8451,19 @@ static const struct floatformat **
 i386_floatformat_for_type (struct gdbarch *gdbarch,
                           const char *name, int len)
 {
-  if (len == 128 && name)
-    if (strcmp (name, "__float128") == 0
-       || strcmp (name, "_Float128") == 0
-       || strcmp (name, "complex _Float128") == 0
-       || strcmp (name, "complex(kind=16)") == 0
-       || strcmp (name, "COMPLEX(16)") == 0
-       || strcmp (name, "complex*32") == 0
-       || strcmp (name, "COMPLEX*32") == 0
-       || strcmp (name, "quad complex") == 0
-       || strcmp (name, "real(kind=16)") == 0
-       || strcmp (name, "real*16") == 0
-       || strcmp (name, "REAL*16") == 0
-       || strcmp (name, "REAL(16)") == 0)
+  if (len == 128 && name != nullptr)
+    if (streq (name, "__float128")
+       || streq (name, "_Float128")
+       || streq (name, "complex _Float128")
+       || streq (name, "complex(kind=16)")
+       || streq (name, "COMPLEX(16)")
+       || streq (name, "complex*32")
+       || streq (name, "COMPLEX*32")
+       || streq (name, "quad complex")
+       || streq (name, "real(kind=16)")
+       || streq (name, "real*16")
+       || streq (name, "REAL*16")
+       || streq (name, "REAL(16)"))
       return floatformats_ieee_quad;
 
   return default_floatformat_for_type (gdbarch, name, len);
index daaa556d171bc12b44ef997dd4d739484f3a4581..b66483c4b960718e1fd1c4f2904b3b3b47704a3d 100644 (file)
@@ -210,7 +210,7 @@ i386_cygwin_core_osabi_sniffer (bfd *abfd)
 
   /* Cygwin uses elf core dumps.  Do not claim all ELF executables,
      check whether there is a .reg section of proper size.  */
-  if (strcmp (target_name, "elf32-i386") == 0)
+  if (streq (target_name, "elf32-i386"))
     {
       asection *section = bfd_get_section_by_name (abfd, ".reg");
       if (section != nullptr
index 2b918b87bbc5551ebaa575ba46eed4d24c8e1b88..43f2f4e10bcaae742e2e5dd0ee69025cfd4ed951 100644 (file)
@@ -3433,7 +3433,7 @@ ia64_find_global_pointer_from_dynamic_section (struct gdbarch *gdbarch,
     {
       for (obj_section &osect : faddr_sect->objfile->sections ())
        {
-         if (strcmp (osect.the_bfd_section->name, ".dynamic") == 0)
+         if (streq (osect.the_bfd_section->name, ".dynamic"))
            {
              CORE_ADDR addr = osect.addr ();
              CORE_ADDR endaddr = osect.endaddr ();
@@ -3507,14 +3507,14 @@ find_extant_func_descr (struct gdbarch *gdbarch, CORE_ADDR faddr)
 
   /* Return early if faddr is already a function descriptor.  */
   faddr_sect = find_pc_section (faddr);
-  if (faddr_sect && strcmp (faddr_sect->the_bfd_section->name, ".opd") == 0)
+  if (faddr_sect && streq (faddr_sect->the_bfd_section->name, ".opd"))
     return faddr;
 
   if (faddr_sect != NULL)
     {
       for (obj_section &osect : faddr_sect->objfile->sections ())
        {
-         if (strcmp (osect.the_bfd_section->name, ".opd") == 0)
+         if (streq (osect.the_bfd_section->name, ".opd"))
            {
              CORE_ADDR addr = osect.addr ();
              CORE_ADDR endaddr = osect.endaddr ();
@@ -3593,7 +3593,7 @@ ia64_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr,
   s = find_pc_section (addr);
 
   /* check if ADDR points to a function descriptor.  */
-  if (s && strcmp (s->the_bfd_section->name, ".opd") == 0)
+  if (s && streq (s->the_bfd_section->name, ".opd"))
     return read_memory_unsigned_integer (addr, 8, byte_order);
 
   /* Normally, functions live inside a section that is executable.
index c05c2b0f42f3960539e5f97daaabfa9a406165b6..592f9197cd5e406792f26872b4fdb61cf552f1b3 100644 (file)
@@ -10463,9 +10463,9 @@ set_exec_direction_func (const char *args, int from_tty,
 {
   if (target_can_execute_reverse ())
     {
-      if (!strcmp (exec_direction, exec_forward))
+      if (streq (exec_direction, exec_forward))
        execution_direction = EXEC_FORWARD;
-      else if (!strcmp (exec_direction, exec_reverse))
+      else if (streq (exec_direction, exec_reverse))
        execution_direction = EXEC_REVERSE;
     }
   else
index 23663cb5ef53d41f90ee69541901c10ad6eb5643..0b05a3f277d219287613bad5435bbaf9f585c180 100644 (file)
@@ -85,7 +85,7 @@ interp_factory_register (const char *name, interp_factory_func func)
 {
   /* Assert that no factory for NAME is already registered.  */
   for (const interp_factory &f : interpreter_factories)
-    if (strcmp (f.name, name) == 0)
+    if (streq (f.name, name))
       {
        internal_error (_("interpreter factory already registered: \"%s\"\n"),
                        name);
@@ -157,7 +157,7 @@ static struct interp *
 interp_lookup_existing (struct ui *ui, const char *name)
 {
   for (interp &interp : ui->interp_list)
-    if (strcmp (interp.name (), name) == 0)
+    if (streq (interp.name (), name))
       return &interp;
 
   return nullptr;
@@ -177,7 +177,7 @@ interp_lookup (struct ui *ui, const char *name)
     return interp;
 
   for (const interp_factory &factory : interpreter_factories)
-    if (strcmp (factory.name, name) == 0)
+    if (streq (factory.name, name))
       {
        interp = factory.func (factory.name);
        interp_add (ui, interp);
@@ -224,7 +224,7 @@ current_interp_named_p (const char *interp_name)
   interp *interp = current_ui->current_interpreter;
 
   if (interp != NULL)
-    return (strcmp (interp->name (), interp_name) == 0);
+    return (streq (interp->name (), interp_name));
 
   return 0;
 }
index ac718b0bf07b8fe78b06e40ac75b3abb3e6d2360..439ef293622df146aefcd83c1a1d322a8b39dd70 100644 (file)
@@ -191,8 +191,7 @@ set_language (const char *language)
   enum language flang = language_unknown;
 
   /* "local" is a synonym of "auto".  */
-  if (strcmp (language, "auto") == 0
-      || strcmp (language, "local") == 0)
+  if (streq (language, "auto") || streq (language, "local"))
     {
       /* Enter auto mode.  Set to the current frame's language, if
         known, or fallback to the initial language.  */
@@ -221,7 +220,7 @@ set_language (const char *language)
   /* Search the list of languages for a match.  */
   for (const auto &lang : language_defn::languages)
     {
-      if (strcmp (lang->name (), language) != 0)
+      if (!streq (lang->name (), language))
        continue;
 
       /* Found it!  Go into manual mode, and use this language.  */
@@ -293,22 +292,22 @@ static void
 set_range_command (const char *ignore,
                   int from_tty, struct cmd_list_element *c)
 {
-  if (strcmp (range, "on") == 0)
+  if (streq (range, "on"))
     {
       range_check = range_check_on;
       range_mode = range_mode_manual;
     }
-  else if (strcmp (range, "warn") == 0)
+  else if (streq (range, "warn"))
     {
       range_check = range_check_warn;
       range_mode = range_mode_manual;
     }
-  else if (strcmp (range, "off") == 0)
+  else if (streq (range, "off"))
     {
       range_check = range_check_off;
       range_mode = range_mode_manual;
     }
-  else if (strcmp (range, "auto") == 0)
+  else if (streq (range, "auto"))
     {
       range_mode = range_mode_auto;
       set_range_case ();
@@ -367,17 +366,17 @@ show_case_command (struct ui_file *file, int from_tty,
 static void
 set_case_command (const char *ignore, int from_tty, struct cmd_list_element *c)
 {
-   if (strcmp (case_sensitive, "on") == 0)
+   if (streq (case_sensitive, "on"))
      {
        case_sensitivity = case_sensitive_on;
        case_mode = case_mode_manual;
      }
-   else if (strcmp (case_sensitive, "off") == 0)
+   else if (streq (case_sensitive, "off"))
      {
        case_sensitivity = case_sensitive_off;
        case_mode = case_mode_manual;
      }
-   else if (strcmp (case_sensitive, "auto") == 0)
+   else if (streq (case_sensitive, "auto"))
      {
        case_mode = case_mode_auto;
        set_range_case ();
@@ -478,7 +477,7 @@ enum language
 language_enum (const char *str)
 {
   for (const auto &lang : language_defn::languages)
-    if (strcmp (lang->name (), str) == 0)
+    if (streq (lang->name (), str))
       return lang->la_language;
 
   return language_unknown;
@@ -977,7 +976,7 @@ language_arch_info::lookup_primitive_type_and_symbol (const char *name)
 {
   for (struct type_and_symbol &tas : primitive_types_and_symbols)
     {
-      if (strcmp (tas.type ()->name (), name) == 0)
+      if (streq (tas.type ()->name (), name))
        return &tas;
     }
 
@@ -1107,7 +1106,7 @@ INIT_GDB_FILE (language)
   add_alias_cmd ("ch", setshow_check_cmds.show, no_class, 1, &showlist);
 
   range = type_or_range_names[3];
-  gdb_assert (strcmp (range, "auto") == 0);
+  gdb_assert (streq (range, "auto"));
   add_setshow_enum_cmd ("range", class_support, type_or_range_names,
                        &range,
                        _("Set range checking (on/warn/off/auto)."),
@@ -1117,7 +1116,7 @@ INIT_GDB_FILE (language)
                        &setchecklist, &showchecklist);
 
   case_sensitive = case_sensitive_names[2];
-  gdb_assert (strcmp (case_sensitive, "auto") == 0);
+  gdb_assert (streq (case_sensitive, "auto"));
   add_setshow_enum_cmd ("case-sensitive", class_support, case_sensitive_names,
                        &case_sensitive, _("\
 Set case sensitivity in name search (on/off/auto)."), _("\
index 024358c65f597136dde04cf160809aba80c9618b..7624c92ab257547676285fe71765d07f60a48ba5 100644 (file)
@@ -1742,8 +1742,7 @@ linespec_parse_basic (linespec_parser *parser)
         completions, advance the stream past the colon token and make
         it part of the function name/token.  */
 
-      if (!parser->completion_quote_char
-         && strcmp (parser->lexer.stream, ":") == 0)
+      if (!parser->completion_quote_char && streq (parser->lexer.stream, ":"))
        {
          completion_tracker tmp_tracker (false);
          const char *source_filename
@@ -4217,8 +4216,8 @@ search_minsyms_for_name (struct collect_info *info,
              if (msymbol_type_is_static (item2.minsym->type ()))
                continue;
 
-             if (strcmp (item.minsym->linkage_name (),
-                         item2.minsym->linkage_name ()) != 0)
+             if (!streq (item.minsym->linkage_name (),
+                         item2.minsym->linkage_name ()))
                continue;
 
              /* Found a global minsym with the same name as the
index 3f2bab1663048af202944408c6dce2722645ad05..da92c6a3af273aff0368968ffbe412651acf245a 100644 (file)
@@ -498,17 +498,17 @@ decode_vmflags (char *p, struct smaps_vmflags *v)
        s != NULL;
        s = strtok_r (NULL, " ", &saveptr))
     {
-      if (strcmp (s, "io") == 0)
+      if (streq (s, "io"))
        v->io_page = 1;
-      else if (strcmp (s, "ht") == 0)
+      else if (streq (s, "ht"))
        v->uses_huge_tlb = 1;
-      else if (strcmp (s, "dd") == 0)
+      else if (streq (s, "dd"))
        v->exclude_coredump = 1;
-      else if (strcmp (s, "sh") == 0)
+      else if (streq (s, "sh"))
        v->shared_mapping = 1;
-      else if (strcmp (s, "mt") == 0)
+      else if (streq (s, "mt"))
        v->memory_tagging = 1;
-      else if (strcmp (s, "ss") == 0)
+      else if (streq (s, "ss"))
        v->shadow_stack_memory = 1;
     }
 }
@@ -591,7 +591,7 @@ mapping_is_anonymous_p (const char *filename)
         If we managed to find it, then we assume the mapping is
         anonymous.  */
       return (filename_len >= del_len
-             && strcmp (filename + filename_len - del_len, deleted) == 0);
+             && streq (filename + filename_len - del_len, deleted));
     }
 
   if (*filename == '\0'
@@ -1420,17 +1420,17 @@ parse_smaps_data (const char *data,
              break;
            }
 
-         if (strcmp (keyword, "Anonymous:") == 0)
+         if (streq (keyword, "Anonymous:"))
            {
              /* Older Linux kernels did not support the
                 "Anonymous:" counter.  Check it here.  */
              has_anonymous = 1;
            }
-         else if (strcmp (keyword, "VmFlags:") == 0)
+         else if (streq (keyword, "VmFlags:"))
            decode_vmflags (line, &v);
 
-         if (strcmp (keyword, "AnonHugePages:") == 0
-             || strcmp (keyword, "Anonymous:") == 0)
+         if (streq (keyword, "AnonHugePages:")
+             || streq (keyword, "Anonymous:"))
            {
              unsigned long number;
 
index bd45a2f2978525dd053fba2ee5e5da6161180b56..f276031184c4dcdf04361ab1e0cc067004abbcf7 100644 (file)
@@ -1154,7 +1154,7 @@ thread_db_load_search (void)
          if (rc)
            break;
        }
-      else if (strcmp (this_dir, "$sdir") == 0)
+      else if (streq (this_dir, "$sdir"))
        {
          if (try_thread_db_load_from_sdir ())
            {
@@ -1905,7 +1905,7 @@ info_auto_load_libthread_db (const char *args, int from_tty)
       for (this_pid_len = 0; pid != 0; pid /= 10)
        this_pid_len++;
 
-      if (i == 0 || strcmp (array[i - 1]->filename, array[i]->filename) != 0)
+      if (i == 0 || !streq (array[i - 1]->filename, array[i]->filename))
        {
          unique_filenames++;
          max_filename_len = std::max (max_filename_len,
@@ -1943,8 +1943,7 @@ info_auto_load_libthread_db (const char *args, int from_tty)
                             file_name_style.style ());
 
        std::string pids;
-       while (i < array.size () && strcmp (info->filename,
-                                           array[i]->filename) == 0)
+       while (i < array.size () && streq (info->filename, array[i]->filename))
          {
            if (!pids.empty ())
              pids += ", ";
index 8971e4b5ec12d41d1e219b560f1cc3f984f68344..59616e7f2d663d1e967cff50a3112febd86efdd2 100644 (file)
@@ -162,8 +162,7 @@ m2_language::print_typedef (struct type *type, struct symbol *new_symbol,
   type = check_typedef (type);
   gdb_printf (stream, "TYPE ");
   if (!new_symbol->type ()->name ()
-      || strcmp ((new_symbol->type ())->name (),
-                new_symbol->linkage_name ()) != 0)
+      || !streq ((new_symbol->type ())->name (), new_symbol->linkage_name ()))
     gdb_printf (stream, "%s = ", new_symbol->print_name ());
   else
     gdb_printf (stream, "<builtin> = ");
@@ -352,7 +351,7 @@ m2_is_long_set (struct type *type)
          if (type->field (i).type ()->code () != TYPE_CODE_SET)
            return 0;
          if (type->field (i).name () != NULL
-             && (strcmp (type->field (i).name (), "") != 0))
+             && (!streq (type->field (i).name (), "")))
            return 0;
          range = type->field (i).type ()->index_type ();
          if ((i > TYPE_N_BASECLASSES (type))
@@ -490,9 +489,9 @@ m2_is_unbounded_array (struct type *type)
        */
       if (type->num_fields () != 2)
        return 0;
-      if (strcmp (type->field (0).name (), "_m2_contents") != 0)
+      if (!streq (type->field (0).name (), "_m2_contents"))
        return 0;
-      if (strcmp (type->field (1).name (), "_m2_high") != 0)
+      if (!streq (type->field (1).name (), "_m2_high"))
        return 0;
       if (type->field (0).type ()->code () != TYPE_CODE_PTR)
        return 0;
index 4c4aa19185f06baacff868910971eae65ca0a385..f9d46c00b9cabf845199ab903fea117208fbbb2a 100644 (file)
@@ -2327,8 +2327,7 @@ m32c_skip_trampoline_code (const frame_info_ptr &frame, CORE_ADDR stop_pc)
   if (find_pc_partial_function (stop_pc, &name, &start, &end))
     {
       /* Are we stopped at the beginning of the trampoline function?  */
-      if (strcmp (name, "m32c_jsri16") == 0
-         && stop_pc == start)
+      if (streq (name, "m32c_jsri16") && stop_pc == start)
        {
          /* Get the stack pointer.  The return address is at the top,
             and the target function's address is just below that.  We
@@ -2508,8 +2507,7 @@ m32c_m16c_pointer_to_address (struct gdbarch *gdbarch,
          const char *ptr_msym_name = ptr_msym.minsym->linkage_name ();
          int len = strlen (ptr_msym_name);
 
-         if (len > 4
-             && strcmp (ptr_msym_name + len - 4, ".plt") == 0)
+         if (len > 4 && streq (ptr_msym_name + len - 4, ".plt"))
            {
              /* We have a .plt symbol; try to find the symbol for the
                 corresponding function.
index 75e112edc6eab0c0b2bbb46360221b5b2ba13517..1068783565cef227cfe020a4e746c0f9d565f92d 100644 (file)
@@ -185,8 +185,7 @@ m32r_linux_pc_in_sigtramp (CORE_ADDR pc, const char *name,
     return (m32r_linux_sigtramp_start (pc, this_frame) != 0
            || m32r_linux_rt_sigtramp_start (pc, this_frame) != 0);
 
-  return (strcmp ("__restore", name) == 0
-         || strcmp ("__restore_rt", name) == 0);
+  return streq ("__restore", name) || streq ("__restore_rt", name);
 }
 
 /* From <asm/sigcontext.h>.  */
index 416eb6766fdb4348e6459eda86a2e9b77e89670a..6bd063a89e93fb3e33f33c38b449209cf5c27ba6 100644 (file)
@@ -835,7 +835,7 @@ macho_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
               asect && dsect;
               asect = asect->next, dsect = dsect->next)
            {
-             if (strcmp (asect->name, dsect->name) != 0)
+             if (!streq (asect->name, dsect->name))
                break;
              bfd_set_section_size (dsect, bfd_section_size (asect));
            }
@@ -912,8 +912,8 @@ macho_symfile_offsets (struct objfile *objfile,
 
       if (startswith (bfd_sect_name, "LC_SEGMENT."))
        bfd_sect_name += 11;
-      if (strcmp (bfd_sect_name, "__TEXT") == 0
-         || strcmp (bfd_sect_name, "__TEXT.__text") == 0)
+      if (streq (bfd_sect_name, "__TEXT")
+         || streq (bfd_sect_name, "__TEXT.__text"))
        objfile->sect_index_text = sect_index;
     }
 }
index d700dd37108dc54fa9555a2b3c1de63e90dcd909..c0af31c2b6edc9c1e98266c86143e3cefad0e082 100644 (file)
@@ -210,7 +210,7 @@ info_macro_command (const char *args, int from_tty)
                                         macro_source_file *source,
                                         int line)
       {
-       if (strcmp (name, macro_name) == 0)
+       if (streq (name, macro_name))
          print_macro_definition (name, macro, source, line);
       });
   else
index 79d45457e001c42d59425be64d72de725c74c05c..82f1378e1535703512afa3290c57d9e17037ab0c 100644 (file)
@@ -721,7 +721,7 @@ static int
 currently_rescanning (struct macro_name_list *list, const char *name)
 {
   for (; list; list = list->next)
-    if (strcmp (name, list->name) == 0)
+    if (streq (name, list->name))
       return 1;
 
   return 0;
@@ -1231,7 +1231,7 @@ expand (const char *id,
 
       if (def->argc >= 1)
        {
-         if (strcmp (def->argv[def->argc - 1], "...") == 0)
+         if (streq (def->argv[def->argc - 1], "..."))
            {
              /* In C99-style varargs, substitution is done using
                 __VA_ARGS__.  */
@@ -1242,8 +1242,7 @@ expand (const char *id,
            {
              int len = strlen (def->argv[def->argc - 1]);
 
-             if (len > 3
-                 && strcmp (def->argv[def->argc - 1] + len - 3, "...") == 0)
+             if (len > 3 && streq (def->argv[def->argc - 1] + len - 3, "..."))
                {
                  /* In GNU-style varargs, the name of the
                     substitution parameter is the name of the formal
index 688d1e3fff3ed4c2f68a1587e613e3ee829ccb3c..078eb5cb5aa761c1f6c80fdcfd525fcba1e5fc03 100644 (file)
@@ -657,7 +657,7 @@ find_definition (const char *name,
             We just want to search within a given name's definitions.  */
          struct macro_key *found = (struct macro_key *) pred->key;
 
-         if (strcmp (found->name, name) == 0)
+         if (streq (found->name, name))
            n = pred;
        }
     }
@@ -707,7 +707,7 @@ check_for_redefinition (macro_source_file *source, int line, const char *name,
         definition changes).  */
       if (kind != found_def->kind)
        same = 0;
-      else if (strcmp (replacement, found_def->replacement))
+      else if (!streq (replacement, found_def->replacement))
        same = 0;
       else if (kind == macro_function_like)
        {
index a4e6cddef70295d8626e00c41e89ec895d46a12f..df40ee0b005d3703262ecebbe6514434dacc2bb0 100644 (file)
@@ -1240,9 +1240,7 @@ captured_main_1 (struct captured_main_args *context)
   save_auto_load = global_auto_load;
   global_auto_load = 0;
 
-  if (execarg != NULL
-      && symarg != NULL
-      && strcmp (execarg, symarg) == 0)
+  if (execarg != nullptr && symarg != nullptr && streq (execarg, symarg))
     {
       /* The exec file and the symbol-file are the same.  If we can't
         open it, better only print one error message.
index aa0ca17008d956c5d924f834fd4a7bb1c215828f..bea33f6df6d4fa4b73d9974b3f3e2ae348f99323 100644 (file)
@@ -257,7 +257,7 @@ mem_command (const char *args, int from_tty)
     error_no_arg (_("No mem"));
 
   /* For "mem auto", switch back to using a target provided list.  */
-  if (strcmp (args, "auto") == 0)
+  if (streq (args, "auto"))
     {
       if (mem_use_target ())
        return;
index 1059e366d7befa54ba70959d1ca15b16d0c5db86..bc4bd52dfff03afa42cd62f4bc65ce6323cdbbdb 100644 (file)
@@ -145,11 +145,11 @@ mi_cmd_disassemble (const char *command, const char *const *argv, int argc)
          break;
        case OPCODES_OPT:
          opcodes_seen = true;
-         if (strcmp (oarg, "none") == 0)
+         if (streq (oarg, "none"))
            opcodes_mode = OPCODES_NONE;
-         else if (strcmp (oarg, "display") == 0)
+         else if (streq (oarg, "display"))
            opcodes_mode = OPCODES_DISPLAY;
-         else if (strcmp (oarg, "bytes") == 0)
+         else if (streq (oarg, "bytes"))
            opcodes_mode = OPCODES_BYTES;
          else
            error (_("-data-disassemble: unknown value for -opcodes argument"));
index 22736f568ef377f171dd06c2843616f1f53515a6..f1f1637b74b22539d890d22ad88c3caaeaf060a7 100644 (file)
@@ -103,7 +103,7 @@ mi_cmd_var_create (const char *command, const char *const *argv, int argc)
 
   const char *name = argv[0];
   std::string gen_name;
-  if (strcmp (name, "-") == 0)
+  if (streq (name, "-"))
     {
       gen_name = varobj_gen_name ();
       name = gen_name.c_str ();
@@ -111,9 +111,9 @@ mi_cmd_var_create (const char *command, const char *const *argv, int argc)
   else if (!c_isalpha (name[0]))
     error (_("-var-create: name of object must begin with a letter"));
 
-  if (strcmp (frame, "*") == 0)
+  if (streq (frame, "*"))
     var_type = USE_CURRENT_FRAME;
-  else if (strcmp (frame, "@") == 0)
+  else if (streq (frame, "@"))
     var_type = USE_SELECTED_FRAME;
   else
     {
@@ -154,7 +154,7 @@ mi_cmd_var_delete (const char *command, const char *const *argv, int argc)
      starting with '-'.  */
   if (argc == 1)
     {
-      if (strcmp (name, "-c") == 0)
+      if (streq (name, "-c"))
        error (_("-var-delete: Missing required "
                 "argument after '-c': variable object name"));
       if (*name == '-')
@@ -165,7 +165,7 @@ mi_cmd_var_delete (const char *command, const char *const *argv, int argc)
      which would be the variable name.  */
   if (argc == 2)
     {
-      if (strcmp (name, "-c") != 0)
+      if (!streq (name, "-c"))
        error (_("-var-delete: Invalid option."));
       children_only_p = 1;
       name = argv[1];
@@ -264,9 +264,9 @@ mi_cmd_var_set_frozen (const char *command, const char *const *argv, int argc)
 
   var = varobj_get_handle (argv[0]);
 
-  if (strcmp (argv[1], "0") == 0)
+  if (streq (argv[1], "0"))
     frozen = false;
-  else if (strcmp (argv[1], "1") == 0)
+  else if (streq (argv[1], "1"))
     frozen = true;
   else
     error (_("Invalid flag value"));
index c005263243efa2f7e30661ca561124107f57c995..865bba9abf8e99fd27ca1d72d63c0671418775f1 100644 (file)
@@ -37,7 +37,7 @@ mi_getopt_1 (const char *prefix, int argc, const char *const *argv,
     return -1;
   arg = argv[*oind];
   /* ``--''? */
-  if (strcmp (arg, "--") == 0)
+  if (streq (arg, "--"))
     {
       *oind += 1;
       *oarg = NULL;
@@ -52,7 +52,7 @@ mi_getopt_1 (const char *prefix, int argc, const char *const *argv,
   /* Look the option up.  */
   for (opt = opts; opt->name != NULL; opt++)
     {
-      if (strcmp (opt->name, arg + 1) != 0)
+      if (!streq (opt->name, arg + 1))
        continue;
       if (opt->arg_p)
        {
index 77e56bc9fc8d694dde5aea41567afa8f06169bc9..c03cbfe511737ee9d336d767601b9eedaccfd00a 100644 (file)
@@ -161,7 +161,7 @@ void
 mi_cmd_exec_next (const char *command, const char *const *argv, int argc)
 {
   /* FIXME: Should call a libgdb function, not a cli wrapper.  */
-  if (argc > 0 && strcmp(argv[0], "--reverse") == 0)
+  if (argc > 0 && streq (argv[0], "--reverse"))
     mi_execute_async_cli_command ("reverse-next", argv + 1, argc - 1);
   else
     mi_execute_async_cli_command ("next", argv, argc);
@@ -172,7 +172,7 @@ mi_cmd_exec_next_instruction (const char *command, const char *const *argv,
                              int argc)
 {
   /* FIXME: Should call a libgdb function, not a cli wrapper.  */
-  if (argc > 0 && strcmp(argv[0], "--reverse") == 0)
+  if (argc > 0 && streq (argv[0], "--reverse"))
     mi_execute_async_cli_command ("reverse-nexti", argv + 1, argc - 1);
   else
     mi_execute_async_cli_command ("nexti", argv, argc);
@@ -182,7 +182,7 @@ void
 mi_cmd_exec_step (const char *command, const char *const *argv, int argc)
 {
   /* FIXME: Should call a libgdb function, not a cli wrapper.  */
-  if (argc > 0 && strcmp(argv[0], "--reverse") == 0)
+  if (argc > 0 && streq (argv[0], "--reverse"))
     mi_execute_async_cli_command ("reverse-step", argv + 1, argc - 1);
   else
     mi_execute_async_cli_command ("step", argv, argc);
@@ -193,7 +193,7 @@ mi_cmd_exec_step_instruction (const char *command, const char *const *argv,
                              int argc)
 {
   /* FIXME: Should call a libgdb function, not a cli wrapper.  */
-  if (argc > 0 && strcmp(argv[0], "--reverse") == 0)
+  if (argc > 0 && streq (argv[0], "--reverse"))
     mi_execute_async_cli_command ("reverse-stepi", argv + 1, argc - 1);
   else
     mi_execute_async_cli_command ("stepi", argv, argc);
@@ -203,7 +203,7 @@ void
 mi_cmd_exec_finish (const char *command, const char *const *argv, int argc)
 {
   /* FIXME: Should call a libgdb function, not a cli wrapper.  */
-  if (argc > 0 && strcmp(argv[0], "--reverse") == 0)
+  if (argc > 0 && streq (argv[0], "--reverse"))
     mi_execute_async_cli_command ("reverse-finish", argv + 1, argc - 1);
   else
     mi_execute_async_cli_command ("finish", argv, argc);
@@ -329,7 +329,7 @@ exec_reverse_continue (const char *const *argv, int argc)
 void
 mi_cmd_exec_continue (const char *command, const char *const *argv, int argc)
 {
-  if (argc > 0 && strcmp (argv[0], "--reverse") == 0)
+  if (argc > 0 && streq (argv[0], "--reverse"))
     exec_reverse_continue (argv + 1, argc - 1);
   else
     exec_continue (argv, argc);
@@ -759,9 +759,9 @@ mi_cmd_list_thread_groups (const char *command, const char *const *argv,
          available = 1;
          break;
        case RECURSE_OPT:
-         if (strcmp (oarg, "0") == 0)
+         if (streq (oarg, "0"))
            ;
-         else if (strcmp (oarg, "1") == 0)
+         else if (streq (oarg, "1"))
            recurse = 1;
          else
            error (_("only '0' and '1' are valid values "
@@ -1589,9 +1589,9 @@ mi_cmd_enable_timings (const char *command, const char *const *argv, int argc)
     do_timings = 1;
   else if (argc == 1)
     {
-      if (strcmp (argv[0], "yes") == 0)
+      if (streq (argv[0], "yes"))
        do_timings = 1;
-      else if (strcmp (argv[0], "no") == 0)
+      else if (streq (argv[0], "no"))
        do_timings = 0;
       else
        goto usage_error;
@@ -1795,8 +1795,10 @@ captured_mi_execute_command (struct mi_interp *mi, struct ui_out *uiout,
          gdb_puts (context->token.c_str (), mi->raw_stdout);
          /* There's no particularly good reason why target-connect results
             in not ^done.  Should kill ^connected for MI3.  */
-         gdb_puts (strcmp (context->command.get (), "target-select") == 0
-                   ? "^connected" : "^done", mi->raw_stdout);
+         gdb_puts ((streq (context->command.get (), "target-select")
+                    ? "^connected"
+                    : "^done"),
+                   mi->raw_stdout);
          mi_out_put (uiout, mi->raw_stdout);
          mi_out_rewind (uiout);
          mi_print_timing_maybe (mi->raw_stdout);
@@ -2150,7 +2152,6 @@ mi_load_progress (const char *section_name,
   using namespace std::chrono;
   static steady_clock::time_point last_update;
   static char *previous_sect_name = NULL;
-  int new_section;
   struct mi_interp *mi = as_mi_interp (current_interpreter ());
 
   /* If the current interpreter is not an MI interpreter, then just
@@ -2169,9 +2170,8 @@ mi_load_progress (const char *section_name,
   scoped_restore save_uiout
     = make_scoped_restore (&current_uiout, uiout.get ());
 
-  new_section = (previous_sect_name ?
-                strcmp (previous_sect_name, section_name) : 1);
-  if (new_section)
+  if (previous_sect_name == nullptr
+      || !streq (previous_sect_name, section_name))
     {
       xfree (previous_sect_name);
       previous_sect_name = xstrdup (section_name);
@@ -2301,7 +2301,7 @@ mi_cmd_trace_find (const char *command, const char *const *argv, int argc)
 
   mode = argv[0];
 
-  if (strcmp (mode, "none") == 0)
+  if (streq (mode, "none"))
     {
       tfind_1 (tfind_number, -1, 0, 0, 0);
       return;
@@ -2309,39 +2309,39 @@ mi_cmd_trace_find (const char *command, const char *const *argv, int argc)
 
   check_trace_running (current_trace_status ());
 
-  if (strcmp (mode, "frame-number") == 0)
+  if (streq (mode, "frame-number"))
     {
       if (argc != 2)
        error (_("frame number is required"));
       tfind_1 (tfind_number, atoi (argv[1]), 0, 0, 0);
     }
-  else if (strcmp (mode, "tracepoint-number") == 0)
+  else if (streq (mode, "tracepoint-number"))
     {
       if (argc != 2)
        error (_("tracepoint number is required"));
       tfind_1 (tfind_tp, atoi (argv[1]), 0, 0, 0);
     }
-  else if (strcmp (mode, "pc") == 0)
+  else if (streq (mode, "pc"))
     {
       if (argc != 2)
        error (_("PC is required"));
       tfind_1 (tfind_pc, 0, parse_and_eval_address (argv[1]), 0, 0);
     }
-  else if (strcmp (mode, "pc-inside-range") == 0)
+  else if (streq (mode, "pc-inside-range"))
     {
       if (argc != 3)
        error (_("Start and end PC are required"));
       tfind_1 (tfind_range, 0, parse_and_eval_address (argv[1]),
               parse_and_eval_address (argv[2]), 0);
     }
-  else if (strcmp (mode, "pc-outside-range") == 0)
+  else if (streq (mode, "pc-outside-range"))
     {
       if (argc != 3)
        error (_("Start and end PC are required"));
       tfind_1 (tfind_outside, 0, parse_and_eval_address (argv[1]),
               parse_and_eval_address (argv[2]), 0);
     }
-  else if (strcmp (mode, "line") == 0)
+  else if (streq (mode, "line"))
     {
       if (argc != 2)
        error (_("Line is required"));
index 886d093c62cbb8294089a03893cca222576cb44d..68c56c9b57f5dad8bdaab3cc3dd9e83a76b3d352 100644 (file)
@@ -349,7 +349,7 @@ mi_parse::mi_parse (const char *cmd, std::string *token)
          chp += as;
        }
       /* See if --all is the last token in the input.  */
-      if (strcmp (chp, "--all") == 0)
+      if (streq (chp, "--all"))
        {
          this->all = 1;
          chp += strlen (chp);
@@ -429,32 +429,32 @@ mi_parse::mi_parse (gdb::unique_xmalloc_ptr<char> command,
       const char *chp = args[i].get ();
 
       /* See if --all is the last token in the input.  */
-      if (strcmp (chp, "--all") == 0)
+      if (streq (chp, "--all"))
        {
          this->all = 1;
        }
-      else if (strcmp (chp, "--thread-group") == 0)
+      else if (streq (chp, "--thread-group"))
        {
          ++i;
          if (i == args.size ())
            error ("No argument to '--thread-group'");
          this->set_thread_group (args[i].get (), nullptr);
        }
-      else if (strcmp (chp, "--thread") == 0)
+      else if (streq (chp, "--thread"))
        {
          ++i;
          if (i == args.size ())
            error ("No argument to '--thread'");
          this->set_thread (args[i].get (), nullptr);
        }
-      else if (strcmp (chp, "--frame") == 0)
+      else if (streq (chp, "--frame"))
        {
          ++i;
          if (i == args.size ())
            error ("No argument to '--frame'");
          this->set_frame (args[i].get (), nullptr);
        }
-      else if (strcmp (chp, "--language") == 0)
+      else if (streq (chp, "--language"))
        {
          ++i;
          if (i == args.size ())
@@ -472,17 +472,14 @@ mi_parse::mi_parse (gdb::unique_xmalloc_ptr<char> command,
 enum print_values
 mi_parse_print_values (const char *name)
 {
-   if (strcmp (name, "0") == 0
-       || strcmp (name, mi_no_values) == 0)
-     return PRINT_NO_VALUES;
-   else if (strcmp (name, "1") == 0
-           || strcmp (name, mi_all_values) == 0)
-     return PRINT_ALL_VALUES;
-   else if (strcmp (name, "2") == 0
-           || strcmp (name, mi_simple_values) == 0)
-     return PRINT_SIMPLE_VALUES;
-   else
-     error (_("Unknown value for PRINT_VALUES: must be: \
+  if (streq (name, "0") || streq (name, mi_no_values))
+    return PRINT_NO_VALUES;
+  else if (streq (name, "1") || streq (name, mi_all_values))
+    return PRINT_ALL_VALUES;
+  else if (streq (name, "2") || streq (name, mi_simple_values))
+    return PRINT_SIMPLE_VALUES;
+  else
+    error (_("Unknown value for PRINT_VALUES: must be: \
 0 or \"%s\", 1 or \"%s\", 2 or \"%s\""),
-           mi_no_values, mi_all_values, mi_simple_values);
+          mi_no_values, mi_all_values, mi_simple_values);
 }
index 71cd1bb4c2bd8c776bb998af87ac4ab00c08c623..0d6ea53aecf6b72a9b443ffb61f669b1df4b5005 100644 (file)
@@ -557,7 +557,7 @@ lookup_minimal_symbol_linkage (const char *name, struct objfile *objf,
           msymbol != NULL;
           msymbol = msymbol->hash_next)
        {
-         if (strcmp (msymbol->linkage_name (), name) == 0
+         if (streq (msymbol->linkage_name (), name)
              && (msymbol->type () == mst_data
                  || msymbol->type () == mst_bss
                  || (match_static_type
@@ -611,10 +611,10 @@ lookup_minimal_symbol_text (program_space *pspace, const char *name,
         msymbol != NULL && found_symbol.minsym == NULL;
         msymbol = msymbol->hash_next)
       {
-       if (strcmp (msymbol->linkage_name (), name) == 0 &&
-           (msymbol->type () == mst_text
-            || msymbol->type () == mst_text_gnu_ifunc
-            || msymbol->type () == mst_file_text))
+       if (streq (msymbol->linkage_name (), name)
+           && (msymbol->type () == mst_text
+               || msymbol->type () == mst_text_gnu_ifunc
+               || msymbol->type () == mst_file_text))
          {
            switch (msymbol->type ())
              {
@@ -678,7 +678,7 @@ lookup_minimal_symbol_by_pc_name (CORE_ADDR pc, const char *name,
               msymbol = msymbol->hash_next)
            {
              if (msymbol->value_address (&objfile) == pc
-                 && strcmp (msymbol->linkage_name (), name) == 0)
+                 && streq (msymbol->linkage_name (), name))
                return msymbol;
            }
        }
@@ -1229,12 +1229,12 @@ compact_minimal_symbols (struct minimal_symbol *msymbol, int mcount,
       copyfrom = copyto = msymbol;
       while (copyfrom < msymbol + mcount - 1)
        {
-         if (copyfrom->unrelocated_address ()
-             == (copyfrom + 1)->unrelocated_address ()
+         if ((copyfrom->unrelocated_address ()
+              == (copyfrom + 1)->unrelocated_address ())
              && (copyfrom->section_index ()
                  == (copyfrom + 1)->section_index ())
-             && strcmp (copyfrom->linkage_name (),
-                        (copyfrom + 1)->linkage_name ()) == 0)
+             && streq (copyfrom->linkage_name (),
+                       (copyfrom + 1)->linkage_name ()))
            {
              if ((copyfrom + 1)->type () == mst_unknown)
                (copyfrom + 1)->set_type (copyfrom->type ());
@@ -1498,8 +1498,8 @@ find_solib_trampoline_target (const frame_info_ptr &frame, CORE_ADDR pc)
                   || msymbol->type () == mst_text_gnu_ifunc
                   || msymbol->type () == mst_data
                   || msymbol->type () == mst_data_gnu_ifunc)
-                 && strcmp (msymbol->linkage_name (),
-                            tsymbol->linkage_name ()) == 0)
+                 && streq (msymbol->linkage_name (),
+                           tsymbol->linkage_name ()))
                {
                  CORE_ADDR func;
 
index 727d092b631210f093fa397563b61c37f0db9d71..036fc4c45a70e6b63af66c70c054881e1af94042 100644 (file)
@@ -153,9 +153,8 @@ mips_sde_frame_sniffer (const struct frame_unwind *self,
   const char *name;
 
   find_pc_partial_function (pc, &name, NULL, NULL);
-  return (name
-         && (strcmp (name, "_xcptcall") == 0
-             || strcmp (name, "_sigtramp") == 0));
+  return (name != nullptr
+         && (streq (name, "_xcptcall") || streq (name, "_sigtramp")));
 }
 
 /* Data structure for the SDE frame unwinder.  */
index 3ecf5283a900ce0af3fd6c5240574f46c31ea471..995a3b10915e71539dbfe69975045c907863af40 100644 (file)
@@ -7964,17 +7964,17 @@ mips_find_abi_from_sections (bfd *abfd)
       if (!startswith (name, ".mdebug."))
        continue;
 
-      if (strcmp (name, ".mdebug.abi32") == 0)
+      if (streq (name, ".mdebug.abi32"))
        return MIPS_ABI_O32;
-      else if (strcmp (name, ".mdebug.abiN32") == 0)
+      else if (streq (name, ".mdebug.abiN32"))
        return MIPS_ABI_N32;
-      else if (strcmp (name, ".mdebug.abi64") == 0)
+      else if (streq (name, ".mdebug.abi64"))
        return MIPS_ABI_N64;
-      else if (strcmp (name, ".mdebug.abiO64") == 0)
+      else if (streq (name, ".mdebug.abiO64"))
        return MIPS_ABI_O64;
-      else if (strcmp (name, ".mdebug.eabi32") == 0)
+      else if (streq (name, ".mdebug.eabi32"))
        return MIPS_ABI_EABI32;
-      else if (strcmp (name, ".mdebug.eabi64") == 0)
+      else if (streq (name, ".mdebug.eabi64"))
        return MIPS_ABI_EABI64;
       else
        warning (_("unsupported ABI %s."), name + 8);
index b4a96c753775b5cd44f197f32ed6a1a496f45ff6..5b5749369eebc4980a7fcdd791531086b7cbad51 100644 (file)
@@ -53,25 +53,25 @@ add_using_directive (struct using_direct **using_directives,
     {
       int ix;
 
-      if (strcmp (current->import_src, src) != 0)
+      if (!streq (current->import_src, src))
        continue;
-      if (strcmp (current->import_dest, dest) != 0)
+      if (!streq (current->import_dest, dest))
        continue;
       if ((alias == NULL && current->alias != NULL)
          || (alias != NULL && current->alias == NULL)
          || (alias != NULL && current->alias != NULL
-             && strcmp (alias, current->alias) != 0))
+             && !streq (alias, current->alias)))
        continue;
       if ((declaration == NULL && current->declaration != NULL)
          || (declaration != NULL && current->declaration == NULL)
          || (declaration != NULL && current->declaration != NULL
-             && strcmp (declaration, current->declaration) != 0))
+             && !streq (declaration, current->declaration)))
        continue;
 
       /* Compare the contents of EXCLUDES.  */
       for (ix = 0; ix < excludes.size (); ++ix)
        if (current->excludes[ix] == NULL
-           || strcmp (excludes[ix], current->excludes[ix]) != 0)
+           || !streq (excludes[ix], current->excludes[ix]))
          break;
       if (ix < excludes.size () || current->excludes[ix] != NULL)
        continue;
index 46aa2b730a78901d5d6b8c277b9fb718c07e70b9..046372da7457781c2de056d3deb073dd72e51801 100644 (file)
@@ -210,7 +210,7 @@ linux_determine_kernel_start (void)
       if (match != 2)
        continue;
 
-      if (strcmp (symbol, "_text") == 0)
+      if (streq (symbol, "_text"))
        {
          kernel_start = addr;
          break;
index 57ac6017587533d9fcdeb76baa6ba85b6aeed0f0..248dbab942890b89a39b1ab58ac6d337aceb5c4d 100644 (file)
@@ -586,7 +586,7 @@ linux_xfer_osdata_cpus ()
 
              value[i] = '\0';
 
-             if (strcmp (key, "processor") == 0)
+             if (streq (key, "processor"))
                {
                  if (first_item)
                    buffer += "<item>";
@@ -1392,7 +1392,7 @@ linux_common_xfer_osdata (const char *annex, gdb_byte *readbuf,
 
       for (i = 0; osdata_table[i].type; ++i)
        {
-         if (strcmp (annex, osdata_table[i].type) == 0)
+         if (streq (annex, osdata_table[i].type))
            return common_getter (&osdata_table[i],
                                  readbuf, offset, len);
        }
index 90db9fad6b55de695eab8ff64ebd015384fe8b61..6281581aeeacafb6d176a985b00f95082ac1f3f4 100644 (file)
@@ -105,7 +105,7 @@ parse_proc_status_state (const char *state)
       return PROC_STATE_TRACING_STOP;
     case 'T':
       /* Before Linux 2.6.33, tracing stop used uppercase T.  */
-      if (strcmp (state, "T (stopped)\n") == 0)
+      if (streq (state, "T (stopped)\n"))
        return PROC_STATE_STOPPED;
       else /* "T (tracing stop)\n" */
        return PROC_STATE_TRACING_STOP;
index 3da3c3b61957ed7fc5f61c5691bf52f25821a215..3640b31ec274b21b251ceaeefa03dd030bc61fe5 100644 (file)
@@ -2031,7 +2031,7 @@ nds32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
        {
          const char *regname = gdbarch_register_name (gdbarch, j);
 
-         if (strcmp (regname, nds32_register_aliases[i].name) == 0)
+         if (streq (regname, nds32_register_aliases[i].name))
            {
              regnum = j;
              break;
index f14d7f16d376b13f4f0982806542508a767e26fb..2af438de6599764314bf854d9de1b2df63d49e87 100644 (file)
@@ -1070,15 +1070,15 @@ find_methods (char type, const char *theclass, const char *category,
            continue;
 
          if ((theclass != NULL)
-             && ((nclass == NULL) || (strcmp (theclass, nclass) != 0)))
+             && ((nclass == NULL) || (!streq (theclass, nclass))))
            continue;
 
-         if ((category != NULL) &&
-             ((ncategory == NULL) || (strcmp (category, ncategory) != 0)))
+         if (category != nullptr
+             && ((ncategory == nullptr) || !streq (category, ncategory)))
            continue;
 
-         if ((selector != NULL) &&
-             ((nselector == NULL) || (strcmp (selector, nselector) != 0)))
+         if (selector != nullptr
+             && (nselector == nullptr || !streq (selector, nselector)))
            continue;
 
          symbol_names->push_back (symname);
index ff98cf28ca6b4857dedbde99c9c9e898412bc022..387434153e9ae5176e7745e0241764f2f97c6ab9 100644 (file)
@@ -141,7 +141,7 @@ set_objfile_main_name (struct objfile *objfile,
                       const char *name, enum language lang)
 {
   if (objfile->per_bfd->name_of_main == NULL
-      || strcmp (objfile->per_bfd->name_of_main, name) != 0)
+      || !streq (objfile->per_bfd->name_of_main, name))
     objfile->per_bfd->name_of_main
       = obstack_strdup (&objfile->per_bfd->storage_obstack, name);
   objfile->per_bfd->language_of_main = lang;
@@ -982,7 +982,7 @@ pc_in_section (CORE_ADDR pc, const char *name)
   struct obj_section *s = find_pc_section (pc);
   return (s != nullptr
          && s->the_bfd_section->name != nullptr
-         && strcmp (s->the_bfd_section->name, name) == 0);
+         && streq (s->the_bfd_section->name, name));
 }
 
 /* See objfiles.h.  */
index 0ec7cf861ae9184cb22d538e63a3bfd0e7cad8f2..8576f4224a29db02e1d5e61912f5689295976325 100644 (file)
@@ -346,28 +346,28 @@ opencl_component_ref (struct expression *exp, struct value *val,
       && src_len != 16)
     error (_("Invalid OpenCL vector size"));
 
-  if (strcmp (comps, "lo") == 0 )
+  if (streq (comps, "lo"))
     {
       dst_len = (src_len == 3) ? 2 : src_len / 2;
 
       for (i = 0; i < dst_len; i++)
        indices[i] = i;
     }
-  else if (strcmp (comps, "hi") == 0)
+  else if (streq (comps, "hi"))
     {
       dst_len = (src_len == 3) ? 2 : src_len / 2;
 
       for (i = 0; i < dst_len; i++)
        indices[i] = dst_len + i;
     }
-  else if (strcmp (comps, "even") == 0)
+  else if (streq (comps, "even"))
     {
       dst_len = (src_len == 3) ? 2 : src_len / 2;
 
       for (i = 0; i < dst_len; i++)
        indices[i] = i*2;
     }
-  else if (strcmp (comps, "odd") == 0)
+  else if (streq (comps, "odd"))
     {
       dst_len = (src_len == 3) ? 2 : src_len / 2;
 
index d00da1349a0e163c742c596e22e1811c60adf483..49f618610b0847f70dd8afeed3237a005dcc70a4 100644 (file)
@@ -353,7 +353,7 @@ check_note (bfd *abfd, asection *sect, char *note, unsigned int *sectsize,
 
   /* Check the note name.  */
   if (bfd_h_get_32 (abfd, note) != (strlen (name) + 1)
-      || strcmp (note + 12, name) != 0)
+      || !streq (note + 12, name))
     return 0;
 
   /* Check the descriptor size.  */
@@ -391,7 +391,7 @@ generic_elf_osabi_sniff_abi_tag_sections (bfd *abfd, asection *sect,
   char note[MAX_NOTESZ];
 
   /* .note.ABI-tag notes, used by GNU/Linux and FreeBSD.  */
-  if (strcmp (name, ".note.ABI-tag") == 0)
+  if (streq (name, ".note.ABI-tag"))
     {
       /* GNU.  */
       if (check_note (abfd, sect, note, &sectsize, "GNU", 16, NT_GNU_ABI_TAG))
@@ -440,7 +440,7 @@ generic_elf_osabi_sniff_abi_tag_sections (bfd *abfd, asection *sect,
     }
 
   /* .note.netbsd.ident notes, used by NetBSD.  */
-  if (strcmp (name, ".note.netbsd.ident") == 0
+  if (streq (name, ".note.netbsd.ident")
       && check_note (abfd, sect, note, &sectsize, "NetBSD", 4, NT_NETBSD_IDENT))
     {
       /* There is no need to check the version yet.  */
@@ -449,7 +449,7 @@ generic_elf_osabi_sniff_abi_tag_sections (bfd *abfd, asection *sect,
     }
 
   /* .note.openbsd.ident notes, used by OpenBSD.  */
-  if (strcmp (name, ".note.openbsd.ident") == 0
+  if (streq (name, ".note.openbsd.ident")
       && check_note (abfd, sect, note, &sectsize, "OpenBSD", 4,
                     NT_OPENBSD_IDENT))
     {
@@ -459,7 +459,7 @@ generic_elf_osabi_sniff_abi_tag_sections (bfd *abfd, asection *sect,
     }
 
   /* .note.netbsdcore.procinfo notes, used by NetBSD.  */
-  if (strcmp (name, ".note.netbsdcore.procinfo") == 0)
+  if (streq (name, ".note.netbsdcore.procinfo"))
     {
       *osabi = GDB_OSABI_NETBSD;
       return;
@@ -557,9 +557,9 @@ gdbarch_osabi_enum_name (enum gdb_osabi osabi)
 static void
 set_osabi (const char *args, int from_tty, struct cmd_list_element *c)
 {
-  if (strcmp (set_osabi_string, "auto") == 0)
+  if (streq (set_osabi_string, "auto"))
     user_osabi_state = osabi_auto;
-  else if (strcmp (set_osabi_string, "default") == 0)
+  else if (streq (set_osabi_string, "default"))
     {
       user_selected_osabi = GDB_OSABI_DEFAULT;
       user_osabi_state = osabi_user;
@@ -572,7 +572,7 @@ set_osabi (const char *args, int from_tty, struct cmd_list_element *c)
        {
          enum gdb_osabi osabi = (enum gdb_osabi) i;
 
-         if (strcmp (set_osabi_string, gdbarch_osabi_name (osabi)) == 0)
+         if (streq (set_osabi_string, gdbarch_osabi_name (osabi)))
            {
              user_selected_osabi = osabi;
              user_osabi_state = osabi_user;
@@ -619,7 +619,7 @@ INIT_GDB_FILE (gdb_osabi)
   /* Register the "set osabi" command.  */
   user_osabi_state = osabi_auto;
   set_osabi_string = gdb_osabi_available_names[0];
-  gdb_assert (strcmp (set_osabi_string, "auto") == 0);
+  gdb_assert (streq (set_osabi_string, "auto"));
   add_setshow_enum_cmd ("osabi", class_support, gdb_osabi_available_names,
                        &set_osabi_string,
                        _("Set OS ABI of target."),
index 00b67647fc56fd33754aa320a4bf9ff337c7af41..37831be907481d0e65d53a884416103cb76f84d7 100644 (file)
@@ -1374,29 +1374,29 @@ yylex (void)
   switch (namelen)
     {
     case 6:
-      if (strcmp (uptokstart, "OBJECT") == 0)
+      if (streq (uptokstart, "OBJECT"))
        {
          free (uptokstart);
          return CLASS;
        }
-      if (strcmp (uptokstart, "RECORD") == 0)
+      if (streq (uptokstart, "RECORD"))
        {
          free (uptokstart);
          return STRUCT;
        }
-      if (strcmp (uptokstart, "SIZEOF") == 0)
+      if (streq (uptokstart, "SIZEOF"))
        {
          free (uptokstart);
          return SIZEOF;
        }
       break;
     case 5:
-      if (strcmp (uptokstart, "CLASS") == 0)
+      if (streq (uptokstart, "CLASS"))
        {
          free (uptokstart);
          return CLASS;
        }
-      if (strcmp (uptokstart, "FALSE") == 0)
+      if (streq (uptokstart, "FALSE"))
        {
          yylval.lval = 0;
          free (uptokstart);
@@ -1404,13 +1404,13 @@ yylex (void)
        }
       break;
     case 4:
-      if (strcmp (uptokstart, "TRUE") == 0)
+      if (streq (uptokstart, "TRUE"))
        {
          yylval.lval = 1;
          free (uptokstart);
          return TRUEKEYWORD;
        }
-      if (strcmp (uptokstart, "SELF") == 0)
+      if (streq (uptokstart, "SELF"))
        {
          /* Here we search for 'this' like
             inserted in FPC stabs debug info.  */
index f509f26e6ac2cb057206b1d002889dc59912337a..3703e02478606a4cf9a60e744dd9012959939c6c 100644 (file)
@@ -99,9 +99,9 @@ pascal_is_string_type (struct type *type,int *length_pos, int *length_size,
       /* Two fields: length and st.  */
       if (type->num_fields () == 2
          && type->field (0).name ()
-         && strcmp (type->field (0).name (), "length") == 0
+         && streq (type->field (0).name (), "length")
          && type->field (1).name ()
-         && strcmp (type->field (1).name (), "st") == 0)
+         && streq (type->field (1).name (), "st"))
        {
          if (length_pos)
            *length_pos = type->field (0).loc_bitpos () / TARGET_CHAR_BIT;
@@ -119,9 +119,9 @@ pascal_is_string_type (struct type *type,int *length_pos, int *length_size,
       /* Three fields: Capacity, length and schema$ or _p_schema.  */
       if (type->num_fields () == 3
          && type->field (0).name ()
-         && strcmp (type->field (0).name (), "Capacity") == 0
+         && streq (type->field (0).name (), "Capacity")
          && type->field (1).name ()
-         && strcmp (type->field (1).name (), "length") == 0)
+         && streq (type->field (1).name (), "length"))
        {
          if (length_pos)
            *length_pos = type->field (1).loc_bitpos () / TARGET_CHAR_BIT;
index 3e9b1c259b83ae5302e71ea27a2ebcfd13e8388a..f64c1069b5319c9462d8dd9de9c5d9fc4e2339bd 100644 (file)
@@ -426,9 +426,9 @@ pascal_language::value_print (struct value *val, struct ui_file *stream,
       /* Hack:  remove (char *) for char strings.  Their
         type is indicated by the quoted string anyway.  */
       if (type->code () == TYPE_CODE_PTR
-         && type->name () == NULL
-         && type->target_type ()->name () != NULL
-         && strcmp (type->target_type ()->name (), "char") == 0)
+         && type->name () == nullptr
+         && type->target_type ()->name () != nullptr
+         && streq (type->target_type ()->name (), "char"))
        {
          /* Print nothing.  */
        }
@@ -474,8 +474,7 @@ pascal_object_is_vtbl_ptr_type (struct type *type)
 {
   const char *type_name = type->name ();
 
-  return (type_name != NULL
-         && strcmp (type_name, pascal_vtbl_ptr_name) == 0);
+  return type_name != nullptr && streq (type_name, pascal_vtbl_ptr_name);
 }
 
 /* Return truth value for the assertion that TYPE is of the type
index 2dd36786bd3bed6449c9ee598eb4ed8f2b56e8eb..19698eaacbe51a5323dc809c1fcec2a81a5eb8ea 100644 (file)
@@ -341,8 +341,8 @@ ppc_linux_ilp32_svr4_solib_ops::in_dynsym_resolve_code (CORE_ADDR pc) const
   if (sym.minsym == nullptr)
     return false;
 
-  return (strcmp (sym.minsym->linkage_name (), "__glink") == 0
-         || strcmp (sym.minsym->linkage_name (), "__glink_PLTresolve") == 0);
+  return (streq (sym.minsym->linkage_name (), "__glink")
+         || streq (sym.minsym->linkage_name (), "__glink_PLTresolve"));
 }
 
 /* Follow PLT stub to actual routine.
@@ -2009,14 +2009,14 @@ ppc_floatformat_for_type (struct gdbarch *gdbarch,
 {
   if (len == 128 && name)
     {
-      if (strcmp (name, "__float128") == 0
-         || strcmp (name, "_Float128") == 0
-         || strcmp (name, "_Float64x") == 0
-         || strcmp (name, "complex _Float128") == 0
-         || strcmp (name, "complex _Float64x") == 0)
+      if (streq (name, "__float128")
+         || streq (name, "_Float128")
+         || streq (name, "_Float64x")
+         || streq (name, "complex _Float128")
+         || streq (name, "complex _Float64x"))
        return floatformats_ieee_quad;
 
-      if (strcmp (name, "__ibm128") == 0)
+      if (streq (name, "__ibm128"))
        return floatformats_ibm_long_double;
     }
 
@@ -2033,8 +2033,8 @@ linux_dwarf2_omit_typedef_p (struct type *target_type,
     {
       if ((target_type->code () == TYPE_CODE_FLT
           || target_type->code () == TYPE_CODE_COMPLEX)
-         && (strcmp (name, "long double") == 0
-             || strcmp (name, "complex long double") == 0))
+         && (streq (name, "long double")
+             || streq (name, "complex long double")))
        {
          /* IEEE 128-bit floating point and IBM long double are two
             encodings for 128-bit values.  The DWARF debug data can't
index 74044097c6bd1f0bccfc66339232b5f0fda74b16..9011a3546127a2f0d0adfa159278e70e704ed3e7 100644 (file)
@@ -752,7 +752,7 @@ ppc64_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
   const struct target_section *s = target_section_by_addr (targ, addr);
 
   /* Check if ADDR points to a function descriptor.  */
-  if (s && strcmp (s->the_bfd_section->name, ".opd") == 0)
+  if (s && streq (s->the_bfd_section->name, ".opd"))
     {
       /* There may be relocations that need to be applied to the .opd
         section.  Unfortunately, this function may be called at a time
index 08c613bd9c7f3c63fc4da730c1d9e8a775c9d1f3..f9eb94d188299be78779c938632328cd2bbc3420 100644 (file)
@@ -729,7 +729,7 @@ ignore_probes_command (const char *arg, int from_tty)
       const char *idx = arg;
       std::string s = extract_arg (&idx);
 
-      if (strcmp (s.c_str (), "-reset") == 0)
+      if (streq (s.c_str (), "-reset"))
        {
          if (*idx != '\0')
            error (_("-reset: no arguments allowed"));
@@ -739,8 +739,7 @@ ignore_probes_command (const char *arg, int from_tty)
          return;
        }
 
-      if (strcmp (s.c_str (), "-verbose") == 0
-         || strcmp (s.c_str (), "-v") == 0)
+      if (streq (s.c_str (), "-verbose") || streq (s.c_str (), "-v"))
        {
          verbose_p = true;
          arg = idx;
index c5d3d7e2d7e7d64613c3bf41aa027cc733fbd5c3..03388812ff89fde5bc4f27a170b78693881716da 100644 (file)
@@ -1410,7 +1410,7 @@ local_setattro (PyObject *self, PyObject *name, PyObject *v)
   /* If the attribute trying to be set is the "stop" method,
      but we already have a condition set in the CLI or other extension
      language, disallow this operation.  */
-  if (strcmp (attr.get (), stop_func) == 0)
+  if (streq (attr.get (), stop_func))
     {
       const struct extension_language_defn *extlang = NULL;
 
index 26998064206e7f7cb7ea64a66be563a0c74b3879..fe191451e548d590004cb3869eea6afb4958d9ae 100644 (file)
@@ -231,7 +231,7 @@ gdbpy_create_lazy_string_object (CORE_ADDR address, long length,
 
   str_obj->address = address;
   str_obj->length = length;
-  if (encoding == NULL || !strcmp (encoding, ""))
+  if (encoding == NULL || streq (encoding, ""))
     str_obj->encoding = NULL;
   else
     str_obj->encoding = xstrdup (encoding);
index 0c820751c5679a1b133b7138244be0f4a89ad843..ab06e197d84120350e8aa7b069448b4955af180e 100644 (file)
@@ -144,8 +144,7 @@ struct mi_command_py : public mi_command
        than changing the value of mi_command::m_name (which is not accessible
        from here) to point to the name owned by the new object, swap the names
        of the two objects, since we know they are identical strings.  */
-    gdb_assert (strcmp (new_pyobj->mi_command_name,
-                       m_pyobj->mi_command_name) == 0);
+    gdb_assert (streq (new_pyobj->mi_command_name, m_pyobj->mi_command_name));
     std::swap (new_pyobj->mi_command_name, m_pyobj->mi_command_name);
 
     /* Take a reference to the new object, drop the reference to the current
@@ -385,7 +384,7 @@ micmdpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
 
         So, for now at least, we don't allow this.  This doesn't seem like
         an excessive restriction.  */
-      if (strcmp (cmd->mi_command_name, name) != 0)
+      if (!streq (cmd->mi_command_name, name))
        {
          PyErr_SetString
            (PyExc_ValueError,
index 8765b1b383d1c6939cd74a95fc9cea966d5018f8..bc028f1746c6f3fff8307759984e66837f2f844c 100644 (file)
@@ -242,7 +242,7 @@ set_parameter_value (parmpy_object *self, PyObject *value)
        if (str == NULL)
          return -1;
        for (i = 0; self->enumeration[i]; ++i)
-         if (! strcmp (self->enumeration[i], str.get ()))
+         if (streq (self->enumeration[i], str.get ()))
            break;
        if (! self->enumeration[i])
          {
@@ -328,8 +328,8 @@ set_parameter_value (parmpy_object *self, PyObject *value)
                  buffer += ", ";
                buffer = buffer + "'" + l->literal + "'";
                if (allowed == TRIBOOL_UNKNOWN
-                   && ((value == Py_None && !strcmp ("unlimited", l->literal))
-                       || (s != nullptr && !strcmp (s, l->literal))))
+                   && ((value == Py_None && streq ("unlimited", l->literal))
+                       || (s != nullptr && streq (s, l->literal))))
                  {
                    val = l->use;
                    allowed = TRIBOOL_TRUE;
index 3dcb4fba1e483cd77f5f4d34a4e4bcb0a5236e7d..0cf0cde881c4f4874f04c7de1a62074d026fe7ff 100644 (file)
@@ -323,7 +323,7 @@ print_string_repr (PyObject *printer, const char *hint,
              length = PyBytes_Size (string.get ());
              type = builtin_type (gdbarch)->builtin_char;
 
-             if (hint && !strcmp (hint, "string"))
+             if (hint && streq (hint, "string"))
                language->printstr (stream, type, (gdb_byte *) output,
                                    length, NULL, 0, options);
              else
@@ -370,8 +370,8 @@ print_children (PyObject *printer, const char *hint,
 
   /* If we are printing a map or an array, we want some special
      formatting.  */
-  is_map = hint && ! strcmp (hint, "map");
-  is_array = hint && ! strcmp (hint, "array");
+  is_map = hint && streq (hint, "map");
+  is_array = hint && streq (hint, "array");
 
   gdbpy_ref<> children (PyObject_CallMethodObjArgs (printer, gdbpy_children_cst,
                                                    NULL));
index aa6eccaadbe301ea72020a8ebbe6e856404d8b97..d149d90aaa9f1b1d1e4fc0892802796bb04599e3 100644 (file)
@@ -135,28 +135,27 @@ stylepy_style_from_name (const char *name, bool *has_intensity_ptr = nullptr,
       if (!sub->var.has_value ())
        continue;
 
-      if (strcmp (sub->name, "foreground") == 0)
+      if (streq (sub->name, "foreground"))
        {
          const ui_file_style::color &color
            = sub->var->get<ui_file_style::color> ();
          style.set_fg (color);
          has_fg = true;
        }
-      else if (strcmp (sub->name, "background") == 0)
+      else if (streq (sub->name, "background"))
        {
          const ui_file_style::color &color
            = sub->var->get<ui_file_style::color> ();
          style.set_bg (color);
          has_bg = true;
        }
-      else if (strcmp (sub->name, "intensity") == 0
-              && sub->var->type () == var_enum)
+      else if (streq (sub->name, "intensity") && sub->var->type () == var_enum)
        {
          const char *intensity_str = sub->var->get<const char *> ();
          ui_file_style::intensity intensity = ui_file_style::NORMAL;
-         if (strcmp (intensity_str, "bold") == 0)
+         if (streq (intensity_str, "bold"))
            intensity = ui_file_style::BOLD;
-         else if (strcmp (intensity_str, "dim") == 0)
+         else if (streq (intensity_str, "dim"))
            intensity = ui_file_style::DIM;
          style.set_intensity (intensity);
          has_intensity = true;
index 5474b8d644f8280f447098d4cf4e3aa701b5c119..6e13ab5bb3f76693b719d17ebf4fde91ca1d431e 100644 (file)
@@ -552,7 +552,7 @@ gdbpy_parameter_value (const setting &var)
               l++)
            if (value == l->use)
              {
-               if (strcmp (l->literal, "unlimited") == 0)
+               if (streq (l->literal, "unlimited"))
                  {
                    /* Compatibility hack for API brokenness.  */
                    if (var.type () == var_pinteger
index 84a649c9e4e9a96667d30c01aba43a0f750758d7..c01a1fd2bcf14684c5418ad6b1de4e8bc31f8143 100644 (file)
@@ -103,20 +103,20 @@ record_start (const char *method, const char *format, int from_tty)
       else
        error (_("Invalid format."));
     }
-  else if (strcmp (method, "full") == 0)
+  else if (streq (method, "full"))
     {
       if (format == NULL)
        execute_command_to_string ("record full", from_tty, false);
       else
        error (_("Invalid format."));
     }
-  else if (strcmp (method, "btrace") == 0)
+  else if (streq (method, "btrace"))
     {
       if (format == NULL)
        execute_command_to_string ("record btrace", from_tty, false);
-      else if (strcmp (format, "bts") == 0)
+      else if (streq (format, "bts"))
        execute_command_to_string ("record btrace bts", from_tty, false);
-      else if (strcmp (format, "pt") == 0)
+      else if (streq (format, "pt"))
        execute_command_to_string ("record btrace pt", from_tty, false);
       else
        error (_("Invalid format."));
@@ -561,9 +561,9 @@ cmd_record_insn_history (const char *arg, int from_tty)
 
   int size = command_size_to_target_size (record_insn_history_size);
 
-  if (arg == NULL || *arg == 0 || strcmp (arg, "+") == 0)
+  if (arg == NULL || *arg == 0 || streq (arg, "+"))
     target_insn_history (size, flags);
-  else if (strcmp (arg, "-") == 0)
+  else if (streq (arg, "-"))
     target_insn_history (-size, flags);
   else
     {
@@ -678,9 +678,9 @@ cmd_record_call_history (const char *arg, int from_tty)
 
   int size = command_size_to_target_size (record_call_history_size);
 
-  if (arg == NULL || *arg == 0 || strcmp (arg, "+") == 0)
+  if (arg == NULL || *arg == 0 || streq (arg, "+"))
     target_call_history (size, flags);
-  else if (strcmp (arg, "-") == 0)
+  else if (streq (arg, "-"))
     target_call_history (-size, flags);
   else
     {
index e2ef0a0b69059c5def2554bd84250aaae51d37aa..dc6d8f97126f91c97f546d2db6f6c047b856cfa1 100644 (file)
@@ -51,7 +51,7 @@ struct reg
 
   bool operator== (const reg &other) const
   {
-    return (strcmp (name, other.name) == 0
+    return (streq (name, other.name)
            && offset == other.offset
            && size == other.size);
   }
index d5af2ce0736b69ef23536e32fc3ca35f2915422e..9619aac2b8c6625eedf807293fb86494c3344665 100644 (file)
@@ -170,7 +170,7 @@ reggroup_find (struct gdbarch *gdbarch, const char *name)
 {
   for (const struct reggroup *group : gdbarch_reggroups (gdbarch))
     {
-      if (strcmp (name, group->name ()) == 0)
+      if (streq (name, group->name ()))
        return group;
     }
   return NULL;
index 30afc3737ab8acaefe53134cb05e14b842e5a5ff..0b56e1ddca9350d0cfd6aec4726911867464bbe6 100644 (file)
@@ -1072,7 +1072,7 @@ do_remote_fileio_request (remote_target *remote, char *buf)
   else
     c = strchr (buf, '\0');
   for (idx = 0; remote_fio_func_map[idx].name; ++idx)
-    if (!strcmp (remote_fio_func_map[idx].name, buf))
+    if (streq (remote_fio_func_map[idx].name, buf))
       break;
   if (!remote_fio_func_map[idx].name)
     remote_fileio_reply (remote, -1, FILEIO_ENOSYS);
index 88b06e688bc62de33f67350fb605255ab2dc832f..46bc584b27dcbe4d3e8d5df4251ce2ef3a0cbf4a 100644 (file)
@@ -2432,11 +2432,9 @@ set_memory_packet_size (const char *args, struct memory_packet_config *config,
 
   if (args == NULL)
     error (_("Argument required (integer, \"fixed\" or \"limit\")."));
-  else if (strcmp (args, "hard") == 0
-      || strcmp (args, "fixed") == 0)
+  else if (streq (args, "hard") || streq (args, "fixed"))
     fixed_p = 1;
-  else if (strcmp (args, "soft") == 0
-          || strcmp (args, "limit") == 0)
+  else if (streq (args, "soft") || streq (args, "limit"))
     fixed_p = 0;
   else
     {
@@ -3053,7 +3051,7 @@ remote_target::remote_query_attached (int pid)
   switch (result.status ())
     {
     case PACKET_OK:
-      if (strcmp (rs->buf.data (), "1") == 0)
+      if (streq (rs->buf.data (), "1"))
        return 1;
       break;
     case PACKET_ERROR:
@@ -3351,7 +3349,7 @@ remote_target::pass_signals (gdb::array_view<const unsigned char> pass_signals)
            }
        }
       *p = 0;
-      if (!rs->last_pass_packet || strcmp (rs->last_pass_packet, pass_packet))
+      if (!rs->last_pass_packet || !streq (rs->last_pass_packet, pass_packet))
        {
          putpkt (pass_packet);
          getpkt (&rs->buf);
@@ -3471,7 +3469,7 @@ remote_target::program_signals (gdb::array_view<const unsigned char> signals)
        }
       *p = 0;
       if (!rs->last_program_signals_packet
-         || strcmp (rs->last_program_signals_packet, packet) != 0)
+         || !streq (rs->last_program_signals_packet, packet))
        {
          putpkt (packet);
          getpkt (&rs->buf);
@@ -5531,12 +5529,12 @@ remote_target::start_remote_1 (int from_tty, int extended_p)
 
     putpkt (v_mustreplyempty);
     getpkt (&rs->buf);
-    if (strcmp (rs->buf.data (), "OK") == 0)
+    if (streq (rs->buf.data (), "OK"))
       {
        m_features.m_protocol_packets[PACKET_vFile_setfs].support
          = PACKET_DISABLE;
       }
-    else if (strcmp (rs->buf.data (), "") != 0)
+    else if (!streq (rs->buf.data (), ""))
       error (_("Remote replied unexpectedly to '%s': %s"), v_mustreplyempty,
             rs->buf.data ());
   }
@@ -5631,7 +5629,7 @@ remote_target::start_remote_1 (int from_tty, int extended_p)
       putpkt ("QNonStop:1");
       getpkt (&rs->buf);
 
-      if (strcmp (rs->buf.data (), "OK") != 0)
+      if (!streq (rs->buf.data (), "OK"))
        error (_("Remote refused setting non-stop mode with: %s"),
               rs->buf.data ());
 
@@ -5648,7 +5646,7 @@ remote_target::start_remote_1 (int from_tty, int extended_p)
       putpkt ("QNonStop:0");
       getpkt (&rs->buf);
 
-      if (strcmp (rs->buf.data (), "OK") != 0)
+      if (!streq (rs->buf.data (), "OK"))
        error (_("Remote refused setting all-stop mode with: %s"),
               rs->buf.data ());
     }
@@ -5775,7 +5773,7 @@ remote_target::start_remote_1 (int from_tty, int extended_p)
         reply.  In the latter case, there may be more than one thread
         stopped --- we pull them all out using the vStopped
         mechanism.  */
-      if (strcmp (rs->buf.data (), "OK") != 0)
+      if (!streq (rs->buf.data (), "OK"))
        {
          const notif_client *notif = &notif_client_stop;
 
@@ -6015,7 +6013,7 @@ remote_target::set_permissions ()
 
   /* If the target didn't like the packet, warn the user.  Do not try
      to undo the user's settings, that would just be maddening.  */
-  if (strcmp (rs->buf.data (), "OK") != 0)
+  if (!streq (rs->buf.data (), "OK"))
     warning (_("Remote refused setting permissions with: %s"),
             rs->buf.data ());
 }
@@ -6284,7 +6282,7 @@ register_remote_support_xml (const char *xml)
 
       do
        {
-         if (strcmp (p, xml) == 0)
+         if (streq (p, xml))
            {
              /* already there */
              xfree (copy);
@@ -6473,7 +6471,7 @@ remote_target::remote_query_supported ()
        }
 
       for (i = 0; i < ARRAY_SIZE (remote_protocol_features); i++)
-       if (strcmp (remote_protocol_features[i].name, p) == 0)
+       if (streq (remote_protocol_features[i].name, p))
          {
            const struct protocol_feature *feature;
 
@@ -7086,7 +7084,7 @@ extended_remote_target::attach (const char *args, int from_tty)
          wait_status = (char *) alloca (strlen (rs->buf.data ()) + 1);
          strcpy (wait_status, rs->buf.data ());
        }
-      else if (strcmp (rs->buf.data (), "OK") != 0)
+      else if (!streq (rs->buf.data (), "OK"))
        error (_("Attaching to %s failed with: %s"),
               target_pid_to_str (ptid_t (pid)).c_str (),
               rs->buf.data ());
@@ -7457,7 +7455,7 @@ remote_target::remote_resume_with_vcont (ptid_t scope_ptid, int step,
         reply will be reported asynchronously by means of a `%Stop'
         notification.  */
       getpkt (&rs->buf);
-      if (strcmp (rs->buf.data (), "OK") != 0)
+      if (!streq (rs->buf.data (), "OK"))
        error (_("Unexpected vCont reply in non-stop mode: %s"),
               rs->buf.data ());
     }
@@ -7609,7 +7607,7 @@ vcont_builder::flush ()
   rs = m_remote->get_remote_state ();
   m_remote->putpkt (rs->buf);
   m_remote->getpkt (&rs->buf);
-  if (strcmp (rs->buf.data (), "OK") != 0)
+  if (!streq (rs->buf.data (), "OK"))
     error (_("Unexpected vCont reply in non-stop mode: %s"), rs->buf.data ());
 }
 
@@ -7973,7 +7971,7 @@ remote_target::remote_stop_ns (ptid_t ptid)
      come in asynchronously by notification.  */
   putpkt (rs->buf);
   getpkt (&rs->buf);
-  if (strcmp (rs->buf.data (), "OK") != 0)
+  if (!streq (rs->buf.data (), "OK"))
     error (_("Stopping %s failed: %s"), target_pid_to_str (ptid).c_str (),
           rs->buf.data ());
 }
@@ -8841,7 +8839,7 @@ remote_target::remote_notif_get_pending_events (const notif_client *nc)
       while (1)
        {
          getpkt (&rs->buf);
-         if (strcmp (rs->buf.data (), "OK") == 0)
+         if (streq (rs->buf.data (), "OK"))
            break;
          else
            remote_notif_ack (this, nc, rs->buf.data ());
@@ -11237,7 +11235,7 @@ remote_target::extended_remote_disable_randomization (int val)
   reply = remote_get_noisy_reply ();
   if (*reply == '\0')
     error (_("Target does not support QDisableRandomization."));
-  if (strcmp (reply, "OK") != 0)
+  if (!streq (reply, "OK"))
     error (_("Bogus QDisableRandomization reply from target: %s"), reply);
 }
 
@@ -11332,7 +11330,7 @@ remote_target::send_environment_packet (const char *action,
 
   putpkt (rs->buf);
   getpkt (&rs->buf);
-  if (strcmp (rs->buf.data (), "OK") != 0)
+  if (!streq (rs->buf.data (), "OK"))
     warning (_("Unable to %s environment variable '%s' on remote."),
             action, value);
 }
@@ -11348,7 +11346,7 @@ remote_target::extended_remote_environment_support ()
     {
       putpkt ("QEnvironmentReset");
       getpkt (&rs->buf);
-      if (strcmp (rs->buf.data (), "OK") != 0)
+      if (!streq (rs->buf.data (), "OK"))
        warning (_("Unable to reset environment on remote."));
     }
 
@@ -11525,7 +11523,7 @@ extended_remote_target::create_inferior (const char *exec_file,
                 "QStartupWithShell:%d", startup_with_shell ? 1 : 0);
       putpkt (rs->buf);
       getpkt (&rs->buf);
-      if (strcmp (rs->buf.data (), "OK") != 0)
+      if (!streq (rs->buf.data (), "OK"))
        error (_("\
 Remote replied unexpectedly while setting startup-with-shell: %s"),
               rs->buf.data ());
@@ -12083,7 +12081,7 @@ compare_sections_command (const char *args, int from_tty)
   if (!current_program_space->exec_bfd ())
     error (_("command cannot be used without an exec file"));
 
-  if (args != NULL && strcmp (args, "-r") == 0)
+  if (args != NULL && streq (args, "-r"))
     {
       read_only = 1;
       args = NULL;
@@ -12102,7 +12100,7 @@ compare_sections_command (const char *args, int from_tty)
        continue;               /* Skip zero-length section.  */
 
       sectname = bfd_section_name (s);
-      if (args && strcmp (args, sectname) != 0)
+      if (args && !streq (args, sectname))
        continue;               /* Not the section selected by user.  */
 
       matched = 1;             /* Do this section.  */
@@ -12203,8 +12201,8 @@ remote_target::remote_read_qxfer (const char *object_name,
      this request.  */
   if (rs->finished_object)
     {
-      if (strcmp (object_name, rs->finished_object) == 0
-         && strcmp (annex ? annex : "", rs->finished_annex) == 0
+      if (streq (object_name, rs->finished_object)
+         && streq (annex ? annex : "", rs->finished_annex)
          && offset == rs->finished_offset)
        return TARGET_XFER_EOF;
 
@@ -12633,7 +12631,7 @@ remote_target::rcmd (const char *command, struct ui_file *outbuf)
          break;
        }
 
-      if (strcmp (buf, "OK") != 0)
+      if (!streq (buf, "OK"))
        {
          for (p = buf; p[0] != '\0' && p[1] != '\0'; p += 2)
            {
@@ -14241,7 +14239,7 @@ remote_target::trace_init ()
 
   putpkt ("QTinit");
   remote_get_noisy_reply ();
-  if (strcmp (rs->buf.data (), "OK") != 0)
+  if (!streq (rs->buf.data (), "OK"))
     error (_("Target does not support this command."));
 }
 
@@ -14264,7 +14262,7 @@ remote_target::remote_download_command_source (int num, ULONGEST addr,
                            rs->buf.size () - strlen (rs->buf.data ()));
       putpkt (rs->buf);
       remote_get_noisy_reply ();
-      if (strcmp (rs->buf.data (), "OK"))
+      if (!streq (rs->buf.data (), "OK"))
        warning (_("Target does not support source download."));
 
       if (cmd->control_type == while_control
@@ -14279,7 +14277,7 @@ remote_target::remote_download_command_source (int num, ULONGEST addr,
                                rs->buf.size () - strlen (rs->buf.data ()));
          putpkt (rs->buf);
          remote_get_noisy_reply ();
-         if (strcmp (rs->buf.data (), "OK"))
+         if (!streq (rs->buf.data (), "OK"))
            warning (_("Target does not support source download."));
        }
     }
@@ -14426,7 +14424,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
 
   putpkt (buf.data ());
   remote_get_noisy_reply ();
-  if (strcmp (rs->buf.data (), "OK"))
+  if (!streq (rs->buf.data (), "OK"))
     error (_("Target does not support tracepoints."));
 
   /* do_single_steps (t); */
@@ -14448,7 +14446,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
 
       putpkt (buf.data ());
       remote_get_noisy_reply ();
-      if (strcmp (rs->buf.data (), "OK"))
+      if (!streq (rs->buf.data (), "OK"))
        error (_("Error on target while setting tracepoints."));
     }
 
@@ -14471,7 +14469,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
 
       putpkt (buf.data ());
       remote_get_noisy_reply ();
-      if (strcmp (rs->buf.data (), "OK"))
+      if (!streq (rs->buf.data (), "OK"))
        error (_("Error on target while setting tracepoints."));
     }
 
@@ -14490,7 +14488,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
                                buf.size () - strlen (buf.data ()));
          putpkt (buf.data ());
          remote_get_noisy_reply ();
-         if (strcmp (rs->buf.data (), "OK"))
+         if (!streq (rs->buf.data (), "OK"))
            warning (_("Target does not support source download."));
        }
       if (b->cond_string)
@@ -14506,7 +14504,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
                                buf.size () - strlen (buf.data ()));
          putpkt (buf.data ());
          remote_get_noisy_reply ();
-         if (strcmp (rs->buf.data (), "OK"))
+         if (!streq (rs->buf.data (), "OK"))
            warning (_("Target does not support source download."));
        }
       remote_download_command_source (b->number, loc->address,
@@ -14561,7 +14559,7 @@ remote_target::download_trace_state_variable (const trace_state_variable &tsv)
   remote_get_noisy_reply ();
   if (rs->buf[0] == '\0')
     error (_("Target does not support this command."));
-  if (strcmp (rs->buf.data (), "OK") != 0)
+  if (!streq (rs->buf.data (), "OK"))
     error (_("Error on target while downloading trace state variable."));
 }
 
@@ -14577,7 +14575,7 @@ remote_target::enable_tracepoint (struct bp_location *location)
   remote_get_noisy_reply ();
   if (rs->buf[0] == '\0')
     error (_("Target does not support enabling tracepoints while a trace run is ongoing."));
-  if (strcmp (rs->buf.data (), "OK") != 0)
+  if (!streq (rs->buf.data (), "OK"))
     error (_("Error on target while enabling tracepoint."));
 }
 
@@ -14593,7 +14591,7 @@ remote_target::disable_tracepoint (struct bp_location *location)
   remote_get_noisy_reply ();
   if (rs->buf[0] == '\0')
     error (_("Target does not support disabling tracepoints while a trace run is ongoing."));
-  if (strcmp (rs->buf.data (), "OK") != 0)
+  if (!streq (rs->buf.data (), "OK"))
     error (_("Error on target while disabling tracepoint."));
 }
 
@@ -14658,7 +14656,7 @@ remote_target::trace_start ()
   remote_get_noisy_reply ();
   if (rs->buf[0] == '\0')
     error (_("Target does not support this command."));
-  if (strcmp (rs->buf.data (), "OK") != 0)
+  if (!streq (rs->buf.data (), "OK"))
     error (_("Bogus reply from target: %s"), rs->buf.data ());
 }
 
@@ -14770,7 +14768,7 @@ remote_target::trace_stop ()
   remote_get_noisy_reply ();
   if (rs->buf[0] == '\0')
     error (_("Target does not support this command."));
-  if (strcmp (rs->buf.data (), "OK") != 0)
+  if (!streq (rs->buf.data (), "OK"))
     error (_("Bogus reply from target: %s"), rs->buf.data ());
 }
 
@@ -14898,7 +14896,7 @@ remote_target::save_trace_data (const char *filename)
   reply = remote_get_noisy_reply ();
   if (*reply == '\0')
     error (_("Target does not support this command."));
-  if (strcmp (reply, "OK") != 0)
+  if (!streq (reply, "OK"))
     error (_("Bogus reply from target: %s"), reply);
   return 0;
 }
@@ -14962,7 +14960,7 @@ remote_target::set_disconnected_tracing (int val)
       reply = remote_get_noisy_reply ();
       if (*reply == '\0')
        error (_("Target does not support this command."));
-      if (strcmp (reply, "OK") != 0)
+      if (!streq (reply, "OK"))
        error (_("Bogus reply from target: %s"), reply);
     }
   else if (val)
@@ -14992,7 +14990,7 @@ remote_target::set_circular_trace_buffer (int val)
   reply = remote_get_noisy_reply ();
   if (*reply == '\0')
     error (_("Target does not support this command."));
-  if (strcmp (reply, "OK") != 0)
+  if (!streq (reply, "OK"))
     error (_("Bogus reply from target: %s"), reply);
 }
 
@@ -15117,7 +15115,7 @@ remote_target::set_trace_notes (const char *user, const char *notes,
   if (*reply == '\0')
     return false;
 
-  if (strcmp (reply, "OK") != 0)
+  if (!streq (reply, "OK"))
     error (_("Bogus reply from target: %s"), reply);
 
   return true;
@@ -15135,7 +15133,7 @@ remote_target::use_agent (bool use)
       putpkt (rs->buf);
       getpkt (&rs->buf);
 
-      if (strcmp (rs->buf.data (), "OK") == 0)
+      if (streq (rs->buf.data (), "OK"))
        {
          ::use_agent = use;
          return true;
@@ -15164,7 +15162,7 @@ check_xml_btrace_version (struct gdb_xml_parser *parser,
   const char *version
     = (const char *) xml_find_attribute (attributes, "version")->value.get ();
 
-  if (strcmp (version, "1.0") != 0)
+  if (!streq (version, "1.0"))
     gdb_xml_error (parser, _("Unsupported btrace version: \"%s\""), version);
 }
 
@@ -15260,7 +15258,7 @@ parse_xml_btrace_pt_config_cpu (struct gdb_xml_parser *parser,
 
   btrace = (struct btrace_data *) user_data;
 
-  if (strcmp (vendor, "GenuineIntel") == 0)
+  if (streq (vendor, "GenuineIntel"))
     btrace->variant.pt.config.cpu.vendor = CV_INTEL;
 
   btrace->variant.pt.config.cpu.family = *family;
@@ -16017,7 +16015,7 @@ remote_target::thread_events (bool enable)
   switch (result.status ())
     {
     case PACKET_OK:
-      if (strcmp (rs->buf.data (), "OK") != 0)
+      if (!streq (rs->buf.data (), "OK"))
        error (_("Remote refused setting thread events: %s"), rs->buf.data ());
       rs->last_thread_events = enable;
       break;
@@ -16073,7 +16071,7 @@ remote_target::commit_requested_thread_options ()
       switch (result.status ())
        {
        case PACKET_OK:
-         if (strcmp (rs->buf.data (), "OK") != 0)
+         if (!streq (rs->buf.data (), "OK"))
            error (_("Remote refused setting thread options: %s"), rs->buf.data ());
          break;
        case PACKET_ERROR:
@@ -16150,7 +16148,7 @@ show_remote_cmd (const char *args, int from_tty)
   ui_out_emit_tuple tuple_emitter (uiout, "showlist");
   const ui_file_style cmd_style = command_style.style ();
   for (; list != NULL; list = list->next)
-    if (strcmp (list->name, "Z-packet") == 0)
+    if (streq (list->name, "Z-packet"))
       continue;
     else if (list->type == not_set_cmd)
       /* Alias commands are exactly like the original, except they
@@ -16562,11 +16560,11 @@ test_memory_tagging_functions ()
 
   expected = "qMemTags:0,0:0";
   create_fetch_memtags_request (packet, 0x0, 0x0, 0);
-  SELF_CHECK (strcmp (packet.data (), expected.c_str ()) == 0);
+  SELF_CHECK (streq (packet.data (), expected.c_str ()));
 
   expected = "qMemTags:deadbeef,10:1";
   create_fetch_memtags_request (packet, 0xdeadbeef, 16, 1);
-  SELF_CHECK (strcmp (packet.data (), expected.c_str ()) == 0);
+  SELF_CHECK (streq (packet.data (), expected.c_str ()));
 
   /* Test parsing a qMemTags reply.  */
 
@@ -16614,7 +16612,7 @@ test_memory_tagging_functions ()
   /* Test creating a qIsAddressTagged request.  */
   expected = "qIsAddressTagged:deadbeef";
   create_is_address_tagged_request (gdbarch, packet, 0xdeadbeef);
-  SELF_CHECK (strcmp (packet.data (), expected.c_str ()) == 0);
+  SELF_CHECK (streq (packet.data (), expected.c_str ()));
 
   /* Test error reply on qIsAddressTagged request.  */
   reply = "E00";
@@ -16684,11 +16682,11 @@ test_packet_check_result ()
   packet_result result = packet_check_result (buf.data ());
 
   SELF_CHECK (result.status () == PACKET_ERROR);
-  SELF_CHECK (strcmp(result.err_msg (), "msg") == 0);
+  SELF_CHECK (streq (result.err_msg (), "msg"));
 
   result = packet_check_result ("E01");
   SELF_CHECK (result.status () == PACKET_ERROR);
-  SELF_CHECK (strcmp(result.err_msg (), "01") == 0);
+  SELF_CHECK (streq (result.err_msg (), "01"));
 
   SELF_CHECK (packet_check_result ("E1").status () == PACKET_OK);
 
@@ -16696,7 +16694,7 @@ test_packet_check_result ()
 
   result = packet_check_result ("E.");
   SELF_CHECK (result.status () == PACKET_ERROR);
-  SELF_CHECK (strcmp(result.err_msg (), "no error provided") == 0);
+  SELF_CHECK (streq (result.err_msg (), "no error provided"));
 
   SELF_CHECK (packet_check_result ("some response").status () == PACKET_OK);
 
index 8b06566582c55038d415bc0c98d75d425853a1c9..4dfbd2ec2b8653ecfdbeb859fd485b10f09f862e 100644 (file)
@@ -1114,8 +1114,8 @@ riscv_register_type (struct gdbarch *gdbarch, int regnum)
       if (flen == 8
          && type->code () == TYPE_CODE_FLT
          && type->length () == flen
-         && (strcmp (type->name (), "builtin_type_ieee_double") == 0
-             || strcmp (type->name (), "double") == 0))
+         && (streq (type->name (), "builtin_type_ieee_double")
+             || streq (type->name (), "double")))
        type = riscv_fpreg_d_type (gdbarch);
     }
 
@@ -4103,16 +4103,16 @@ riscv_tdesc_unknown_reg (struct gdbarch *gdbarch, tdesc_feature *feature,
      number that GDB has assigned them.  Then in riscv_register_name we will
      return no name for the three duplicates, this hides the duplicates from
      the user.  */
-  if (strcmp (tdesc_feature_name (feature), riscv_freg_feature.name ()) == 0)
+  if (streq (tdesc_feature_name (feature), riscv_freg_feature.name ()))
     {
       riscv_gdbarch_tdep *tdep = gdbarch_tdep<riscv_gdbarch_tdep> (gdbarch);
       int *regnum_ptr = nullptr;
 
-      if (strcmp (reg_name, "fflags") == 0)
+      if (streq (reg_name, "fflags"))
        regnum_ptr = &tdep->duplicate_fflags_regnum;
-      else if (strcmp (reg_name, "frm") == 0)
+      else if (streq (reg_name, "frm"))
        regnum_ptr = &tdep->duplicate_frm_regnum;
-      else if (strcmp (reg_name, "fcsr") == 0)
+      else if (streq (reg_name, "fcsr"))
        regnum_ptr = &tdep->duplicate_fcsr_regnum;
 
       if (regnum_ptr != nullptr)
@@ -4134,7 +4134,7 @@ riscv_tdesc_unknown_reg (struct gdbarch *gdbarch, tdesc_feature *feature,
   /* Any unknown registers in the CSR feature are recorded within a single
      block so we can easily identify these registers when making choices
      about register groups in riscv_register_reggroup_p.  */
-  if (strcmp (tdesc_feature_name (feature), riscv_csr_feature.name ()) == 0)
+  if (streq (tdesc_feature_name (feature), riscv_csr_feature.name ()))
     {
       riscv_gdbarch_tdep *tdep = gdbarch_tdep<riscv_gdbarch_tdep> (gdbarch);
       if (tdep->unknown_csrs_first_regnum == -1)
index 2c628408b41d8da394acfe3ed699b223b9392874..e135df94a4067e648a81173aec5f1e3acfa5fb88 100644 (file)
@@ -2173,7 +2173,7 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
 
          tmp = find_pc_misc_function (pc);
          if (tmp >= 0
-             && strcmp (misc_function_vector[tmp].name, main_name ()) == 0)
+             && streq (misc_function_vector[tmp].name, main_name ()))
            return pc + 8;
        }
     }
@@ -2250,10 +2250,10 @@ rs6000_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
       /* We check for ___eabi (three leading underscores) in addition
         to __eabi in case the GCC option "-fleading-underscore" was
         used to compile the program.  */
-      if (s.minsym != NULL
-         && s.minsym->linkage_name () != NULL
-         && (strcmp (s.minsym->linkage_name (), "__eabi") == 0
-             || strcmp (s.minsym->linkage_name (), "___eabi") == 0))
+      if (s.minsym != nullptr
+         && s.minsym->linkage_name () != nullptr
+         && (streq (s.minsym->linkage_name (), "__eabi")
+             || streq (s.minsym->linkage_name (), "___eabi")))
        pc += 4;
     }
   return pc;
@@ -4098,8 +4098,7 @@ bfd_uses_spe_extensions (bfd *abfd)
       ptr += 12;
 
       /* The name must be "APUinfo\0".  */
-      if (name_len != 8
-         && strcmp ((const char *) ptr, "APUinfo") != 0)
+      if (name_len != 8 && !streq ((const char *) ptr, "APUinfo"))
        break;
       ptr += name_len;
 
@@ -8549,8 +8548,7 @@ powerpc_set_vector_abi (const char *args, int from_tty,
   for (vector_abi = POWERPC_VEC_AUTO;
        vector_abi != POWERPC_VEC_LAST;
        vector_abi++)
-    if (strcmp (powerpc_vector_abi_string,
-               powerpc_vector_strings[vector_abi]) == 0)
+    if (streq (powerpc_vector_abi_string, powerpc_vector_strings[vector_abi]))
       {
        powerpc_vector_abi_global = (enum powerpc_vector_abi) vector_abi;
        break;
index 9f5c01afda4917870eba964fe9cbc50990ebb695..522b20c97ff491658d230254daca50254a5da205 100644 (file)
@@ -138,7 +138,7 @@ rust_underscore_fields (struct type *type)
          const char *field_name = field.name ();
          if (startswith (field_name, "__"))
            field_name += 2;
-         if (strcmp (buf, field_name) != 0)
+         if (!streq (buf, field_name))
            return false;
          field_number++;
        }
@@ -192,7 +192,7 @@ rust_range_type_p (struct type *type)
     return true;
 
   int field_num = 0;
-  if (strcmp (type->field (0).name (), "start") == 0)
+  if (streq (type->field (0).name (), "start"))
     {
       if (type->num_fields () == 1)
        return true;
@@ -204,7 +204,7 @@ rust_range_type_p (struct type *type)
       return false;
     }
 
-  return strcmp (type->field (field_num).name (), "end") == 0;
+  return streq (type->field (field_num).name (), "end");
 }
 
 /* Return true if TYPE is an inclusive range type, otherwise false.
@@ -254,9 +254,9 @@ rust_get_trait_object_pointer (struct value *value)
   int vtable_field = 0;
   for (int i = 0; i < 2; ++i)
     {
-      if (strcmp (type->field (i).name (), "vtable") == 0)
+      if (streq (type->field (i).name (), "vtable"))
        vtable_field = i;
-      else if (strcmp (type->field (i).name (), "pointer") != 0)
+      else if (!streq (type->field (i).name (), "pointer"))
        return NULL;
     }
 
@@ -379,7 +379,7 @@ rust_array_like_element_type (struct type *type)
   gdb_assert (rust_slice_type_p (type));
   for (const auto &field : type->fields ())
     {
-      if (strcmp (field.name (), "data_ptr") == 0)
+      if (streq (field.name (), "data_ptr"))
        {
          struct type *base_type = field.type ()->target_type ();
          if (rewrite_slice_type (base_type, nullptr, 0, nullptr))
@@ -527,8 +527,7 @@ rust_language::val_print_slice
 
   /* &str is handled here; but for all other slice types it is fine to
      simply print the contents.  */
-  if (orig_type->name () != nullptr
-      && strcmp (orig_type->name (), "&str") == 0)
+  if (orig_type->name () != nullptr && streq (orig_type->name (), "&str"))
     {
       LONGEST low_bound, high_bound;
       if (get_array_bounds (type, &low_bound, &high_bound))
@@ -760,8 +759,10 @@ rust_language::value_print_inner
 
     case TYPE_CODE_INT:
       /* Recognize the unit type.  */
-      if (type->is_unsigned () && type->length () == 0
-         && type->name () != NULL && strcmp (type->name (), "()") == 0)
+      if (type->is_unsigned ()
+         && type->length () == 0
+         && type->name () != nullptr
+         && streq (type->name (), "()"))
        {
          gdb_puts ("()", stream);
          break;
@@ -1323,14 +1324,13 @@ rust_compute_range (struct type *type, struct value *range,
     return;
 
   i = 0;
-  if (strcmp (type->field (0).name (), "start") == 0)
+  if (streq (type->field (0).name (), "start"))
     {
       *kind = RANGE_HIGH_BOUND_DEFAULT;
       *low = value_as_long (range->field (0));
       ++i;
     }
-  if (type->num_fields () > i
-      && strcmp (type->field (i).name (), "end") == 0)
+  if (type->num_fields () > i && streq (type->field (i).name (), "end"))
     {
       *kind = (*kind == (RANGE_LOW_BOUND_DEFAULT | RANGE_HIGH_BOUND_DEFAULT)
               ? RANGE_LOW_BOUND_DEFAULT : RANGE_STANDARD);
@@ -1874,7 +1874,7 @@ rust_language::is_string_type_p (struct type *type) const
          || (type->code () == TYPE_CODE_STRUCT
              && !rust_enum_p (type)
              && rust_slice_type_p (type)
-             && strcmp (type->name (), "&str") == 0));
+             && streq (type->name (), "&str")));
 }
 
 /* See language.h.  */
index 9fc9a438a48947110c38fce773f439add89809fe..0c4f2a501abc705eb3c585c1f125a6051a658ba4 100644 (file)
@@ -2211,7 +2211,7 @@ rust_lex_exception_test (rust_parser *parser, const char *input,
     }
   catch (const gdb_exception_error &except)
     {
-      SELF_CHECK (strcmp (except.what (), err) == 0);
+      SELF_CHECK (streq (except.what (), err));
     }
 }
 
index aed7ae6b9b4c79e69f75c67052d743a9f2834f71..f9d7bdd04e414b594c81a030cd33aa560a68fbb5 100644 (file)
@@ -1638,7 +1638,7 @@ s390_address_class_name_to_type_flags (struct gdbarch *gdbarch,
                                       const char *name,
                                       type_instance_flags *type_flags_ptr)
 {
-  if (strcmp (name, "mode32") == 0)
+  if (streq (name, "mode32"))
     {
       *type_flags_ptr = TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1;
       return true;
index f52864e99fa41f0ec41fbbf4ef4dddb19ef5c74c..f8e28f89eca9678988296b040aa95bc78b3cf24e 100644 (file)
@@ -27,13 +27,13 @@ namespace selftests {
 
 static bool skip_arch (const char *arch)
 {
-  if (strcmp ("powerpc:EC603e", arch) == 0
-      || strcmp ("powerpc:e500mc", arch) == 0
-      || strcmp ("powerpc:e500mc64", arch) == 0
-      || strcmp ("powerpc:titan", arch) == 0
-      || strcmp ("powerpc:vle", arch) == 0
-      || strcmp ("powerpc:e5500", arch) == 0
-      || strcmp ("powerpc:e6500", arch) == 0)
+  if (streq ("powerpc:EC603e", arch)
+      || streq ("powerpc:e500mc", arch)
+      || streq ("powerpc:e500mc64", arch)
+      || streq ("powerpc:titan", arch)
+      || streq ("powerpc:vle", arch)
+      || streq ("powerpc:e5500", arch)
+      || streq ("powerpc:e6500", arch))
     {
       /* PR 19797 */
       return true;
@@ -122,9 +122,9 @@ selftest_skip_warning_arch (struct gdbarch *gdbarch)
        Stack backtrace will not work.
      We could instead capture the output and then filter out the warning, but
      that seems more trouble than it's worth.  */
-  return (strcmp (name, "m68hc11") == 0
-         || strcmp (name, "m68hc12") == 0
-         || strcmp (name, "m68hc12:HCS12") == 0);
+  return (streq (name, "m68hc11")
+         || streq (name, "m68hc12")
+         || streq (name, "m68hc12:HCS12"));
 }
 
 } /* namespace selftests */
index f034c1c94ebb95885108587aab479d7df2fe7387..5624f84e996bfc0df2f5de19cee31123d2017007 100644 (file)
@@ -142,7 +142,7 @@ static const struct serial_ops *
 serial_interface_lookup (const char *name)
 {
   for (const serial_ops *ops : serial_ops_list)
-    if (strcmp (name, ops->name) == 0)
+    if (streq (name, ops->name))
       return ops;
 
   return NULL;
index 0b6dc11119451763e8e003e6f57c3bb4b111472e..8ef2ae5e7da56b051e933b297b0a0a7c4e12cde4 100644 (file)
@@ -392,7 +392,7 @@ sh_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
   *size = kind;
 
   /* For remote stub targets, trapa #20 is used.  */
-  if (strcmp (target_shortname (), "remote") == 0)
+  if (streq (target_shortname (), "remote"))
     {
       static unsigned char big_remote_breakpoint[] = { 0xc3, 0x20 };
       static unsigned char little_remote_breakpoint[] = { 0x20, 0xc3 };
index 8545ae60da47c21fd3b29fbbe12f4cae10bc5b1d..d45de5016660ecdf318c9767cd5b3edaaa7b8c53 100644 (file)
 static int
 sol2_pc_in_sigtramp (CORE_ADDR pc, const char *name)
 {
-  return (name && (strcmp (name, "sigacthandler") == 0
-                  || strcmp (name, "ucbsigvechandler") == 0
-                  || strcmp (name, "__sighndlr") == 0));
+  return (name != nullptr
+         && (streq (name, "sigacthandler")
+             || streq (name, "ucbsigvechandler")
+             || streq (name, "__sighndlr")));
 }
 
 /* Return whether THIS_FRAME corresponds to a Solaris sigtramp routine.  */
index b7daec8ff90bf1d7b2d57a0b1e5521238b070578..d4367973ad595e23ece6de4a39f3dd7d5a5442a4 100644 (file)
@@ -167,7 +167,7 @@ library_list_start_list (struct gdb_xml_parser *parser,
   char *version
     = (char *) xml_find_attribute (attributes, "version")->value.get ();
 
-  if (strcmp (version, "1.0") != 0)
+  if (!streq (version, "1.0"))
     gdb_xml_error (parser,
                   _("Library list has unsupported version \"%s\""),
                   version);
@@ -329,7 +329,7 @@ aix_solib_ops::relocate_section_addresses (solib &so,
   const char *section_name = bfd_section_name (bfd_sect);
   auto *info = gdb::checked_static_cast<lm_info_aix *> (so.lm_info.get ());
 
-  if (strcmp (section_name, ".text") == 0)
+  if (streq (section_name, ".text"))
     {
       sec->addr = info->text_addr;
       sec->endaddr = sec->addr + info->text_size;
@@ -338,12 +338,12 @@ aix_solib_ops::relocate_section_addresses (solib &so,
         XCOFF headers, so we need to adjust by this much.  */
       sec->addr += bfd_sect->filepos;
     }
-  else if (strcmp (section_name, ".data") == 0)
+  else if (streq (section_name, ".data"))
     {
       sec->addr = info->data_addr;
       sec->endaddr = sec->addr + info->data_size;
     }
-  else if (strcmp (section_name, ".bss") == 0)
+  else if (streq (section_name, ".bss"))
     {
       /* The information provided by the loader does not include
         the address of the .bss section, but we know that it gets
@@ -615,7 +615,7 @@ static struct obj_section *
 data_obj_section_from_objfile (struct objfile *objfile)
 {
   for (obj_section &osect : objfile->sections ())
-    if (strcmp (bfd_section_name (osect.the_bfd_section), ".data") == 0)
+    if (streq (bfd_section_name (osect.the_bfd_section), ".data"))
       return &osect;
 
   return NULL;
index aaa34ec0764e23ccad9a276d0594b764431649bb..3412f662910211cfd0788fb41f3170e567acbfb0 100644 (file)
@@ -174,7 +174,7 @@ lookup_symbol_from_bfd (bfd *abfd, const char *symname)
 
   for (const asymbol *sym : symbol_table)
     {
-      if (strcmp (sym->name, symname) == 0
+      if (streq (sym->name, symname)
          && (sym->section->flags & (SEC_CODE | SEC_DATA)) != 0)
        {
          /* BFD symbols are section relative.  */
index 3ad6f5ab2f3ee953cb7c365792df07be5f514bad..052b170fd9a684928ebcc41b21e0bda3f172b602 100644 (file)
@@ -756,7 +756,7 @@ enable_break (void)
              (tmp_bfd.get (),
               [] (const asymbol *sym)
               {
-                return strcmp (sym->name, "_dl_debug_state") == 0;
+                return streq (sym->name, "_dl_debug_state");
               }));
 
       if (addr != 0)
index 997cc175e5860b33420c1468c18bdc12f35d2270..4f0aac31e7332b28e17f9f6287fc92fb198bc702 100644 (file)
@@ -595,7 +595,7 @@ enable_break2 (void)
              (tmp_bfd.get (),
               [] (const asymbol *sym)
               {
-                return strcmp (sym->name, "_dl_debug_addr") == 0;
+                return streq (sym->name, "_dl_debug_addr");
               }));
 
       if (addr == 0)
@@ -1015,7 +1015,7 @@ find_canonical_descriptor_in_load_object
         address according to the link map and then dereferencing
         this address (which is a GOT entry) to obtain a descriptor
         address.  */
-      if ((name == 0 || strcmp (name, (*rel->sym_ptr_ptr)->name) == 0)
+      if ((name == 0 || streq (name, (*rel->sym_ptr_ptr)->name))
          && rel->howto->type == R_FRV_FUNCDESC)
        {
          gdb_byte buf [FRV_PTR_SIZE];
index aeb6cd30f4238322a307b7e4b2d5ccfa3d2ce112..8e3de4d3ea1abe3a8833046382f254d2974d6e95 100644 (file)
@@ -124,7 +124,7 @@ get_lm_info_svr4 (const solib &solib)
 static bool
 svr4_same_name (const char *gdb_so_name, const char *inferior_so_name)
 {
-  if (strcmp (gdb_so_name, inferior_so_name) == 0)
+  if (streq (gdb_so_name, inferior_so_name))
     return 1;
 
   /* On Solaris, when starting inferior we think that dynamic linker is
@@ -133,18 +133,18 @@ svr4_same_name (const char *gdb_so_name, const char *inferior_so_name)
      sometimes they have identical content, but are not linked to each
      other.  We don't restrict this check for Solaris, but the chances
      of running into this situation elsewhere are very low.  */
-  if (strcmp (gdb_so_name, "/usr/lib/ld.so.1") == 0
-      && strcmp (inferior_so_name, "/lib/ld.so.1") == 0)
+  if (streq (gdb_so_name, "/usr/lib/ld.so.1")
+      && streq (inferior_so_name, "/lib/ld.so.1"))
     return 1;
 
   /* Similarly, we observed the same issue with amd64 and sparcv9, but with
      different locations.  */
-  if (strcmp (gdb_so_name, "/usr/lib/amd64/ld.so.1") == 0
-      && strcmp (inferior_so_name, "/lib/amd64/ld.so.1") == 0)
+  if (streq (gdb_so_name, "/usr/lib/amd64/ld.so.1")
+      && streq (inferior_so_name, "/lib/amd64/ld.so.1"))
     return 1;
 
-  if (strcmp (gdb_so_name, "/usr/lib/sparcv9/ld.so.1") == 0
-      && strcmp (inferior_so_name, "/lib/sparcv9/ld.so.1") == 0)
+  if (streq (gdb_so_name, "/usr/lib/sparcv9/ld.so.1")
+      && streq (inferior_so_name, "/lib/sparcv9/ld.so.1"))
     return 1;
 
   return 0;
@@ -1136,7 +1136,7 @@ svr4_library_list_start_list (struct gdb_xml_parser *parser,
     = (const char *) xml_find_attribute (attributes, "version")->value.get ();
   struct gdb_xml_value *main_lm = xml_find_attribute (attributes, "main-lm");
 
-  if (strcmp (version, "1.0") != 0)
+  if (!streq (version, "1.0"))
     gdb_xml_error (parser,
                   _("SVR4 Library list has unsupported version \"%s\""),
                   version);
@@ -1607,8 +1607,7 @@ svr4_fetch_objfile_link_map (struct objfile *objfile)
 static bool
 is_thread_local_section (struct bfd_section *bfd_sect)
 {
-  return ((strcmp (bfd_sect->name, ".tdata") == 0
-          || strcmp (bfd_sect->name, ".tbss") == 0)
+  return ((streq (bfd_sect->name, ".tdata") || streq (bfd_sect->name, ".tbss"))
          && bfd_sect->size != 0);
 }
 
@@ -1815,7 +1814,7 @@ match_main (const char *soname)
 
   for (mainp = main_name_list; *mainp != NULL; mainp++)
     {
-      if (strcmp (soname, *mainp) == 0)
+      if (streq (soname, *mainp))
        return (1);
     }
 
@@ -2727,7 +2726,7 @@ svr4_solib_ops::enable_break (svr4_info *info, int from_tty) const
               (tmp_bfd.get (),
                [=] (const asymbol *sym)
                {
-                 return (strcmp (sym->name, *bkpt_namep) == 0
+                 return (streq (sym->name, *bkpt_namep)
                          && ((sym->section->flags & (SEC_CODE | SEC_DATA))
                              != 0));
                }));
index 981e86b7d90df2aed46c67fa73c67699fb125eb2..ac965df20e94c3ec1c1886eff5e45818776d6387 100644 (file)
@@ -161,7 +161,7 @@ library_list_start_list (struct gdb_xml_parser *parser,
     {
       const char *string = (const char *) version->value.get ();
 
-      if (strcmp (string, "1.0") != 0)
+      if (!streq (string, "1.0"))
        gdb_xml_error (parser,
                       _("Library list has unsupported version \"%s\""),
                       string);
index 0750d48f7476c8b49e78837b040eaa4ea788a0b1..22937c0fc0671886fa015644e5a1d02df8f3daeb 100644 (file)
@@ -197,7 +197,7 @@ solib_find_1 (const char *in_pathname, int *fd, bool is_solib)
        There's no need to check for drive spec explicitly, as we only
        get here if IN_PATHNAME is considered an absolute path.  */
       need_dir_separator = !(IS_DIR_SEPARATOR (in_pathname[0])
-                            || strcmp (TARGET_SYSROOT_PREFIX, sysroot) == 0);
+                            || streq (TARGET_SYSROOT_PREFIX, sysroot));
 
       /* Cat the prefixed pathname together.  */
       temp_pathname.reset (concat (sysroot,
@@ -551,7 +551,7 @@ solib_map_sections (solib &so)
         range of the shared object, assume we want the location of
         the .text section.  */
       if (so.addr_low == 0 && so.addr_high == 0
-         && strcmp (p.the_bfd_section->name, ".text") == 0)
+         && streq (p.the_bfd_section->name, ".text"))
        {
          so.addr_low = p.addr;
          so.addr_high = p.endaddr;
index 0f74a0ebd0dd12debaf94b0b79a9c29d400da4ad..a4bced1296fcdba6cae7892bfb449bea4153bbf0 100644 (file)
@@ -341,8 +341,8 @@ select_source_symtab ()
              const char *name = symtab->filename ();
              int len = strlen (name);
 
-             if (!(len > 2 && (strcmp (&name[len - 2], ".h") == 0
-                               || strcmp (name, "<<C++-namespaces>>") == 0)))
+             if (!(len > 2 && (streq (&name[len - 2], ".h")
+                               || streq (name, "<<C++-namespaces>>"))))
                new_symtab = symtab;
            }
        }
@@ -836,7 +836,7 @@ openp (const char *path, openp_flags opts, const char *string,
       char *dir = dir_up.get ();
       int reg_file_errno;
 
-      if (strcmp (dir, "$cwd") == 0)
+      if (streq (dir, "$cwd"))
        {
          /* Name is $cwd -- insert current directory name instead.  */
          filename = cwd;
@@ -855,7 +855,7 @@ openp (const char *path, openp_flags opts, const char *string,
             contexts.  If the user really has '$cdir' one can use './$cdir'.
             We can get $cdir when loading scripts.  When loading source files
             $cdir must have already been expanded to the correct value.  */
-         if (strcmp (dir, "$cdir") == 0)
+         if (streq (dir, "$cdir"))
            continue;
 
          /* Normal file name in path -- just use it.  */
index 5c526df65be66cb4a110e1773fa7563d982cc25f..9d9c18a7183153078b03a589b268d7646743f288 100644 (file)
@@ -84,7 +84,7 @@ sparc64fbsd_collect_fpregset (const struct regset *regset,
 static int
 sparc64fbsd_pc_in_sigtramp (CORE_ADDR pc, const char *name)
 {
-  return (name && strcmp (name, "__sigtramp") == 0);
+  return (name && streq (name, "__sigtramp"));
 }
 
 static struct sparc_frame_cache *
index 0a4763d117ad022572737149c050801c4b149812..b39b519725e9485939bb4d1062b7434aec8617e7 100644 (file)
@@ -298,7 +298,7 @@ sparc64obsd_trapframe_sniffer (const struct frame_unwind *self,
 
   pc = get_frame_address_in_block (this_frame);
   find_pc_partial_function (pc, &name, NULL, NULL);
-  if (name && strcmp (name, "Lslowtrap_reenter") == 0)
+  if (name && streq (name, "Lslowtrap_reenter"))
     return 1;
 
   return 0;
index f1e3e8975f4fff434b816956a6867f8b08b7e64c..3ab0090ea8a02634dcd6a1f51105285f9afc1084 100644 (file)
@@ -635,8 +635,9 @@ read_frame_arg (const frame_print_options &fp_opts,
          /* Try to remove possibly duplicate error message for ENTRYARGP even
             in MI mode.  */
 
-         if (val_error && entryval_error
-             && strcmp (val_error, entryval_error) == 0)
+         if (val_error != nullptr
+             && entryval_error != nullptr
+             && streq (val_error, entryval_error))
            {
              entryval_error = NULL;
 
index 2607371c39ff3e04a0afaa59f613dbd51958f145..d28cee8168c31fefcf57cc5c2e718cd93f59b2fd 100644 (file)
@@ -1635,7 +1635,8 @@ get_stap_base_address (bfd *obfd, bfd_vma *base)
 
   for (asection *sect : gdb_bfd_sections (obfd))
     if ((sect->flags & (SEC_DATA | SEC_ALLOC | SEC_HAS_CONTENTS))
-       && sect->name && !strcmp (sect->name, STAP_BASE_SECTION_NAME))
+       && sect->name != nullptr
+       && streq (sect->name, STAP_BASE_SECTION_NAME))
       ret = sect;
 
   if (ret == NULL)
index 44a9480d9d90609664e0dfaceecbc636c4bb8fc0..0d77d97b3afe0f01712546968f1fcf13ec200e34 100644 (file)
@@ -409,9 +409,9 @@ relative_addr_info_to_section_offsets (std::vector<CORE_ADDR> &section_offsets,
 static const char *
 addr_section_name (const char *s)
 {
-  if (strcmp (s, ".dynbss") == 0)
+  if (streq (s, ".dynbss"))
     return ".bss";
-  if (strcmp (s, ".sdynbss") == 0)
+  if (streq (s, ".sdynbss"))
     return ".sbss";
 
   return s;
@@ -511,8 +511,8 @@ addr_info_make_relative (section_addr_info *addrs, bfd *abfd)
        abfd_sorted_iter++;
 
       if (abfd_sorted_iter != abfd_addrs_sorted.end ()
-         && strcmp (addr_section_name ((*abfd_sorted_iter)->name.c_str ()),
-                    sect_name) == 0)
+         && streq (addr_section_name ((*abfd_sorted_iter)->name.c_str ()),
+                   sect_name))
        {
          int index_in_addrs;
 
@@ -1574,11 +1574,11 @@ symbol_file_command (const char *args, int from_tty)
              else
                error (_("Unrecognized argument \"%s\""), arg);
            }
-         else if (strcmp (arg, "-readnow") == 0)
+         else if (streq (arg, "-readnow"))
            flags |= OBJF_READNOW;
-         else if (strcmp (arg, "-readnever") == 0)
+         else if (streq (arg, "-readnever"))
            flags |= OBJF_READNEVER;
-         else if (strcmp (arg, "-o") == 0)
+         else if (streq (arg, "-o"))
            {
              arg = built_argv[++idx];
              if (arg == NULL)
@@ -1586,7 +1586,7 @@ symbol_file_command (const char *args, int from_tty)
 
              offset = parse_and_eval_address (arg);
            }
-         else if (strcmp (arg, "--") == 0)
+         else if (streq (arg, "--"))
            stop_processing_options = true;
          else
            error (_("Unrecognized argument \"%s\""), arg);
@@ -2214,11 +2214,11 @@ add_symbol_file_command (const char *args, int from_tty)
          else
            error (_("Unrecognized argument \"%s\""), arg);
        }
-      else if (strcmp (arg, "-readnow") == 0)
+      else if (streq (arg, "-readnow"))
        flags |= OBJF_READNOW;
-      else if (strcmp (arg, "-readnever") == 0)
+      else if (streq (arg, "-readnever"))
        flags |= OBJF_READNEVER;
-      else if (strcmp (arg, "-s") == 0)
+      else if (streq (arg, "-s"))
        {
          if (argv[argcnt + 1] == NULL)
            error (_("Missing section name after \"-s\""));
@@ -2230,7 +2230,7 @@ add_symbol_file_command (const char *args, int from_tty)
          sect_opts.push_back (sect);
          argcnt += 2;
        }
-      else if (strcmp (arg, "-o") == 0)
+      else if (streq (arg, "-o"))
        {
          arg = argv[++argcnt];
          if (arg == NULL)
@@ -2239,7 +2239,7 @@ add_symbol_file_command (const char *args, int from_tty)
          offset = parse_and_eval_address (arg);
          seen_offset = true;
        }
-      else if (strcmp (arg, "--") == 0)
+      else if (streq (arg, "--"))
        stop_processing_options = true;
       else
        error (_("Unrecognized argument \"%s\""), arg);
@@ -3217,7 +3217,7 @@ map_overlay_command (const char *args, int from_tty)
   /* First, find a section matching the user supplied argument.  */
   for (objfile &obj_file : current_program_space->objfiles ())
     for (obj_section &sec : obj_file.sections ())
-      if (!strcmp (bfd_section_name (sec.the_bfd_section), args))
+      if (streq (bfd_section_name (sec.the_bfd_section), args))
        {
          /* Now, check to see if the section is an overlay.  */
          if (!section_is_overlay (&sec))
@@ -3261,7 +3261,7 @@ unmap_overlay_command (const char *args, int from_tty)
   /* First, find a section matching the user supplied argument.  */
   for (objfile &objfile : current_program_space->objfiles ())
     for (obj_section &sec : objfile.sections ())
-      if (!strcmp (bfd_section_name (sec.the_bfd_section), args))
+      if (streq (bfd_section_name (sec.the_bfd_section), args))
        {
          if (!sec.ovly_mapped)
            error (_("Section %s is not mapped"), args);
index 258489fe8f076479c2c3cfc1fd07066804139115..a6dbb3b0603c034efa52b0c9c4bbbc6e36cacce7 100644 (file)
@@ -403,25 +403,25 @@ maintenance_print_symbols (const char *args, int from_tty)
 
   for (i = 0; argv != NULL && argv[i] != NULL; ++i)
     {
-      if (strcmp (argv[i], "-pc") == 0)
+      if (streq (argv[i], "-pc"))
        {
          if (argv[i + 1] == NULL)
            error (_("Missing pc value"));
          address_arg = argv[++i];
        }
-      else if (strcmp (argv[i], "-source") == 0)
+      else if (streq (argv[i], "-source"))
        {
          if (argv[i + 1] == NULL)
            error (_("Missing source file"));
          source_arg = argv[++i];
        }
-      else if (strcmp (argv[i], "-objfile") == 0)
+      else if (streq (argv[i], "-objfile"))
        {
          if (argv[i + 1] == NULL)
            error (_("Missing objfile name"));
          objfile_arg = argv[++i];
        }
-      else if (strcmp (argv[i], "--") == 0)
+      else if (streq (argv[i], "--"))
        {
          /* End of options.  */
          ++i;
@@ -683,13 +683,13 @@ maintenance_print_msymbols (const char *args, int from_tty)
 
   for (i = 0; argv != NULL && argv[i] != NULL; ++i)
     {
-      if (strcmp (argv[i], "-objfile") == 0)
+      if (streq (argv[i], "-objfile"))
        {
          if (argv[i + 1] == NULL)
            error (_("Missing objfile name"));
          objfile_arg = argv[++i];
        }
-      else if (strcmp (argv[i], "--") == 0)
+      else if (streq (argv[i], "--"))
        {
          /* End of options.  */
          ++i;
index 51a049836b04d114d4f9fdf42f51293e8d3607f4..812f9bcc5404022a7b3cc9fe45eaf3b19bcc4e88 100644 (file)
@@ -378,7 +378,7 @@ search_symbol_list (const char *name, int num, struct symbol **syms)
 {
   for (int i = 0; i < num; ++i)
     {
-      if (strcmp (name, syms[i]->natural_name ()) == 0)
+      if (streq (name, syms[i]->natural_name ()))
        return syms[i];
     }
   return nullptr;
@@ -738,8 +738,8 @@ gdb_mangle_name (struct type *type, int method_id, int signature_id)
 
   is_full_physname_constructor = is_constructor_name (physname);
 
-  is_constructor = is_full_physname_constructor
-    || (newname && strcmp (field_name, newname) == 0);
+  is_constructor = (is_full_physname_constructor
+                   || (newname != nullptr && streq (field_name, newname)));
 
   if (!is_destructor)
     is_destructor = (startswith (physname, "__dt"));
@@ -1189,9 +1189,9 @@ matching_obj_sections (struct obj_section *obj_first,
       != bfd_section_vma (second) - bfd_get_start_address (second->owner))
     return false;
 
-  if (bfd_section_name (first) == NULL
-      || bfd_section_name (second) == NULL
-      || strcmp (bfd_section_name (first), bfd_section_name (second)) != 0)
+  if (bfd_section_name (first) == nullptr
+      || bfd_section_name (second) == nullptr
+      || !streq (bfd_section_name (first), bfd_section_name (second)))
     return false;
 
   /* Otherwise check that they are in corresponding objfiles.  */
@@ -1276,7 +1276,7 @@ eq_symbol_entry (const struct symbol_cache_slot *slot,
 
       if (slot->state == SYMBOL_SLOT_NOT_FOUND)
        {
-         if (strcmp (slot_name, name) != 0)
+         if (!streq (slot_name, name))
            return 0;
        }
       else
index 77a562aa919dc4f3f5ca21aa4d2e91da8229cee5..34d18952dc163ed7f678170f4a3cd2ebf735e59e 100644 (file)
@@ -1542,7 +1542,7 @@ memory_xfer_partial_1 (struct target_ops *ops, enum target_object object,
 
          auto match_cb = [=] (const struct target_section *s)
            {
-             return (strcmp (section_name, s->the_bfd_section->name) == 0);
+             return streq (section_name, s->the_bfd_section->name);
            };
 
          return section_table_xfer_memory_partial (readbuf, writebuf,
index 76dc2d27fc5b04dc126f1a1c92ad396b1f5c8aee..510e65c1d094d5ac5078ca9c1e39809d0c0de642 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1190,7 +1190,7 @@ gdb_add_history (const char *command)
          if (temp == NULL)
            break;
 
-         if (strcmp (temp->line, command) == 0)
+         if (streq (temp->line, command))
            {
              HIST_ENTRY *prev = remove_history (where_history ());
              command_count--;
@@ -1413,7 +1413,7 @@ There is NO WARRANTY, to the extent permitted by law.",
   /* After the required info we print the configuration information.  */
 
   gdb_printf (stream, "This GDB was configured as \"");
-  if (strcmp (host_name, target_name) != 0)
+  if (!streq (host_name, target_name))
     {
       gdb_printf (stream, "--host=%s --target=%s",
                  host_name, target_name);
index 3c6bf6cb5a98686b5277e96803a9a1b9b5beb1cb..aff2da55d66add5cf274089c90a3889bb72a6aef 100644 (file)
@@ -913,7 +913,7 @@ ctf_open_dir (const char *dirname)
 
   bt_ctf_get_event_decl_list (handle_id, ctx, &list, &count);
   for (i = 0; i < count; i++)
-    if (strcmp ("register", bt_ctf_get_decl_event_name (list[i])) == 0)
+    if (streq ("register", bt_ctf_get_decl_event_name (list[i])))
       {
        const struct bt_ctf_field_decl * const *field_list;
        const struct bt_declaration *decl;
@@ -922,8 +922,8 @@ ctf_open_dir (const char *dirname)
                                &count);
 
        gdb_assert (count == 1);
-       gdb_assert (0 == strcmp ("contents",
-                                bt_ctf_get_decl_field_name (field_list[0])));
+       gdb_assert (streq ("contents",
+                          bt_ctf_get_decl_field_name (field_list[0])));
        decl = bt_ctf_get_decl_from_field_decl (field_list[0]);
        trace_regblock_size = bt_ctf_get_array_len (decl);
 
@@ -1231,9 +1231,9 @@ ctf_target::fetch_registers (struct regcache *regcache, int regno)
 
       name = bt_ctf_event_name (event1);
 
-      if (name == NULL || strcmp (name, "frame") == 0)
+      if (name == NULL || streq (name, "frame"))
        break;
-      else if (strcmp (name, "register") == 0)
+      else if (streq (name, "register"))
        {
          event = event1;
          break;
@@ -1329,9 +1329,9 @@ ctf_target::xfer_partial (enum target_object object,
            = bt_ctf_iter_read_event (ctf_iter);
          const char *name = bt_ctf_event_name (event);
 
-         if (name == NULL || strcmp (name, "frame") == 0)
+         if (name == NULL || streq (name, "frame"))
            break;
-         else if (strcmp (name, "memory") != 0)
+         else if (!streq (name, "memory"))
            {
              if (bt_iter_next (bt_ctf_get_iter (ctf_iter)) < 0)
                break;
@@ -1445,9 +1445,9 @@ ctf_target::get_trace_state_variable_value (int tsvnum, LONGEST *val)
        = bt_ctf_iter_read_event (ctf_iter);
       const char *name = bt_ctf_event_name (event);
 
-      if (name == NULL || strcmp (name, "frame") == 0)
+      if (name == NULL || streq (name, "frame"))
        break;
-      else if (strcmp (name, "tsv") == 0)
+      else if (streq (name, "tsv"))
        {
          const struct bt_definition *scope;
          const struct bt_definition *def;
@@ -1513,7 +1513,7 @@ ctf_get_traceframe_address (void)
 
       if (name == NULL)
        break;
-      else if (strcmp (name, "frame") == 0)
+      else if (streq (name, "frame"))
        {
          event = event1;
          break;
@@ -1573,7 +1573,7 @@ ctf_target::trace_find (enum trace_find_type type, int num,
       if (event == NULL || name == NULL)
        break;
 
-      if (strcmp (name, "frame") == 0)
+      if (streq (name, "frame"))
        {
          CORE_ADDR tfaddr;
 
@@ -1664,10 +1664,9 @@ ctf_target::traceframe_info ()
 
       name = bt_ctf_event_name (event);
 
-      if (name == NULL || strcmp (name, "register") == 0
-         || strcmp (name, "frame") == 0)
+      if (name == nullptr || streq (name, "register") || streq (name, "frame"))
        ;
-      else if (strcmp (name, "memory") == 0)
+      else if (streq (name, "memory"))
        {
          const struct bt_definition *scope
            = bt_ctf_get_top_level_scope (event,
@@ -1682,7 +1681,7 @@ ctf_target::traceframe_info ()
 
          info->memory.emplace_back (start, length);
        }
-      else if (strcmp (name, "tsv") == 0)
+      else if (streq (name, "tsv"))
        {
          int vnum;
          const struct bt_definition *scope
@@ -1704,7 +1703,7 @@ ctf_target::traceframe_info ()
       if (bt_iter_next (bt_ctf_get_iter (ctf_iter)) < 0)
        break;
     }
-  while (name != NULL && strcmp (name, "frame") != 0);
+  while (name != NULL && !streq (name, "frame"));
 
   /* Restore the position.  */
   bt_iter_set_pos (bt_ctf_get_iter (ctf_iter), pos);
index 6fa1909fcec0eb4329d1e3185efa009d350ef20c..a6f5ae16b916f513e17e07e516f4b0a432749cc9 100644 (file)
@@ -896,7 +896,7 @@ tfile_xfer_partial_features (const char *annex,
                             ULONGEST offset, ULONGEST len,
                             ULONGEST *xfered_len)
 {
-  if (strcmp (annex, "target.xml"))
+  if (!streq (annex, "target.xml"))
     return TARGET_XFER_E_IO;
 
   if (readbuf == NULL)
index 28080e26218c5d2540fe5c26ccea12604bf4c2a6..6dc699f3efe8803631d0ff8bdc9b02744c436f69 100644 (file)
@@ -333,9 +333,9 @@ tsave_command (const char *args, int from_tty)
 
   for (; *argv; ++argv)
     {
-      if (strcmp (*argv, "-r") == 0)
+      if (streq (*argv, "-r"))
        target_does_save = 1;
-      else if (strcmp (*argv, "-ctf") == 0)
+      else if (streq (*argv, "-ctf"))
        generate_ctf = 1;
       else if (**argv == '-')
        error (_("unknown option `%s'"), *argv);
index 2b6fbcbf5ae92c59761e62977ab9339f4c021b07..7f078684b14200bb36c7e4e0311761a43520706a 100644 (file)
@@ -2231,7 +2231,7 @@ tfind_command_1 (const char *args, int from_tty)
       else
        frameno = traceframe_number + 1;
     }
-  else if (0 == strcmp (args, "-"))
+  else if (streq (args, "-"))
     {
       if (traceframe_number == -1)
        error (_("not debugging trace buffer"));
@@ -2241,7 +2241,7 @@ tfind_command_1 (const char *args, int from_tty)
       frameno = traceframe_number - 1;
       }
   /* A hack to work around eval's need for fp to have been collected.  */
-  else if (0 == strcmp (args, "-1"))
+  else if (streq (args, "-1"))
     frameno = -1;
   else
     frameno = parse_and_eval_long (args);
@@ -3006,7 +3006,7 @@ cond_string_is_same (char *str1, char *str2)
   if (str1 == NULL || str2 == NULL)
     return (str1 == str2);
 
-  return (strcmp (str1, str2) == 0);
+  return (streq (str1, str2));
 }
 
 /* Look for an existing tracepoint that seems similar enough to the
index 272f5134d853f34b7b3efe731a41014555cc1f24..40db5f160ca8c5d6bd4863c57615db476664d1a9 100644 (file)
@@ -253,7 +253,7 @@ tui_remove_some_windows ()
 {
   tui_win_info *focus = tui_win_with_focus ();
 
-  if (strcmp (focus->name (), CMD_NAME) == 0)
+  if (streq (focus->name (), CMD_NAME))
     {
       /* Try leaving the source or disassembly window.  If neither
         exists, just do nothing.  */
@@ -506,7 +506,7 @@ tui_layout_window::specification (ui_file *output, int depth)
 std::string
 tui_layout_window::layout_fingerprint () const
 {
-  if (strcmp (get_name (), "cmd") == 0)
+  if (streq (get_name (), "cmd"))
     return "C";
   else
     return "";
@@ -824,7 +824,7 @@ tui_layout_split::apply (int x_, int y_, int width_, int height_,
       if (preserve_cmd_win_size_p
          && cmd_win_already_exists
          && m_splits[i].layout->get_name () != nullptr
-         && strcmp (m_splits[i].layout->get_name (), "cmd") == 0)
+         && streq (m_splits[i].layout->get_name (), "cmd"))
        {
          /* Save the old cmd window information, in case we need to
             restore it later.  */
@@ -1042,9 +1042,9 @@ tui_layout_split::remove_windows (const char *name)
       const char *this_name = m_splits[i].layout->get_name ();
       if (this_name == nullptr)
        m_splits[i].layout->remove_windows (name);
-      else if (strcmp (this_name, name) == 0
-              || strcmp (this_name, CMD_NAME) == 0
-              || strcmp (this_name, STATUS_NAME) == 0)
+      else if (streq (this_name, name)
+              || streq (this_name, CMD_NAME)
+              || streq (this_name, STATUS_NAME))
        {
          /* Keep.  */
        }
index 6d57d8fb62d2cd71d2cbe76d3ede594671cd4eb3..c5cca2fdd00364f14aff695449d216d5af3e7344 100644 (file)
@@ -220,7 +220,7 @@ translate (const char *name, struct tui_translate *table)
 {
   while (table->name)
     {
-      if (name && strcmp (table->name, name) == 0)
+      if (name && streq (table->name, name))
        return table->value;
       table++;
     }
@@ -235,7 +235,7 @@ translate_acs (const char *name, struct tui_translate *table, int acs_char)
 {
   /* The ACS characters are determined at run time by curses terminal
      management.  */
-  if (strcmp (name, "acs") == 0)
+  if (streq (name, "acs"))
     return acs_char;
 
   return translate (name, table);
index fb94823f0fe8e18bb22e6db2bc5633e83c597290..181d5ef4fd663f95367f6d95f7cb04e82fb7209f 100644 (file)
@@ -428,7 +428,7 @@ tui_enable (void)
       /* If the top level interpreter is not the console/tui (e.g.,
         MI), enabling curses will certainly lose.  */
       interp = top_level_interpreter ()->name ();
-      if (strcmp (interp, INTERP_TUI) != 0)
+      if (!streq (interp, INTERP_TUI))
        error (_("Cannot enable the TUI when the interpreter is '%s'"), interp);
 
       /* Don't try to setup curses (and print funny control
index a191c753b08806ea58a8d18f9ed08dcaff2f3865..ab2b0ad5de4e983b3582c4f8e0e437f57d14e05e 100644 (file)
@@ -602,8 +602,8 @@ colorsupport ()
       const char *colorterm = getenv ("COLORTERM");
       if (colors >= 16777216
          || (colorterm != nullptr
-             && (!strcmp (colorterm, "truecolor")
-                 || !strcmp (colorterm, "24bit"))))
+             && (streq (colorterm, "truecolor")
+                 || streq (colorterm, "24bit"))))
        result.push_back (color_space::RGB_24BIT);
 
       return result;
index 6f4d9990a9b8dcd16842526372e13acd1921b967..3861e2dfde8f9f1872b758bda5b41f1add0ad796 100644 (file)
@@ -31,7 +31,7 @@ child_path_check (const char *parent, const char *child, const char *expected)
   const char *result = ::child_path (parent, child);
   if (result == NULL || expected == NULL)
     return result == expected;
-  return strcmp (result, expected) == 0;
+  return streq (result, expected);
 }
 
 /* Test child_path.  */
index f2d0bfe4da3402c8e9e6191b334b028f78b0ad18..2e4cfc4dec3e79dc2697b78f76e640e3e2a9f411 100644 (file)
@@ -33,7 +33,7 @@ test_number_or_range_parser ()
     SELF_CHECK (!one.finished ());
     SELF_CHECK (one.get_number () == 1);
     SELF_CHECK (one.finished ());
-    SELF_CHECK (strcmp (one.cur_tok (), "") == 0);
+    SELF_CHECK (streq (one.cur_tok (), ""));
   }
 
   /* Test parsing an integer followed by a non integer.  */
@@ -43,7 +43,7 @@ test_number_or_range_parser ()
     SELF_CHECK (!one_after.finished ());
     SELF_CHECK (one_after.get_number () == 1);
     SELF_CHECK (one_after.finished ());
-    SELF_CHECK (strcmp (one_after.cur_tok (), "after") == 0);
+    SELF_CHECK (streq (one_after.cur_tok (), "after"));
   }
 
   /* Test parsing a range.  */
@@ -56,7 +56,7 @@ test_number_or_range_parser ()
        SELF_CHECK (one_three.get_number () == i);
       }
     SELF_CHECK (one_three.finished ());
-    SELF_CHECK (strcmp (one_three.cur_tok (), "") == 0);
+    SELF_CHECK (streq (one_three.cur_tok (), ""));
   }
 
   /* Test parsing a range followed by a non-integer.  */
@@ -69,7 +69,7 @@ test_number_or_range_parser ()
        SELF_CHECK (one_three_after.get_number () == i);
       }
     SELF_CHECK (one_three_after.finished ());
-    SELF_CHECK (strcmp (one_three_after.cur_tok (), "after") == 0);
+    SELF_CHECK (streq (one_three_after.cur_tok (), "after"));
   }
 
   /* Test a negative integer gives an error.  */
@@ -86,8 +86,8 @@ test_number_or_range_parser ()
       {
        SELF_CHECK (ex.reason == RETURN_ERROR);
        SELF_CHECK (ex.error == GENERIC_ERROR);
-       SELF_CHECK (strcmp (ex.what (), "negative value") == 0);
-       SELF_CHECK (strcmp (minus_one.cur_tok (), "-1") == 0);
+       SELF_CHECK (streq (ex.what (), "negative value"));
+       SELF_CHECK (streq (minus_one.cur_tok (), "-1"));
       }
   }
 
@@ -96,7 +96,7 @@ test_number_or_range_parser ()
     number_or_range_parser nan ("-whatever");
 
     SELF_CHECK (nan.finished ());
-    SELF_CHECK (strcmp (nan.cur_tok (), "-whatever") == 0);
+    SELF_CHECK (streq (nan.cur_tok (), "-whatever"));
   }
 }
 
index 2a8ded1a2243cf493bba9ad886623f2ec67b466c..e818db09226b728f5d8478e079cf26da4a898ec6 100644 (file)
@@ -82,7 +82,7 @@ check_copy_bitwise (const gdb_byte *dest, unsigned int dest_offset,
 
   /* Compare the resulting strings.  */
   expected[len] = actual[len] = '\0';
-  if (strcmp (expected, actual) != 0)
+  if (!streq (expected, actual))
     error (_("copy_bitwise %s != %s (%u+%u -> %u)"),
           expected, actual, source_offset, nbits, dest_offset);
 }
index 0bfbb8140eb048d746c2cdb927a0de4d24670a95..b643876b144001e50c64c7a90c5b71c480850679 100644 (file)
@@ -63,7 +63,7 @@ test_init_from_host_environ ()
 
   /* Our test environment variable should be present at the
      vector.  */
-  SELF_CHECK (strcmp (env.get (gdb_selftest_env_var), "1") == 0);
+  SELF_CHECK (streq (env.get (gdb_selftest_env_var), "1"));
 }
 
 /* Test reinitialization using the host's environ.  */
@@ -80,7 +80,7 @@ test_reinit_from_host_environ ()
   int num_found = 0;
 
   for (size_t i = 0; envp[i] != NULL; ++i)
-    if (strcmp (envp[i], "GDB_SELFTEST_ENVIRON=1") == 0)
+    if (streq (envp[i], "GDB_SELFTEST_ENVIRON=1"))
       ++num_found;
   SELF_CHECK (num_found == 1);
 }
@@ -95,18 +95,18 @@ test_set_A_unset_B_unset_A_cannot_find_A_can_find_B ()
   gdb_environ env;
 
   env.set ("GDB_SELFTEST_ENVIRON_1", "aaa");
-  SELF_CHECK (strcmp (env.get ("GDB_SELFTEST_ENVIRON_1"), "aaa") == 0);
+  SELF_CHECK (streq (env.get ("GDB_SELFTEST_ENVIRON_1"), "aaa"));
   /* User-set environ var list must contain one element.  */
   SELF_CHECK (env.user_set_env ().size () == 1);
   SELF_CHECK (set_contains (env.user_set_env (),
                            std::string ("GDB_SELFTEST_ENVIRON_1=aaa")));
 
   env.set ("GDB_SELFTEST_ENVIRON_2", "bbb");
-  SELF_CHECK (strcmp (env.get ("GDB_SELFTEST_ENVIRON_2"), "bbb") == 0);
+  SELF_CHECK (streq (env.get ("GDB_SELFTEST_ENVIRON_2"), "bbb"));
 
   env.unset ("GDB_SELFTEST_ENVIRON_1");
   SELF_CHECK (env.get ("GDB_SELFTEST_ENVIRON_1") == NULL);
-  SELF_CHECK (strcmp (env.get ("GDB_SELFTEST_ENVIRON_2"), "bbb") == 0);
+  SELF_CHECK (streq (env.get ("GDB_SELFTEST_ENVIRON_2"), "bbb"));
 
   /* The user-set environ var list must contain only one element
      now.  */
@@ -123,7 +123,7 @@ test_unset_set_empty_vector ()
   gdb_environ env;
 
   env.set ("PWD", "test");
-  SELF_CHECK (strcmp (env.get ("PWD"), "test") == 0);
+  SELF_CHECK (streq (env.get ("PWD"), "test"));
   SELF_CHECK (set_contains (env.user_set_env (), std::string ("PWD=test")));
   SELF_CHECK (env.user_unset_env ().size () == 0);
   /* The second element must be NULL.  */
@@ -164,19 +164,19 @@ test_std_move ()
   gdb_environ env2;
 
   env.set ("A", "1");
-  SELF_CHECK (strcmp (env.get ("A"), "1") == 0);
+  SELF_CHECK (streq (env.get ("A"), "1"));
   SELF_CHECK (set_contains (env.user_set_env (), std::string ("A=1")));
   SELF_CHECK (env.user_set_env ().size () == 1);
 
   env2 = std::move (env);
   SELF_CHECK (env.envp ()[0] == NULL);
-  SELF_CHECK (strcmp (env2.get ("A"), "1") == 0);
+  SELF_CHECK (streq (env2.get ("A"), "1"));
   SELF_CHECK (env2.envp ()[1] == NULL);
   SELF_CHECK (env.user_set_env ().size () == 0);
   SELF_CHECK (set_contains (env2.user_set_env (), std::string ("A=1")));
   SELF_CHECK (env2.user_set_env ().size () == 1);
   env.set ("B", "2");
-  SELF_CHECK (strcmp (env.get ("B"), "2") == 0);
+  SELF_CHECK (streq (env.get ("B"), "2"));
   SELF_CHECK (env.envp ()[1] == NULL);
 }
 
@@ -189,19 +189,19 @@ test_move_constructor ()
   gdb_environ env;
 
   env.set ("A", "1");
-  SELF_CHECK (strcmp (env.get ("A"), "1") == 0);
+  SELF_CHECK (streq (env.get ("A"), "1"));
   SELF_CHECK (set_contains (env.user_set_env (), std::string ("A=1")));
 
   gdb_environ env2 = std::move (env);
   SELF_CHECK (env.envp ()[0] == NULL);
   SELF_CHECK (env.user_set_env ().size () == 0);
-  SELF_CHECK (strcmp (env2.get ("A"), "1") == 0);
+  SELF_CHECK (streq (env2.get ("A"), "1"));
   SELF_CHECK (env2.envp ()[1] == NULL);
   SELF_CHECK (set_contains (env2.user_set_env (), std::string ("A=1")));
   SELF_CHECK (env2.user_set_env ().size () == 1);
 
   env.set ("B", "2");
-  SELF_CHECK (strcmp (env.get ("B"), "2") == 0);
+  SELF_CHECK (streq (env.get ("B"), "2"));
   SELF_CHECK (env.envp ()[1] == NULL);
   SELF_CHECK (set_contains (env.user_set_env (), std::string ("B=2")));
   SELF_CHECK (env.user_set_env ().size () == 1);
@@ -216,7 +216,7 @@ test_self_move ()
 
   /* Test self-move.  */
   env.set ("A", "1");
-  SELF_CHECK (strcmp (env.get ("A"), "1") == 0);
+  SELF_CHECK (streq (env.get ("A"), "1"));
   SELF_CHECK (set_contains (env.user_set_env (), std::string ("A=1")));
   SELF_CHECK (env.user_set_env ().size () == 1);
 
@@ -227,8 +227,8 @@ test_self_move ()
   env = std::move (env);
   DIAGNOSTIC_POP
 
-  SELF_CHECK (strcmp (env.get ("A"), "1") == 0);
-  SELF_CHECK (strcmp (env.envp ()[0], "A=1") == 0);
+  SELF_CHECK (streq (env.get ("A"), "1"));
+  SELF_CHECK (streq (env.envp ()[0], "A=1"));
   SELF_CHECK (env.envp ()[1] == NULL);
   SELF_CHECK (set_contains (env.user_set_env (), std::string ("A=1")));
   SELF_CHECK (env.user_set_env ().size () == 1);
@@ -246,7 +246,7 @@ test_set_unset_reset ()
 
   /* Set our test variable to another value.  */
   env.set ("GDB_SELFTEST_ENVIRON", "test");
-  SELF_CHECK (strcmp (env.get ("GDB_SELFTEST_ENVIRON"), "test") == 0);
+  SELF_CHECK (streq (env.get ("GDB_SELFTEST_ENVIRON"), "test"));
   SELF_CHECK (env.user_set_env ().size () == 1);
   SELF_CHECK (env.user_unset_env ().size () == 0);
 
@@ -261,7 +261,7 @@ test_set_unset_reset ()
 
   /* Re-set the test variable.  */
   env.set ("GDB_SELFTEST_ENVIRON", "1");
-  SELF_CHECK (strcmp (env.get ("GDB_SELFTEST_ENVIRON"), "1") == 0);
+  SELF_CHECK (streq (env.get ("GDB_SELFTEST_ENVIRON"), "1"));
 }
 
 static void
index 398ca04a5198712b20a0a8a513e4f224c98eaad7..aa68b7d21ec28450431cef411e55d62c0d03b545 100644 (file)
@@ -95,7 +95,7 @@ verify_items (const ListType &list,
       SELF_CHECK (&item == expected[i]);
 
       /* Access the item, to make sure the object is still alive.  */
-      SELF_CHECK (strcmp (item.name, expected[i]->name) == 0);
+      SELF_CHECK (streq (item.name, expected[i]->name));
 
       ++i;
     }
@@ -113,7 +113,7 @@ verify_items (const ListType &list,
       SELF_CHECK (&item == expected[i]);
 
       /* Access the item, to make sure the object is still alive.  */
-      SELF_CHECK (strcmp (item.name, expected[i]->name) == 0);
+      SELF_CHECK (streq (item.name, expected[i]->name));
     }
 
   SELF_CHECK (i == 0);
index 6d56ecd4df49848e65f959b2305f9869a618ce4d..8eae34d91f81e6a9847cb8134d9a7628ade77f96 100644 (file)
@@ -38,7 +38,7 @@ check_make_paramless (const char *file, int line,
                                completion_mode, true /* ignore_parameters */);
   const char *result = lookup_name.language_lookup_name (lang);
 
-  if (strcmp (result, expected) != 0)
+  if (!streq (result, expected))
     {
       error (_("%s:%d: make-paramless self-test failed: (completion=%d, lang=%d) "
               "\"%s\" -> \"%s\", expected \"%s\""),
index a89f94dd47a92d91d976e4a5e1ed78bc4bc808e6..06026b459cdab5ad58debce265122144ccf95dbd 100644 (file)
@@ -102,7 +102,7 @@ test_normal ()
 
     SELF_CHECK (m.get () != MAP_FAILED);
     SELF_CHECK (m.size () == 7);
-    SELF_CHECK (0 == strcmp ((char *) m.get (), "Hello!"));
+    SELF_CHECK (streq ((char *) m.get (), "Hello!"));
   }
 }
 
index 3618ee52d42c18ede9c3af9f889ca7b35beca00d..cd11a05e275d6ba75bd519e54249f4bdfeb97901 100644 (file)
@@ -30,8 +30,8 @@ unique_xmalloc_ptr_char ()
   gdb::unique_xmalloc_ptr<char> a = make_unique_xstrdup ("abc");
   gdb::unique_xmalloc_ptr<char> b = make_unique_xstrndup ("defghi", 3);
 
-  SELF_CHECK (strcmp (a.get (), "abc") == 0);
-  SELF_CHECK (strcmp (b.get (), "def") == 0);
+  SELF_CHECK (streq (a.get (), "abc"));
+  SELF_CHECK (streq (b.get (), "def"));
 
   std::string str = "xxx";
 
index ef8ef87bc5b8394938b8dda6750c693fa0a4a068..bbb6bcb416240addde767244e03eb215bf4483e1 100644 (file)
@@ -1359,7 +1359,7 @@ maintenance_info_screen (const char *args, int from_tty)
     = rl_variable_value ("horizontal-scroll-mode");
   bool force_horizontal_scroll_mode
     = (horizontal_scroll_mode_value != nullptr
-       && strcmp (horizontal_scroll_mode_value, "on") == 0);
+       && streq (horizontal_scroll_mode_value, "on"));
 
   const char *mode = nullptr;
   const char *reason = nullptr;
@@ -3341,7 +3341,7 @@ gdb_realpath_check_trailer (const char *input, const char *trailer)
   size_t trail_len = strlen (trailer);
 
   SELF_CHECK (len >= trail_len
-             && strcmp (result.get () + len - trail_len, trailer) == 0);
+             && streq (result.get () + len - trail_len, trailer));
 }
 
 static void
@@ -3383,9 +3383,9 @@ gdb_argv_as_array_view_test ()
     gdb::array_view<char *> view = argv.as_array_view ();
 
     SELF_CHECK (view.size () == 3);
-    SELF_CHECK (strcmp (view[0], "une") == 0);
-    SELF_CHECK (strcmp (view[1], "bonne") == 0);
-    SELF_CHECK (strcmp (view[2], "50") == 0);
+    SELF_CHECK (streq (view[0], "une"));
+    SELF_CHECK (streq (view[1], "bonne"));
+    SELF_CHECK (streq (view[2], "50"));
   }
 }
 
index 494ed9aaa9856ee5a777885de54cfed901ab6af3..a5f16dc88f0ab813760a552b3a4e5f79194269ba 100644 (file)
@@ -212,10 +212,10 @@ value_cast_structs (struct type *type, struct value *v2)
               || t2->code () == TYPE_CODE_UNION)
              && !!"Precondition is that value is of STRUCT or UNION kind");
 
-  if (t1->name () != NULL
-      && t2->name () != NULL
-      && !strcmp (t1->name (), t2->name ()))
-    return NULL;
+  if (t1->name () != nullptr
+      && t2->name () != nullptr
+      && streq (t1->name (), t2->name ()))
+    return nullptr;
 
   /* Upcasting: look in the type of the source to see if it contains the
      type of the target as a superclass.  If so, we'll need to
@@ -248,7 +248,7 @@ value_cast_structs (struct type *type, struct value *v2)
          /* We might be trying to cast to the outermost enclosing
             type, in which case search_struct_field won't work.  */
          if (real_type->name () != NULL
-             && !strcmp (real_type->name (), t1->name ()))
+             && streq (real_type->name (), t1->name ()))
            return v;
 
          v = search_struct_field (t2->name (), v, real_type, 1);
@@ -2877,7 +2877,7 @@ find_overload_match (gdb::array_view<value *> args,
                 probably a C-style function.  */
              if (temp_func != nullptr)
                {
-                 if (strcmp (temp_func.get (), qualified_name) == 0)
+                 if (streq (temp_func.get (), qualified_name))
                    func_name = NULL;
                  else
                    func_name = temp_func.get ();
@@ -3402,7 +3402,7 @@ enum_constant_from_type (struct type *type, const char *name)
       if (len + 2 >= name_len
          && fname[len - name_len - 2] == ':'
          && fname[len - name_len - 1] == ':'
-         && strcmp (&fname[len - name_len], name) == 0)
+         && streq (&fname[len - name_len], name))
        return value_from_longest (type, type->field (i).loc_enumval ());
     }
 
@@ -3562,7 +3562,7 @@ value_struct_elt_for_reference (struct type *domain, int offset,
     {
       const char *t_field_name = t->field (i).name ();
 
-      if (t_field_name && strcmp (t_field_name, name) == 0)
+      if (t_field_name && streq (t_field_name, name))
        {
          if (t->field (i).is_static ())
            {
@@ -3639,7 +3639,7 @@ value_struct_elt_for_reference (struct type *domain, int offset,
     {
       const char *t_field_name = TYPE_FN_FIELDLIST_NAME (t, i);
 
-      if (t_field_name && strcmp (t_field_name, name) == 0)
+      if (t_field_name && streq (t_field_name, name))
        {
          int j;
          int len = TYPE_FN_FIELDLIST_LENGTH (t, i);
index 6a0ba6c93ab8ab2e3a2b674e48d8e42ba679ef2f..edd94ea49630c0eda7eace7a1b54f643edc155a3 100644 (file)
@@ -2181,7 +2181,7 @@ varobj_value_get_print_value (struct value *value,
                            = gdbpy_get_display_hint (value_formatter);
                          if (hint)
                            {
-                             if (!strcmp (hint.get (), "string"))
+                             if (streq (hint.get (), "string"))
                                string_print = true;
                            }
 
index a79d1b5e02e948dceb45546123413133112d5511..38ee1d7275e8c16592342b9c16f40a6635edb2d6 100644 (file)
@@ -1378,10 +1378,10 @@ cygwin_sigwrapper_frame_unwind::sniff (const frame_info_ptr &this_frame,
   if (name == nullptr)
     return 0;
 
-  if (strcmp (name, "_sigbe") != 0
-      && strcmp (name, "__sigbe") != 0
-      && strcmp (name, "sigdelayed") != 0
-      && strcmp (name, "_sigdelayed") != 0)
+  if (!streq (name, "_sigbe")
+      && !streq (name, "__sigbe")
+      && !streq (name, "sigdelayed")
+      && !streq (name, "_sigdelayed"))
     return 0;
 
   frame_debug_printf ("name=%s, start=%s, end=%s",
index aa7b1213482f1a40a026463237d2f1dc15781fba..1f34a6a0ffbdb88b2ca61f1917e72a8bf2f4d676 100644 (file)
@@ -51,7 +51,7 @@ x86_is_thunk_register_name (const char *name, const char * const *names,
 {
   int reg;
   for (reg = lo; reg < hi; ++reg)
-    if (strcmp (name, names[reg]) == 0)
+    if (streq (name, names[reg]))
       return true;
 
   return false;
@@ -72,7 +72,7 @@ x86_in_indirect_branch_thunk (CORE_ADDR pc, const char * const *register_names,
     return false;
 
   /* Check the indirect return thunk first.  */
-  if (strcmp (name, "__x86_return_thunk") == 0)
+  if (streq (name, "__x86_return_thunk"))
     return true;
 
   /* Then check a family of indirect call/jump thunks.  */
index aec959e1375182e4519c771c2748e26538e891cd..b3d9bb97b6213be8c4d1365a39eec03df32e44fe 100644 (file)
@@ -262,20 +262,17 @@ xcoff_symfile_offsets (objfile *objfile, const section_addr_info &addrs)
   const char *first_section_name
     = bfd_section_name (objfile->sections_start[0].the_bfd_section);
 
-  if (objfile->sect_index_text == 0
-      && strcmp (first_section_name, ".text") != 0)
+  if (objfile->sect_index_text == 0 && !streq (first_section_name, ".text"))
     objfile->sect_index_text = -1;
 
-  if (objfile->sect_index_data == 0
-      && strcmp (first_section_name, ".data") != 0)
+  if (objfile->sect_index_data == 0 && !streq (first_section_name, ".data"))
     objfile->sect_index_data = -1;
 
-  if (objfile->sect_index_bss == 0
-      && strcmp (first_section_name, ".bss") != 0)
+  if (objfile->sect_index_bss == 0 && !streq (first_section_name, ".bss"))
     objfile->sect_index_bss = -1;
 
   if (objfile->sect_index_rodata == 0
-      && strcmp (first_section_name, ".rodata") != 0)
+      && !streq (first_section_name, ".rodata"))
     objfile->sect_index_rodata = -1;
 }
 
index 76ce84122fb3d07c998e757ee1be78f8f96ca98c..a538c16f926c8c72319ab2e7feda47bccc15f4c3 100644 (file)
@@ -229,7 +229,7 @@ xml_find_attribute (std::vector<gdb_xml_value> &attributes,
                    const char *name)
 {
   for (gdb_xml_value &value : attributes)
-    if (strcmp (value.name, name) == 0)
+    if (streq (value.name, name))
       return &value;
 
   return NULL;
@@ -270,7 +270,7 @@ gdb_xml_parser::start_element (const XML_Char *name,
   seen = 1;
   for (element = scope.elements; element && element->name;
        element++, seen <<= 1)
-    if (strcmp (element->name, name) == 0)
+    if (streq (element->name, name))
       break;
 
   if (element == NULL || element->name == NULL)
@@ -307,7 +307,7 @@ gdb_xml_parser::start_element (const XML_Char *name,
       void *parsed_value;
 
       for (p = attrs; *p != NULL; p += 2)
-       if (!strcmp (attribute->name, p[0]))
+       if (streq (attribute->name, p[0]))
          {
            val = p[1];
            break;
@@ -352,7 +352,7 @@ gdb_xml_parser::start_element (const XML_Char *name,
          for (attribute = element->attributes;
               attribute != NULL && attribute->name != NULL;
               attribute++)
-           if (strcmp (attribute->name, *p) == 0)
+           if (streq (attribute->name, *p))
              break;
 
          if (attribute == NULL || attribute->name == NULL)
@@ -914,7 +914,7 @@ fetch_xml_builtin (const char *filename)
   const char *const (*p)[2];
 
   for (p = xml_builtin; (*p)[0]; p++)
-    if (strcmp ((*p)[0], filename) == 0)
+    if (streq ((*p)[0], filename))
       return (*p)[1];
 
   return NULL;
index c169e8c1b211daf1b08f1d3981dde0496b0a5ebf..56fb7cff57a0e72242c2a71d9dd929464ca7b21a 100644 (file)
@@ -244,13 +244,13 @@ syscall_start_syscall (struct gdb_xml_parser *parser,
 
   for (const gdb_xml_value &attr : attributes)
     {
-      if (strcmp (attr.name, "name") == 0)
+      if (streq (attr.name, "name"))
        name = (char *) attr.value.get ();
-      else if (strcmp (attr.name, "number") == 0)
+      else if (streq (attr.name, "number"))
        number = * (ULONGEST *) attr.value.get ();
-      else if (strcmp (attr.name, "alias") == 0)
+      else if (streq (attr.name, "alias"))
        alias = (char *) attr.value.get ();
-      else if (strcmp (attr.name, "groups") == 0)
+      else if (streq (attr.name, "groups"))
        groups = (char *) attr.value.get ();
       else
        internal_error (_("Unknown attribute name '%s'."), attr.name);
index 472c604254a84d13b0924a93af941378c6851d1b..c0b1b6353157cfe99ff68bc3cbde17b8d4d2e3e5 100644 (file)
@@ -147,7 +147,7 @@ tdesc_start_target (struct gdb_xml_parser *parser,
   char *version
     = (char *) xml_find_attribute (attributes, "version")->value.get ();
 
-  if (strcmp (version, "1.0") != 0)
+  if (!streq (version, "1.0"))
     gdb_xml_error (parser,
                   _("Target description has unsupported version \"%s\""),
                   version);
@@ -185,28 +185,27 @@ tdesc_start_reg (struct gdb_xml_parser *parser,
   name = (char *) attributes[ix++].value.get ();
   bitsize = * (ULONGEST *) attributes[ix++].value.get ();
 
-  if (ix < length && strcmp (attributes[ix].name, "regnum") == 0)
+  if (ix < length && streq (attributes[ix].name, "regnum"))
     regnum = * (ULONGEST *) attributes[ix++].value.get ();
   else
     regnum = data->next_regnum;
 
-  if (ix < length && strcmp (attributes[ix].name, "type") == 0)
+  if (ix < length && streq (attributes[ix].name, "type"))
     type = (char *) attributes[ix++].value.get ();
   else
     type = "int";
 
-  if (ix < length && strcmp (attributes[ix].name, "group") == 0)
+  if (ix < length && streq (attributes[ix].name, "group"))
     group = (char *) attributes[ix++].value.get ();
   else
     group = NULL;
 
-  if (ix < length && strcmp (attributes[ix].name, "save-restore") == 0)
+  if (ix < length && streq (attributes[ix].name, "save-restore"))
     save_restore = * (ULONGEST *) attributes[ix++].value.get ();
   else
     save_restore = 1;
 
-  if (strcmp (type, "int") != 0
-      && strcmp (type, "float") != 0
+  if (!streq (type, "int") && !streq (type, "float")
       && tdesc_named_type (data->current_feature, type) == NULL)
     gdb_xml_error (parser, _("Register \"%s\" has unknown type \"%s\""),
                   name, type);
@@ -381,8 +380,8 @@ tdesc_start_field (struct gdb_xml_parser *parser,
        gdb_xml_error (parser,
                       _("Bitfields must live in explicitly sized types"));
 
-      if (field_type_id != NULL
-         && strcmp (field_type_id, "bool") == 0
+      if (field_type_id != nullptr
+         && streq (field_type_id, "bool")
          && start != end)
        {
          gdb_xml_error (parser,
index 1916b8cfdfe42611063e3a0abdc8c906dd563085..20cb849f1f1d1f83adb5c5c85adcb5170ec40def 100644 (file)
@@ -515,7 +515,7 @@ xstormy16_resolve_jmp_table_entry (struct gdbarch *gdbarch, CORE_ADDR faddr)
       gdb_byte buf[2 * xstormy16_inst_size];
 
       /* Return faddr if it's not pointing into the jump table.  */
-      if (strcmp (faddr_sect->the_bfd_section->name, ".plt"))
+      if (!streq (faddr_sect->the_bfd_section->name, ".plt"))
        return faddr;
 
       if (!target_read_memory (faddr, buf, sizeof buf))
@@ -543,12 +543,12 @@ xstormy16_find_jmp_table_entry (struct gdbarch *gdbarch, CORE_ADDR faddr)
   if (faddr_sect)
     {
       /* Return faddr if it's already a pointer to a jump table entry.  */
-      if (!strcmp (faddr_sect->the_bfd_section->name, ".plt"))
+      if (streq (faddr_sect->the_bfd_section->name, ".plt"))
        return faddr;
 
       for (obj_section &osect : faddr_sect->objfile->sections ())
        {
-         if (!strcmp (osect.the_bfd_section->name, ".plt"))
+         if (streq (osect.the_bfd_section->name, ".plt"))
            {
              CORE_ADDR addr, endaddr;
 
index d2cf3977359a06ceebc2871cffa121e2f2d43a0c..50ad3be34b0fdbb3651eae8bd989def466537a8d 100644 (file)
@@ -109,7 +109,7 @@ static void
 remote_open (const char *name)
 {
 #ifndef USE_WIN32API
-  if (strcmp (name, "-") == 0)
+  if (streq (name, "-"))
     {
       remote_desc_in = 0;
       remote_desc_out = 1;
index f3ccbbc6142714ae9d43a20bf3ca587248b89f44..9c56af36fec78c50ff29866f146c5951b229fc4a 100644 (file)
@@ -299,7 +299,7 @@ is_reg_name_available_p (const struct target_desc *tdesc,
                         const char *name)
 {
   for (const gdb::reg &reg : tdesc->reg_defs)
-    if (strcmp (name, reg.name) == 0)
+    if (streq (name, reg.name))
       return true;
   return false;
 }
index ca20a5bca1689af5ffdd9d72ea111154a49ea0f8..0246217db86c9ffc16d3bcd2ca32db486cfcf282 100644 (file)
@@ -6146,9 +6146,9 @@ linux_process_target::read_loadmap (const char *annex, CORE_ADDR offset,
   struct target_loadmap *data = NULL;
   unsigned int actual_length, copy_length;
 
-  if (strcmp (annex, "exec") == 0)
+  if (streq (annex, "exec"))
     addr = (int) LINUX_LOADMAP_EXEC;
-  else if (strcmp (annex, "interp") == 0)
+  else if (streq (annex, "interp"))
     addr = (int) LINUX_LOADMAP_INTERP;
   else
     return -1;
index cc7c05da30749ea9ef8bc3697166acc90cf923e9..28a3d78f747bdf767f51e9d0dc5faf6deb0595ac 100644 (file)
@@ -1084,7 +1084,7 @@ x86_target::process_qsupported (gdb::array_view<const char * const> features)
               p != NULL;
               p = strtok_r (NULL, ",", &saveptr))
            {
-             if (strcmp (p, "i386") == 0)
+             if (streq (p, "i386"))
                {
                  use_xml = 1;
                  break;
index e405612be9850fb8cc29d3ab64b532aaf0f2706d..1ff6936ff28721b9009f489b43c672112ec56749 100644 (file)
@@ -33,8 +33,7 @@ x86_linux_post_init_tdesc (target_desc *tdesc, bool is_64bit)
      However, init_target_desc requires us to override the already set
      value.  That's fine, out new string should match the old one.  */
   gdb_assert (tdesc_osabi_name (tdesc) != nullptr);
-  gdb_assert (strcmp (tdesc_osabi_name (tdesc),
-                     gdbarch_osabi_name (osabi)) == 0);
+  gdb_assert (streq (tdesc_osabi_name (tdesc), gdbarch_osabi_name (osabi)));
 #endif /* ! IN_PROCESS_AGENT */
 
 #ifdef __x86_64__
index f50c77275db8276051369d7d90da16e04b4292d7..4ace68869e50168652870b6ca37eb079f7e79c37 100644 (file)
@@ -221,7 +221,7 @@ find_regno_no_throw (const struct target_desc *tdesc, const char *name)
 {
   for (int i = 0; i < tdesc->reg_defs.size (); ++i)
     {
-      if (strcmp (name, find_register_by_number (tdesc, i).name) == 0)
+      if (streq (name, find_register_by_number (tdesc, i).name))
        return i;
     }
   return {};
index 7671206ebc1a67dfffbd6622fc40287d71b8c924..34801d0b76fec7967a9d40ebe0e5e9df7c3e2635 100644 (file)
@@ -221,7 +221,7 @@ remote_prepare (const char *name)
   socklen_t tmp;
 
   remote_is_stdio = 0;
-  if (strcmp (name, STDIO_CONNECTION_NAME) == 0)
+  if (streq (name, STDIO_CONNECTION_NAME))
     {
       /* We need to record fact that we're using stdio sooner than the
         call to remote_open so start_inferior knows the connection is
@@ -322,7 +322,7 @@ remote_open (const char *name)
     error ("Only HOST:PORT is supported on this platform.");
 #endif
 
-  if (strcmp (name, STDIO_CONNECTION_NAME) == 0)
+  if (streq (name, STDIO_CONNECTION_NAME))
     {
       fprintf (stderr, "Remote debugging using stdio\n");
 
@@ -1508,7 +1508,7 @@ look_up_one_symbol (const char *name, CORE_ADDR *addrp, int may_ask_gdb)
 
   /* Check the cache first.  */
   for (sym = proc->symbol_cache; sym; sym = sym->next)
-    if (strcmp (name, sym->name) == 0)
+    if (streq (name, sym->name))
       {
        *addrp = sym->addr;
        return 1;
index 793af6354087f9e146feaf32805105e28ef26ddd..ebde831d6031d658774256fc25d169ee56570968 100644 (file)
@@ -467,11 +467,11 @@ handle_btrace_general_set (char *own_buf)
 
   try
     {
-      if (strcmp (op, "bts") == 0)
+      if (streq (op, "bts"))
        handle_btrace_enable_bts (thread);
-      else if (strcmp (op, "pt") == 0)
+      else if (streq (op, "pt"))
        handle_btrace_enable_pt (thread);
-      else if (strcmp (op, "off") == 0)
+      else if (streq (op, "off"))
        handle_btrace_disable (thread);
       else
        error (_("Bad Qbtrace operation.  Use bts, pt, or off."));
@@ -720,7 +720,7 @@ handle_general_set (char *own_buf)
          return;
        }
 
-      if (strcmp (p, "0") == 0)
+      if (streq (p, "0"))
        enabled = 0;
       else if (p[0] == '1' && (p[1] == ';' || p[1] == '\0'))
        enabled = 1;
@@ -755,7 +755,7 @@ handle_general_set (char *own_buf)
       return;
     }
 
-  if (strcmp (own_buf, "QEnvironmentReset") == 0)
+  if (streq (own_buf, "QEnvironmentReset"))
     {
       our_environ = gdb_environ::from_host_environ ();
 
@@ -808,7 +808,7 @@ handle_general_set (char *own_buf)
       return;
     }
 
-  if (strcmp (own_buf, "QStartNoAckMode") == 0)
+  if (streq (own_buf, "QStartNoAckMode"))
     {
       remote_debug_printf ("[noack mode enabled]");
 
@@ -823,9 +823,9 @@ handle_general_set (char *own_buf)
       int req = -1;
       const char *req_str;
 
-      if (strcmp (mode, "0") == 0)
+      if (streq (mode, "0"))
        req = 0;
-      else if (strcmp (mode, "1") == 0)
+      else if (streq (mode, "1"))
        req = 1;
       else
        {
@@ -878,9 +878,9 @@ handle_general_set (char *own_buf)
       char *mode = own_buf + strlen ("QAgent:");
       int req = 0;
 
-      if (strcmp (mode, "0") == 0)
+      if (streq (mode, "0"))
        req = 0;
-      else if (strcmp (mode, "1") == 0)
+      else if (streq (mode, "1"))
        req = 1;
       else
        {
@@ -907,9 +907,9 @@ handle_general_set (char *own_buf)
       char *mode = own_buf + strlen ("QThreadEvents:");
       enum tribool req = TRIBOOL_UNKNOWN;
 
-      if (strcmp (mode, "0") == 0)
+      if (streq (mode, "0"))
        req = TRIBOOL_FALSE;
-      else if (strcmp (mode, "1") == 0)
+      else if (streq (mode, "1"))
        req = TRIBOOL_TRUE;
       else
        {
@@ -1037,9 +1037,9 @@ handle_general_set (char *own_buf)
     {
       const char *value = own_buf + strlen ("QStartupWithShell:");
 
-      if (strcmp (value, "1") == 0)
+      if (streq (value, "1"))
        startup_with_shell = true;
-      else if (strcmp (value, "0") == 0)
+      else if (streq (value, "0"))
        startup_with_shell = false;
       else
        {
@@ -1128,7 +1128,7 @@ get_features_xml (const char *annex)
      This variable is set up from the auto-generated
      init_registers_... routine for the current target.  */
 
-  if (strcmp (annex, "target.xml") == 0)
+  if (streq (annex, "target.xml"))
     {
       const char *ret = tdesc_get_features_xml (desc);
 
@@ -1144,7 +1144,7 @@ get_features_xml (const char *annex)
 
     /* Look for the annex.  */
     for (i = 0; xml_builtin[i][0] != NULL; i++)
-      if (strcmp (annex, xml_builtin[i][0]) == 0)
+      if (streq (annex, xml_builtin[i][0]))
        break;
 
     if (xml_builtin[i][0] != NULL)
@@ -1433,19 +1433,19 @@ parse_debug_format_options (const char *arg, int is_monitor)
 
   for (const gdb::unique_xmalloc_ptr<char> &option : options)
     {
-      if (strcmp (option.get (), "all") == 0)
+      if (streq (option.get (), "all"))
        {
          debug_timestamp = 1;
          if (is_monitor)
            monitor_output ("All extra debug format options enabled.\n");
        }
-      else if (strcmp (option.get (), "none") == 0)
+      else if (streq (option.get (), "none"))
        {
          debug_timestamp = 0;
          if (is_monitor)
            monitor_output ("All extra debug format options disabled.\n");
        }
-      else if (strcmp (option.get (), "timestamp") == 0)
+      else if (streq (option.get (), "timestamp"))
        {
          debug_timestamp = 1;
          if (is_monitor)
@@ -1727,12 +1727,12 @@ handle_monitor_command (const char *mon, char *own_buf)
          write_enn (own_buf);
        }
     }
-  else if (strcmp (mon, "set debug-hw-points 1") == 0)
+  else if (streq (mon, "set debug-hw-points 1"))
     {
       show_debug_regs = 1;
       monitor_output ("H/W point debugging output enabled.\n");
     }
-  else if (strcmp (mon, "set debug-hw-points 0") == 0)
+  else if (streq (mon, "set debug-hw-points 0"))
     {
       show_debug_regs = 0;
       monitor_output ("H/W point debugging output disabled.\n");
@@ -1750,13 +1750,13 @@ handle_monitor_command (const char *mon, char *own_buf)
          write_enn (own_buf);
        }
     }
-  else if (strcmp (mon, "set debug-file") == 0)
+  else if (streq (mon, "set debug-file"))
     debug_set_output (nullptr);
   else if (startswith (mon, "set debug-file "))
     debug_set_output (mon + sizeof ("set debug-file ") - 1);
-  else if (strcmp (mon, "help") == 0)
+  else if (streq (mon, "help"))
     monitor_show_help ();
-  else if (strcmp (mon, "exit") == 0)
+  else if (streq (mon, "exit"))
     exit_requested = true;
   else
     {
@@ -2179,11 +2179,11 @@ handle_qxfer_btrace (const char *annex,
       return -3;
     }
 
-  if (strcmp (annex, "all") == 0)
+  if (streq (annex, "all"))
     type = BTRACE_READ_ALL;
-  else if (strcmp (annex, "new") == 0)
+  else if (streq (annex, "new"))
     type = BTRACE_READ_NEW;
-  else if (strcmp (annex, "delta") == 0)
+  else if (streq (annex, "delta"))
     type = BTRACE_READ_DELTA;
   else
     {
@@ -2336,9 +2336,9 @@ handle_qxfer (char *own_buf, int packet_len, int *new_packet_len_p)
     {
       const struct qxfer *q = &qxfer_packets[i];
 
-      if (strcmp (object, q->object) == 0)
+      if (streq (object, q->object))
        {
-         if (strcmp (rw, "read") == 0)
+         if (streq (rw, "read"))
            {
              unsigned char *data;
              int n;
@@ -2382,7 +2382,7 @@ handle_qxfer (char *own_buf, int packet_len, int *new_packet_len_p)
              free (data);
              return 1;
            }
-         else if (strcmp (rw, "write") == 0)
+         else if (streq (rw, "write"))
            {
              int n;
              unsigned int len;
@@ -2538,7 +2538,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
     };
 
   /* Reply the current thread id.  */
-  if (strcmp ("qC", own_buf) == 0 && !disable_packet_qC)
+  if (streq ("qC", own_buf) && !disable_packet_qC)
     {
       ptid_t ptid;
       require_running_or_return (own_buf);
@@ -2557,7 +2557,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
       return;
     }
 
-  if (strcmp ("qSymbol::", own_buf) == 0)
+  if (streq ("qSymbol::", own_buf))
     {
       scoped_restore_current_thread restore_thread;
 
@@ -2605,7 +2605,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
 
   if (!disable_packet_qfThreadInfo)
     {
-      if (strcmp ("qfThreadInfo", own_buf) == 0)
+      if (streq ("qfThreadInfo", own_buf))
        {
          require_running_or_return (own_buf);
          init_thread_iter ();
@@ -2617,7 +2617,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
          return;
        }
 
-      if (strcmp ("qsThreadInfo", own_buf) == 0)
+      if (streq ("qsThreadInfo", own_buf))
        {
          require_running_or_return (own_buf);
          /* We're done if the process iterator hits the end of the
@@ -2638,8 +2638,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
        }
     }
 
-  if (the_target->supports_read_offsets ()
-      && strcmp ("qOffsets", own_buf) == 0)
+  if (the_target->supports_read_offsets () && streq ("qOffsets", own_buf))
     {
       CORE_ADDR text, data;
 
@@ -3010,8 +3009,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
       return;
     }
 
-  if (strcmp (own_buf, "qAttached") == 0
-      || startswith (own_buf, "qAttached:"))
+  if (streq (own_buf, "qAttached") || startswith (own_buf, "qAttached:"))
     {
       struct process_info *process;
 
@@ -3094,7 +3092,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
       return;
     }
 
-  if (strcmp ("qExecAndArgs", own_buf) == 0)
+  if (streq ("qExecAndArgs", own_buf))
     {
       if (program_path.get () == nullptr)
        sprintf (own_buf, "U");
@@ -3568,7 +3566,7 @@ handle_v_requests (char *own_buf, int packet_len, int *new_packet_len)
   client_state &cs = get_client_state ();
   if (!disable_packet_vCont)
     {
-      if (strcmp (own_buf, "vCtrlC") == 0)
+      if (streq (own_buf, "vCtrlC"))
        {
          the_target->request_interrupt ();
          write_ok (own_buf);
@@ -4100,7 +4098,7 @@ test_memory_tagging_functions (void)
 
   expected = "m0001020304";
   SELF_CHECK (create_fetch_memtags_reply (packet.data (), bv) == true);
-  SELF_CHECK (strcmp (packet.data (), expected.c_str ()) == 0);
+  SELF_CHECK (streq (packet.data (), expected.c_str ()));
 
   /* Test parsing a QMemTags request.  */
 
@@ -4269,8 +4267,8 @@ captured_main (int argc, char *argv[])
            gdb_assert (optarg != nullptr);
 
          if (optarg == nullptr
-             || strcmp (optarg, "-") == 0
-             || strcmp (optarg, STDIO_CONNECTION_NAME) == 0
+             || streq (optarg, "-")
+             || streq (optarg, STDIO_CONNECTION_NAME)
              || startswith (optarg, "--")
              || strchr (optarg, ':') != nullptr)
            {
@@ -4310,8 +4308,7 @@ captured_main (int argc, char *argv[])
          {
            int original_optind = optind;
 
-           while (argv[optind] != nullptr
-                  && strcmp (argv[optind], "--") != 0)
+           while (argv[optind] != nullptr && !streq (argv[optind], "--"))
              {
                wrapper_argv += argv[optind];
                wrapper_argv += ' ';
@@ -4385,19 +4382,19 @@ captured_main (int argc, char *argv[])
                 tok != nullptr;
                 tok = strtok_r (nullptr, ",", &saveptr))
              {
-               if (strcmp ("vCont", tok) == 0)
+               if (streq ("vCont", tok))
                  disable_packet_vCont = true;
-               else if (strcmp ("vConts", tok) == 0)
+               else if (streq ("vConts", tok))
                  disable_packet_vCont_step = true;
-               else if (strcmp ("Tthread", tok) == 0)
+               else if (streq ("Tthread", tok))
                  disable_packet_Tthread = true;
-               else if (strcmp ("qC", tok) == 0)
+               else if (streq ("qC", tok))
                  disable_packet_qC = true;
-               else if (strcmp ("qfThreadInfo", tok) == 0)
+               else if (streq ("qfThreadInfo", tok))
                  disable_packet_qfThreadInfo = true;
-               else if (strcmp ("T", tok) == 0)
+               else if (streq ("T", tok))
                  disable_packet_T = true;
-               else if (strcmp ("threads", tok) == 0)
+               else if (streq ("threads", tok))
                  {
                    disable_packet_vCont = true;
                    disable_packet_Tthread = true;
@@ -4495,7 +4492,7 @@ captured_main (int argc, char *argv[])
 
   const char *port = argv[optind];
   ++optind;
-  if (port != nullptr && strcmp (port, "-") == 0)
+  if (port != nullptr && streq (port, "-"))
     {
       port = STDIO_CONNECTION_NAME;
 
@@ -4529,7 +4526,7 @@ captured_main (int argc, char *argv[])
 
   /* --attach used to come after PORT, so allow it there for
        compatibility.  */
-  if (*next_arg != NULL && strcmp (*next_arg, "--attach") == 0)
+  if (*next_arg != NULL && streq (*next_arg, "--attach"))
     {
       attach = true;
       next_arg++;
index 7f29788d7d79325af95c2c6606fae81051fdea87..0bdcda2ced8bb6073b399d3ddc92f0b3853647ae 100644 (file)
@@ -696,7 +696,7 @@ thread_db_load_search (void)
             where libpthread lives.  We *could* fetch the info, but we don't
             do that yet.  Ignore it.  */
        }
-      else if (strcmp (this_dir, "$sdir") == 0)
+      else if (streq (this_dir, "$sdir"))
        {
          if (try_thread_db_load_from_sdir ())
            {
index 9bedd13567a345fd6a6762d82544256cada60040..25a3e8ceadfe3fe701c2fa1d52ac5278593ac6dd 100644 (file)
@@ -2497,7 +2497,7 @@ cmd_qtdp (char *own_buf)
          if (tpoint->type == trap_tracepoint || tp == NULL)
            {
              install_tracepoint (tpoint, own_buf);
-             if (strcmp (own_buf, "OK") != 0)
+             if (!streq (own_buf, "OK"))
                remove_tracepoint (tpoint);
            }
          else
@@ -2685,7 +2685,7 @@ cmd_qtv (char *own_buf)
   /* Only make tsv's be undefined before the first trace run.  After a
      trace run is over, the user might want to see the last value of
      the tsv, and it might not be available in a traceframe.  */
-  else if (!tracing && strcmp (tracing_stop_reason, "tnotrun") == 0)
+  else if (!tracing && streq (tracing_stop_reason, "tnotrun"))
     {
       strcpy (own_buf, "U");
       return;
@@ -3438,7 +3438,7 @@ cmd_qtstatus (char *packet)
     }
 
   /* If this was a forced stop, include any stop note that was supplied.  */
-  if (strcmp (stop_reason_rsp, "tstop") == 0)
+  if (streq (stop_reason_rsp, "tstop"))
     {
       stop_reason_rsp = (char *) alloca (strlen ("tstop:") + strlen (buf3) + 1);
       strcpy (stop_reason_rsp, "tstop:");
@@ -3803,7 +3803,7 @@ cmd_bigqtbuffer_size (char *own_buf)
   packet += strlen ("QTBuffer:size:");
 
   /* -1 is sent as literal "-1".  */
-  if (strcmp (packet, "-1") == 0)
+  if (streq (packet, "-1"))
     sval = DEFAULT_TRACE_BUFFER_SIZE;
   else
     {
@@ -3880,7 +3880,7 @@ cmd_qtnotes (char *own_buf)
 int
 handle_tracepoint_general_set (char *packet)
 {
-  if (strcmp ("QTinit", packet) == 0)
+  if (streq ("QTinit", packet))
     {
       cmd_qtinit (packet);
       return 1;
@@ -3915,12 +3915,12 @@ handle_tracepoint_general_set (char *packet)
       cmd_qtro (packet);
       return 1;
     }
-  else if (strcmp ("QTStart", packet) == 0)
+  else if (streq ("QTStart", packet))
     {
       cmd_qtstart (packet);
       return 1;
     }
-  else if (strcmp ("QTStop", packet) == 0)
+  else if (streq ("QTStop", packet))
     {
       cmd_qtstop (packet);
       return 1;
@@ -3957,7 +3957,7 @@ handle_tracepoint_general_set (char *packet)
 int
 handle_tracepoint_query (char *packet)
 {
-  if (strcmp ("qTStatus", packet) == 0)
+  if (streq ("qTStatus", packet))
     {
       cmd_qtstatus (packet);
       return 1;
@@ -3967,22 +3967,22 @@ handle_tracepoint_query (char *packet)
       cmd_qtp (packet);
       return 1;
     }
-  else if (strcmp ("qTfP", packet) == 0)
+  else if (streq ("qTfP", packet))
     {
       cmd_qtfp (packet);
       return 1;
     }
-  else if (strcmp ("qTsP", packet) == 0)
+  else if (streq ("qTsP", packet))
     {
       cmd_qtsp (packet);
       return 1;
     }
-  else if (strcmp ("qTfV", packet) == 0)
+  else if (streq ("qTfV", packet))
     {
       cmd_qtfv (packet);
       return 1;
     }
-  else if (strcmp ("qTsV", packet) == 0)
+  else if (streq ("qTsV", packet))
     {
       cmd_qtsv (packet);
       return 1;
@@ -3997,7 +3997,7 @@ handle_tracepoint_query (char *packet)
       cmd_qtbuffer (packet);
       return 1;
     }
-  else if (strcmp ("qTMinFTPILen", packet) == 0)
+  else if (streq ("qTMinFTPILen", packet))
     {
       cmd_qtminftpilen (packet);
       return 1;
index b34f44a66087f3ce68073e1a20d57ddd5b1bbc68..040419e30df9759d0ccd2bb4482e40275f48a351 100644 (file)
@@ -179,7 +179,7 @@ struct gdb_exception
 
     return (reason == other.reason
            && error == other.error
-           && strcmp (msg1, msg2) == 0);
+           && streq (msg1, msg2));
   }
 
   /* Compare two exceptions.  */
index d91bbcdb7ec32f904d2833d6080b8d1ad3ba7927..806a15997dce1dee91469da6e51fb700ecea79a0 100644 (file)
@@ -71,7 +71,7 @@ osabi_from_tdesc_string (const char *name)
   int i;
 
   for (i = 0; i < ARRAY_SIZE (gdb_osabi_names); i++)
-    if (strcmp (name, gdb_osabi_names[i].pretty) == 0)
+    if (streq (name, gdb_osabi_names[i].pretty))
       {
        /* See note above: the name table matches the indices assigned
           to enum gdb_osabi.  */
index eb321805c6d39f02fabd5b44840be952b8d6fe40..367ca571f3dbcd1b61a5aff320e0376986ef703c 100644 (file)
@@ -98,8 +98,7 @@ gdb_signal_from_name (const char *name)
   for (sig = GDB_SIGNAL_HUP;
        sig < GDB_SIGNAL_LAST;
        sig = (enum gdb_signal) ((int) sig + 1))
-    if (signals[sig].name != NULL
-       && strcmp (name, signals[sig].name) == 0)
+    if (signals[sig].name != nullptr && streq (name, signals[sig].name))
       return sig;
   return GDB_SIGNAL_UNKNOWN;
 }