sim: h8300 special case test
[deliverable/binutils-gdb.git] / gas / config / tc-tic54x.c
index 62d49d9bc8b0b011d0c48459d38f42eb4c2d116f..783c3be83e10759159c04de0c59e4e135a407993 100644 (file)
@@ -1,5 +1,5 @@
 /* tc-tic54x.c -- Assembly code for the Texas Instruments TMS320C54X
-   Copyright (C) 1999-2020 Free Software Foundation, Inc.
+   Copyright (C) 1999-2021 Free Software Foundation, Inc.
    Contributed by Timothy Wall (twall@cygnus.com)
 
    This file is part of GAS, the GNU Assembler.
@@ -551,6 +551,7 @@ stag_add_field_symbols (struct stag *stag,
   while (field != NULL)
     {
       char *name = concat (prefix, field->name, NULL);
+      char *freename = name;
 
       if (rootsym == NULL)
        {
@@ -568,6 +569,7 @@ stag_add_field_symbols (struct stag *stag,
          replacement = concat (S_GET_NAME (rootsym), "+", root_stag_name,
                                name + strlen (S_GET_NAME (rootsym)), NULL);
          str_hash_insert (subsym_hash[0], name, replacement, 0);
+         freename = NULL;
        }
 
       /* Recurse if the field is a structure.
@@ -577,7 +579,7 @@ stag_add_field_symbols (struct stag *stag,
                                field->offset,
                                rootsym, root_stag_name);
       field = field->next;
-      free (name);
+      free (freename);
     }
   free (prefix);
 }
@@ -607,7 +609,7 @@ stag_add_field (struct stag *parent,
       sf->next = sfield;
     }
   /* Only create a symbol for this field if the parent has no name.  */
-  if (!strncmp (".fake", parent->name, 5))
+  if (startswith (parent->name, ".fake"))
     {
       symbolS *sym = symbol_new (name, absolute_section, &zero_address_frag,
                                 offset);
@@ -703,7 +705,7 @@ tic54x_endstruct (int is_union)
 {
   int size;
   const char *path =
-    !strncmp (current_stag->name, ".fake", 5) ? "" : current_stag->name;
+    startswith (current_stag->name, ".fake") ? "" : current_stag->name;
 
   if (!current_stag || current_stag->is_union != is_union)
     {
@@ -2005,13 +2007,13 @@ tic54x_label (int ignored ATTRIBUTE_UNUSED)
    absolute local symbols.  */
 
 static void
-tic54x_mmregs (int ignored ATTRIBUTE_UNUSED)
+tic54x_register_mmregs (int ignored ATTRIBUTE_UNUSED)
 {
-  tic54x_symbol *sym;
+  const tic54x_symbol *sym;
 
   ILLEGAL_WITHIN_STRUCT ();
 
-  for (sym = (tic54x_symbol *) mmregs; sym->name; sym++)
+  for (sym = tic54x_mmregs; sym->name; sym++)
     {
       symbolS *symbolP = symbol_new (sym->name, absolute_section,
                                     &zero_address_frag, sym->value);
@@ -2355,7 +2357,7 @@ tic54x_mlib (int ignore ATTRIBUTE_UNUSED)
       fclose (ftmp);
       free (buf);
       input_scrub_insert_file (fname);
-      unlink (fname);
+      remove (fname);
     }
 }
 
@@ -2419,7 +2421,7 @@ const pseudo_typeS md_pseudo_table[] =
   { "mlib"     , tic54x_mlib              ,          0 },
   { "mlist"    , s_ignore                 ,          0 },
   { "mnolist"  , s_ignore                 ,          0 },
-  { "mmregs"   , tic54x_mmregs            ,          0 },
+  { "mmregs"   , tic54x_register_mmregs   ,          0 },
   { "newblock" , tic54x_clear_local_labels,          0 },
   { "option"   , s_ignore                 ,          0 },
   { "p2align"  , tic54x_p2align           ,          0 },
@@ -2963,10 +2965,10 @@ void
 md_begin (void)
 {
   insn_template *tm;
-  tic54x_symbol *sym;
+  const tic54x_symbol *sym;
   const subsym_proc_entry *subsym_proc;
   const math_proc_entry *math_proc;
-  char **symname;
+  const char **symname;
   char *TIC54X_DIR = getenv ("TIC54X_DIR");
   char *A_DIR = TIC54X_DIR ? TIC54X_DIR : getenv ("A_DIR");
 
@@ -2998,7 +3000,7 @@ md_begin (void)
     str_hash_insert (parop_hash, tm->name, tm, 0);
 
   reg_hash = str_htab_create ();
-  for (sym = (tic54x_symbol *) regs; sym->name; sym++)
+  for (sym = tic54x_regs; sym->name; sym++)
     {
       /* Add basic registers to the symbol table.  */
       symbolS *symbolP = symbol_new (sym->name, absolute_section,
@@ -3007,30 +3009,30 @@ md_begin (void)
       symbol_table_insert (symbolP);
       str_hash_insert (reg_hash, sym->name, sym, 0);
     }
-  for (sym = (tic54x_symbol *) mmregs; sym->name; sym++)
+  for (sym = tic54x_mmregs; sym->name; sym++)
     str_hash_insert (reg_hash, sym->name, sym, 0);
   mmreg_hash = str_htab_create ();
-  for (sym = (tic54x_symbol *) mmregs; sym->name; sym++)
+  for (sym = tic54x_mmregs; sym->name; sym++)
     str_hash_insert (mmreg_hash, sym->name, sym, 0);
 
   cc_hash = str_htab_create ();
-  for (sym = (tic54x_symbol *) condition_codes; sym->name; sym++)
+  for (sym = tic54x_condition_codes; sym->name; sym++)
     str_hash_insert (cc_hash, sym->name, sym, 0);
 
   cc2_hash = str_htab_create ();
-  for (sym = (tic54x_symbol *) cc2_codes; sym->name; sym++)
+  for (sym = tic54x_cc2_codes; sym->name; sym++)
     str_hash_insert (cc2_hash, sym->name, sym, 0);
 
   cc3_hash = str_htab_create ();
-  for (sym = (tic54x_symbol *) cc3_codes; sym->name; sym++)
+  for (sym = tic54x_cc3_codes; sym->name; sym++)
     str_hash_insert (cc3_hash, sym->name, sym, 0);
 
   sbit_hash = str_htab_create ();
-  for (sym = (tic54x_symbol *) status_bits; sym->name; sym++)
+  for (sym = tic54x_status_bits; sym->name; sym++)
     str_hash_insert (sbit_hash, sym->name, sym, 0);
 
   misc_symbol_hash = str_htab_create ();
-  for (symname = (char **) misc_symbols; *symname; symname++)
+  for (symname = tic54x_misc_symbols; *symname; symname++)
     str_hash_insert (misc_symbol_hash, *symname, *symname, 0);
 
   /* Only the base substitution table and local label table are initialized;
@@ -3984,7 +3986,7 @@ emit_insn (tic54x_insn *insn)
       if (insn->opcode[i].unresolved)
        fix_new_exp (frag_now, p - frag_now->fr_literal,
                     insn->opcode[i].r_nchars, &insn->opcode[i].addr_expr,
-                    FALSE, insn->opcode[i].r_type);
+                    false, insn->opcode[i].r_type);
     }
 }
 
@@ -5006,14 +5008,9 @@ tic54x_undefined_symbol (char *name)
   if ((sym = (tic54x_symbol *) str_hash_find (cc_hash, name)) != NULL
       || (sym = (tic54x_symbol *) str_hash_find (cc2_hash, name)) != NULL
       || (sym = (tic54x_symbol *) str_hash_find (cc3_hash, name)) != NULL
-      || (sym = (tic54x_symbol *) str_hash_find (misc_symbol_hash,
-                                                name)) != NULL
-      || (sym = (tic54x_symbol *) str_hash_find (sbit_hash, name)) != NULL)
-    {
-      return symbol_new (name, reg_section, &zero_address_frag, sym->value);
-    }
-
-  if ((sym = (tic54x_symbol *) str_hash_find (reg_hash, name)) != NULL
+      || str_hash_find (misc_symbol_hash, name) != NULL
+      || (sym = (tic54x_symbol *) str_hash_find (sbit_hash, name)) != NULL
+      || (sym = (tic54x_symbol *) str_hash_find (reg_hash, name)) != NULL
       || (sym = (tic54x_symbol *) str_hash_find (mmreg_hash, name)) != NULL
       || !strcasecmp (name, "a")
       || !strcasecmp (name, "b"))
@@ -5040,7 +5037,7 @@ md_atof (int type, char *literalP, int *sizeP)
 {
   /* Target data is little-endian, but floats are stored
      big-"word"ian.  ugh.  */
-  return ieee_md_atof (type, literalP, sizeP, TRUE);
+  return ieee_md_atof (type, literalP, sizeP, true);
 }
 
 arelent *
This page took 0.026997 seconds and 4 git commands to generate.