make more variables const
authorTrevor Saunders <tbsaunde+binutils@tbsaunde.org>
Sun, 20 Mar 2016 05:34:02 +0000 (01:34 -0400)
committerTrevor Saunders <tbsaunde+binutils@tbsaunde.org>
Tue, 22 Mar 2016 23:16:06 +0000 (19:16 -0400)
gas/ChangeLog:

2016-03-22  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* config/tc-h8300.c (h8300_elf_section): Add const qualifiers.
* config/tc-ia64.c (obj_elf_vms_common): Likewise.
* config/tc-m68hc11.c (md_begin): Likewise.
(print_opcode_list): Likewise.
* config/tc-msp430.c (msp430_section): Likewise.
* config/tc-score.c (struct s3_insn_to_dependency): Likewise.
(s3_build_dependency_insn_hsh): Likewise.
* config/tc-score7.c (struct s7_insn_to_dependency): Likewise.
(s7_build_dependency_insn_hsh): Likewise.
* config/tc-tic4x.c: Likewise.
* config/tc-tic54x.c (tic54x_set_default_include): Likewise.
(subsym_get_arg): Likewise.
* config/tc-xtensa.c (struct suffix_reloc_map): Likewise.
(get_directive): Likewise.
(cache_literal_section): Likewise.
* config/xtensa-relax.c: Likewise.
* symbols.c (symbol_create): Likewise.
(local_symbol_make): Likewise.
(symbol_relc_make_expr): Likewise.

include/ChangeLog:

2016-03-22  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* opcode/i960.h: Add const qualifiers.
* opcode/tic4x.h (struct tic4x_inst): Likewise.

15 files changed:
gas/ChangeLog
gas/config/tc-h8300.c
gas/config/tc-ia64.c
gas/config/tc-m68hc11.c
gas/config/tc-msp430.c
gas/config/tc-score.c
gas/config/tc-score7.c
gas/config/tc-tic4x.c
gas/config/tc-tic54x.c
gas/config/tc-xtensa.c
gas/config/xtensa-relax.c
gas/symbols.c
include/ChangeLog
include/opcode/i960.h
include/opcode/tic4x.h

index 845eacd593177bed504059b1a50be92547a414c7..78408b63e689613a49f79fb4036781d3d99c116b 100644 (file)
@@ -1,3 +1,25 @@
+2016-03-22  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>
+
+       * config/tc-h8300.c (h8300_elf_section): Add const qualifiers.
+       * config/tc-ia64.c (obj_elf_vms_common): Likewise.
+       * config/tc-m68hc11.c (md_begin): Likewise.
+       (print_opcode_list): Likewise.
+       * config/tc-msp430.c (msp430_section): Likewise.
+       * config/tc-score.c (struct s3_insn_to_dependency): Likewise.
+       (s3_build_dependency_insn_hsh): Likewise.
+       * config/tc-score7.c (struct s7_insn_to_dependency): Likewise.
+       (s7_build_dependency_insn_hsh): Likewise.
+       * config/tc-tic4x.c: Likewise.
+       * config/tc-tic54x.c (tic54x_set_default_include): Likewise.
+       (subsym_get_arg): Likewise.
+       * config/tc-xtensa.c (struct suffix_reloc_map): Likewise.
+       (get_directive): Likewise.
+       (cache_literal_section): Likewise.
+       * config/xtensa-relax.c: Likewise.
+       * symbols.c (symbol_create): Likewise.
+       (local_symbol_make): Likewise.
+       (symbol_relc_make_expr): Likewise.
+
 2016-03-22  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>
 
        * config/tc-pdp11.c (md_assemble): Remove useless if and assignment to
index 1b075c42298f47d9f3b58d6658c22601e2242afe..a620e6dd63f6133c91c850f21b126c91a70ba57f 100644 (file)
@@ -152,7 +152,7 @@ h8300_elf_section (int push)
   static const char * known_data_sections [] = { ".rodata", ".tdata", ".tbss" };
   static const char * known_data_prefixes [] = { ".debug", ".zdebug", ".gnu.warning" };
   char * saved_ilp = input_line_pointer;
-  char * name;
+  const char * name;
 
   name = obj_elf_section_name ();
   if (name == NULL)
index edb2683b8abfef2fa34103f7d33ce2f6c3ae528e..ee91ef950c62b68a5b7fecd1676b09a7634ffa8c 100644 (file)
@@ -1045,7 +1045,7 @@ ia64_cons_align (int nbytes)
 static void
 obj_elf_vms_common (int ignore ATTRIBUTE_UNUSED)
 {
-  char *sec_name;
+  const char *sec_name;
   char *sym_name;
   char c;
   offsetT size;
index 05992ef9b68e99bc2c74f5367f9af610712ef9b4..54ece5f41de9381c98a8f147552f74a0c606ec17 100644 (file)
@@ -603,7 +603,7 @@ cmp_opcode (struct m68hc11_opcode *op1, struct m68hc11_opcode *op2)
 void
 md_begin (void)
 {
-  char *prev_name = "";
+  const char *prev_name = "";
   struct m68hc11_opcode *opcodes;
   struct m68hc11_opcode_def *opc = 0;
   int i, j;
@@ -964,7 +964,7 @@ static void
 print_opcode_list (void)
 {
   int i;
-  char *prev_name = "";
+  const char *prev_name = "";
   struct m68hc11_opcode *opcodes;
   int example = flag_print_opcodes == 2;
 
index 50043628c4fb5b76dcf1bbcf1ecfad4a338a0be5..6b762c2ca2514e09a90cff605556629678d85d52 100644 (file)
@@ -1497,7 +1497,7 @@ static void
 msp430_section (int arg)
 {
   char * saved_ilp = input_line_pointer;
-  char * name = obj_elf_section_name ();
+  const char * name = obj_elf_section_name ();
 
   msp430_make_init_symbols (name);
 
index fadae49215cdceac91577fdeaa77eb2c13719268..ee195e2d37c4eb8014c42a3c752c053cbe1d46bb 100644 (file)
@@ -334,7 +334,7 @@ enum s3_insn_type_for_dependency
 
 struct s3_insn_to_dependency
 {
-  char *insn_name;
+  const char *insn_name;
   enum s3_insn_type_for_dependency type;
 };
 
@@ -6344,14 +6344,15 @@ s3_build_dependency_insn_hsh (void)
       const struct s3_insn_to_dependency *tmp = s3_insn_to_dependency_table + i;
       size_t len = strlen (tmp->insn_name);
       struct s3_insn_to_dependency *new_i2n;
+      char *buf;
 
       new_i2n = (struct s3_insn_to_dependency *)
        obstack_alloc (&dependency_obstack,
                       sizeof (struct s3_insn_to_dependency));
-      new_i2n->insn_name = (char *) obstack_alloc (&dependency_obstack,
-                                                   len + 1);
+      buf = (char *) obstack_alloc (&dependency_obstack, len + 1);
 
-      strcpy (new_i2n->insn_name, tmp->insn_name);
+      strcpy (buf, tmp->insn_name);
+      new_i2n->insn_name = buf;
       new_i2n->type = tmp->type;
       hash_insert (s3_dependency_insn_hsh, new_i2n->insn_name,
                    (void *) new_i2n);
index 6070589547a99fa492eb1d7c2b69775aa735faa9..97dfea2a41f1b11ae217de96ddc8378d8140a142 100644 (file)
@@ -191,7 +191,7 @@ enum s7_insn_type_for_dependency
 
 struct s7_insn_to_dependency
 {
-  char *insn_name;
+  const char *insn_name;
   enum s7_insn_type_for_dependency type;
 };
 
@@ -5121,14 +5121,15 @@ s7_build_dependency_insn_hsh (void)
       const struct s7_insn_to_dependency *tmp = s7_insn_to_dependency_table + i;
       size_t len = strlen (tmp->insn_name);
       struct s7_insn_to_dependency *new_i2d;
+      char *insn_name;
 
       new_i2d = (struct s7_insn_to_dependency *)
           obstack_alloc (&dependency_obstack,
                          sizeof (struct s7_insn_to_dependency));
-      new_i2d->insn_name = (char *) obstack_alloc (&dependency_obstack,
-                                                   len + 1);
+      insn_name = (char *) obstack_alloc (&dependency_obstack, len + 1);
 
-      strcpy (new_i2d->insn_name, tmp->insn_name);
+      strcpy (insn_name, tmp->insn_name);
+      new_i2d->insn_name = insn_name;
       new_i2d->type = tmp->type;
       hash_insert (s7_dependency_insn_hsh, new_i2d->insn_name,
                    (void *) new_i2d);
index 090565885b0b2f5d86d902c5b722a5daabf02b20..21e6e3662df063fff131b52eb4c423a0128dfaf9 100644 (file)
@@ -1239,7 +1239,7 @@ tic4x_inst_insert (const tic4x_inst_t *inst)
 
 /* Make a new instruction template.  */
 static tic4x_inst_t *
-tic4x_inst_make (const char *name, unsigned long opcode, char *args)
+tic4x_inst_make (const char *name, unsigned long opcode, const char *args)
 {
   static tic4x_inst_t *insts = NULL;
   static char *names = NULL;
index 1524cd3eb690523d04ae0c8cd45174adadfee4fa..d718a33967c6a942e2b10e1afe957b5f7a9e373f 100644 (file)
@@ -1865,7 +1865,7 @@ tic54x_clink (int ignored ATTRIBUTE_UNUSED)
 static void
 tic54x_set_default_include (int dot)
 {
-  char *dir = ".";
+  const char *dir = ".";
   char *tmp = NULL;
 
   if (!dot)
@@ -2906,7 +2906,7 @@ math_tanh (float arg1, float ignore ATTRIBUTE_UNUSED)
 /* Built-in substitution symbol functions and math functions.  */
 typedef struct
 {
-  char *name;
+  const char *name;
   int (*proc) (char *, char *);
   int nargs;
 } subsym_proc_entry;
@@ -2930,7 +2930,7 @@ static const subsym_proc_entry subsym_procs[] =
 
 typedef struct
 {
-  char *name;
+  const char *name;
   float (*proc) (float, float);
   int nargs;
   int int_return;
@@ -4290,7 +4290,7 @@ tic54x_parse_parallel_insn_lastline (tic54x_insn *insn, char *line)
    replacement on the value.  */
 
 static char *
-subsym_get_arg (char *line, char *terminators, char **str, int nosub)
+subsym_get_arg (char *line, const char *terminators, char **str, int nosub)
 {
   char *ptr = line;
   char *endp;
@@ -4322,7 +4322,7 @@ subsym_get_arg (char *line, char *terminators, char **str, int nosub)
     }
   else
     {
-      char *term = terminators;
+      const char *term = terminators;
       char *value = NULL;
 
       while (*ptr && *ptr != *term)
index d99513141b209b5063d4fd67fe2039dd31d1b571..180181c35c6d78c29426b9e08f13a9c5e7197e31 100644 (file)
@@ -361,7 +361,7 @@ op_placement_info_table op_placement_table;
 
 struct suffix_reloc_map
 {
-  char *suffix;
+  const char *suffix;
   int length;
   bfd_reloc_code_real_type reloc;
   unsigned char operator;
@@ -1244,7 +1244,7 @@ get_directive (directiveE *directive, bfd_boolean *negated)
 {
   int len;
   unsigned i;
-  char *directive_string;
+  const char *directive_string;
 
   if (strncmp (input_line_pointer, "no-", 3) != 0)
     *negated = FALSE;
@@ -2269,7 +2269,7 @@ xg_arg_is_constant (char *arg, offsetT *valp)
 
 
 static void
-xg_replace_opname (char **popname, char *newop)
+xg_replace_opname (char **popname, const char *newop)
 {
   free (*popname);
   *popname = (char *) xmalloc (strlen (newop) + 1);
@@ -2439,8 +2439,8 @@ xtensa_translate_old_userreg_ops (char **popname)
 
 
 static int
-xtensa_translate_zero_immed (char *old_op,
-                            char *new_op,
+xtensa_translate_zero_immed (const char *old_op,
+                            const char *new_op,
                             char **popname,
                             int *pnum_args,
                             char **arg_strings)
@@ -11518,7 +11518,8 @@ static segT
 cache_literal_section (bfd_boolean use_abs_literals)
 {
   const char *text_name, *group_name = 0;
-  char *base_name, *name, *suffix;
+  const char *base_name, *suffix;
+  char *name;
   segT *pcached;
   segT seg, current_section;
   int current_subsec;
index 41f57141ef46d21fe3f492b44f62c6d591fa1d00..a67fbe60bf2715bc03650261810273c351b124de 100644 (file)
@@ -1572,7 +1572,7 @@ transition_applies (insn_pattern *initial_insn,
 
 static bfd_boolean
 wide_branch_opcode (const char *opcode_name,
-                   char *suffix,
+                   const char *suffix,
                    xtensa_opcode *popcode)
 {
   xtensa_isa isa = xtensa_default_isa;
index 62eaf184bf1c604e5b34ed9f6f7ebb79009a7f47..c69e400fb83bbfc3adc463d3dfa3a2e92550aed3 100644 (file)
@@ -66,7 +66,7 @@ struct obstack notes;
 const char * an_external_name;
 #endif
 
-static char *save_symbol_name (const char *);
+static const char *save_symbol_name (const char *);
 static void fb_label_init (void);
 static long dollar_label_instance (long);
 static long fb_label_instance (long);
@@ -101,7 +101,7 @@ symbol_new (const char *name, segT segment, valueT valu, fragS *frag)
 /* Save a symbol name on a permanent obstack, and convert it according
    to the object file format.  */
 
-static char *
+static const char *
 save_symbol_name (const char *name)
 {
   size_t name_length;
@@ -132,7 +132,7 @@ symbol_create (const char *name, /* It is copied, the caller can destroy/modify.
               valueT valu,     /* Symbol value.  */
               fragS *frag      /* Associated fragment.  */)
 {
-  char *preserved_copy_of_name;
+  const char *preserved_copy_of_name;
   symbolS *symbolP;
 
   preserved_copy_of_name = save_symbol_name (name);
@@ -190,7 +190,7 @@ static unsigned long local_symbol_conversion_count;
 struct local_symbol *
 local_symbol_make (const char *name, segT section, valueT val, fragS *frag)
 {
-  char *name_copy;
+  const char *name_copy;
   struct local_symbol *ret;
 
   ++local_symbol_count;
@@ -3109,7 +3109,7 @@ symbol_relc_make_value (offsetT val)
 char *
 symbol_relc_make_expr (expressionS * exp)
 {
-  char * opstr = NULL; /* Operator prefix string.  */
+  const char * opstr = NULL; /* Operator prefix string.  */
   int    arity = 0;    /* Arity of this operator.  */
   char * operands[3];  /* Up to three operands.  */
   char * concat_string = NULL;
index b99c7c6fcb30bb1f82fb8c54ecfc542e87f90161..6fa9d8ba6559bfe1b64d188cfde72de21690a9cf 100644 (file)
@@ -1,3 +1,8 @@
+2016-03-22  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>
+
+       * opcode/i960.h: Add const qualifiers.
+       * opcode/tic4x.h (struct tic4x_inst): Likewise.
+
 2016-03-21  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * opcodes/arc.h (insn_class_t): Add BITOP type.
index 0904e1b338fa03b88e40881a4365c66512120cc5..be3ac1069f4551579b54bc9adca9766e5678c885 100644 (file)
 /* Description of a single i80960 instruction */
 struct i960_opcode {
        long opcode;    /* 32 bits, constant fields filled in, rest zeroed */
-       char *name;     /* Assembler mnemonic                              */
+       const char *name;       /* Assembler mnemonic                              */
        short iclass;   /* Class: see #defines below                       */
        char format;    /* REG, COBR, CTRL, MEMn, COJ, FBRA, or CALLJ      */
        char num_ops;   /* Number of operands                              */
index f95d46a6cee1705b4ff3a79e4d4e7f6a73d069f7..b4209a1deb1bcd56d09263cf7105841f2a0f4f39 100644 (file)
@@ -226,7 +226,7 @@ struct tic4x_inst
   const char *  name;
   unsigned long opcode;
   unsigned long opmask;
-  char *        args;
+  const char *        args;
   unsigned long oplevel;
 };