Convert more variables to a constant form.
authorTrevor Saunders <tbsaunde+binutils@tbsaunde.org>
Thu, 25 Feb 2016 16:55:21 +0000 (16:55 +0000)
committerNick Clifton <nickc@redhat.com>
Thu, 25 Feb 2016 16:55:21 +0000 (16:55 +0000)
* as.c (select_emulation_mode): Add const qualifiers.
* as.h: Likewise.
* config/bfin-defs.h: Likewise.
* config/bfin-parse.y: Likewise.
* config/rx-parse.y: Likewise.
* config/tc-aarch64.c (struct aarch64_option_table): Likewise.
(struct aarch64_cpu_option_table): Likewise.
(struct aarch64_arch_option_table): Likewise.
(struct aarch64_option_cpu_value_table): Likewise.
(struct aarch64_long_option_table): Likewise.
(struct aarch64_option_abi_value_table): Likewise.
* config/tc-arm.c (struct reloc_entry): Likewise.
(tc_gen_reloc): Likewise.
(struct arm_option_table): Likewise.
(struct arm_legacy_option_table): Likewise.
(struct arm_cpu_option_table): Likewise.
(struct arm_arch_option_table): Likewise.
(struct arm_option_extension_value_table): Likewise.
(struct arm_option_fpu_value_table): Likewise.
(struct arm_option_value_table): Likewise.
(struct arm_long_option_table): Likewise.
* config/tc-avr.c (struct avr_opcodes_s): Likewise.
(struct mcu_type_s): Likewise.
(struct exp_mod_s): Likewise.
(avr_operand): Likewise.
(avr_operands): Likewise.
* config/tc-d10v.c (md_begin): Likewise.
* config/tc-dlx.c: Likewise.
* config/tc-fr30.c (fr30_is_colon_insn): Likewise.
* config/tc-ft32.c (parse_condition): Likewise.
* config/tc-h8300.c (do_a_fix_imm): Likewise.
* config/tc-hppa.c (pa_ip): Likewise.
(hppa_regname_to_dw2regnum): Likewise.
* config/tc-i370.c (i370_elf_suffix): Likewise.
* config/tc-i960.c (struct tabentry): Likewise.
* config/tc-m32r.c: Likewise.
* config/tc-m68k.c: Likewise.
* config/tc-m68k.h: Likewise.
* config/tc-mcore.c (parse_psrmod): Likewise.
* config/tc-metag.c (struct metag_core_option): Likewise.
(struct metag_long_option): Likewise.
* config/tc-microblaze.c: Likewise.
* config/tc-mips.c (macro): Likewise.
* config/tc-mn10200.c: Likewise.
* config/tc-mn10300.c: Likewise.
* config/tc-msp430.c (struct rcodes_s): Likewise.
(struct hcodes_s): Likewise.
(md_parse_option): Likewise.
* config/tc-ns32k.c (struct ns32k_option): Likewise.
(optlist): Likewise.
* config/tc-ppc.c (ppc_elf_suffix): Likewise.
(tc_ppc_regname_to_dw2regnum): Likewise.
* config/tc-ppc.h: Likewise.
* config/tc-rl78.c: Likewise.
* config/tc-rx.c (struct cpu_type): Likewise.
* config/tc-sh.c (sh_regname_to_dw2regnum): Likewise.
* config/tc-sparc.c (struct priv_reg_entry): Likewise.
(sparc_ip): Likewise.
* config/tc-spu.c (insn_fmt_string): Likewise.
* config/tc-tic54x.c (tic54x_set_default_include): Likewise.
* config/tc-v850.c: Likewise.
* config/tc-visium.c (struct visium_arch_option_table): Likewise.
(struct visium_long_option_table): Likewise.
* config/tc-xgate.c: Likewise.
* config/tc-z8k.c: Likewise.
* read.c (add_include_dir): Likewise.
* read.h: Likewise.

42 files changed:
gas/ChangeLog
gas/as.c
gas/as.h
gas/config/bfin-defs.h
gas/config/bfin-parse.y
gas/config/rx-parse.y
gas/config/tc-aarch64.c
gas/config/tc-arm.c
gas/config/tc-avr.c
gas/config/tc-d10v.c
gas/config/tc-dlx.c
gas/config/tc-fr30.c
gas/config/tc-ft32.c
gas/config/tc-h8300.c
gas/config/tc-hppa.c
gas/config/tc-i370.c
gas/config/tc-i960.c
gas/config/tc-m32r.c
gas/config/tc-m68k.c
gas/config/tc-m68k.h
gas/config/tc-mcore.c
gas/config/tc-metag.c
gas/config/tc-microblaze.c
gas/config/tc-mips.c
gas/config/tc-mn10200.c
gas/config/tc-mn10300.c
gas/config/tc-msp430.c
gas/config/tc-ns32k.c
gas/config/tc-ppc.c
gas/config/tc-ppc.h
gas/config/tc-rl78.c
gas/config/tc-rx.c
gas/config/tc-sh.c
gas/config/tc-sparc.c
gas/config/tc-spu.c
gas/config/tc-tic54x.c
gas/config/tc-v850.c
gas/config/tc-visium.c
gas/config/tc-xgate.c
gas/config/tc-z8k.c
gas/read.c
gas/read.h

index e4b4deb..0e9222e 100644 (file)
@@ -1,3 +1,73 @@
+2016-02-25  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>
+
+       * as.c (select_emulation_mode): Add const qualifiers.
+       * as.h: Likewise.
+       * config/bfin-defs.h: Likewise.
+       * config/bfin-parse.y: Likewise.
+       * config/rx-parse.y: Likewise.
+       * config/tc-aarch64.c (struct aarch64_option_table): Likewise.
+       (struct aarch64_cpu_option_table): Likewise.
+       (struct aarch64_arch_option_table): Likewise.
+       (struct aarch64_option_cpu_value_table): Likewise.
+       (struct aarch64_long_option_table): Likewise.
+       (struct aarch64_option_abi_value_table): Likewise.
+       * config/tc-arm.c (struct reloc_entry): Likewise.
+       (tc_gen_reloc): Likewise.
+       (struct arm_option_table): Likewise.
+       (struct arm_legacy_option_table): Likewise.
+       (struct arm_cpu_option_table): Likewise.
+       (struct arm_arch_option_table): Likewise.
+       (struct arm_option_extension_value_table): Likewise.
+       (struct arm_option_fpu_value_table): Likewise.
+       (struct arm_option_value_table): Likewise.
+       (struct arm_long_option_table): Likewise.
+       * config/tc-avr.c (struct avr_opcodes_s): Likewise.
+       (struct mcu_type_s): Likewise.
+       (struct exp_mod_s): Likewise.
+       (avr_operand): Likewise.
+       (avr_operands): Likewise.
+       * config/tc-d10v.c (md_begin): Likewise.
+       * config/tc-dlx.c: Likewise.
+       * config/tc-fr30.c (fr30_is_colon_insn): Likewise.
+       * config/tc-ft32.c (parse_condition): Likewise.
+       * config/tc-h8300.c (do_a_fix_imm): Likewise.
+       * config/tc-hppa.c (pa_ip): Likewise.
+       (hppa_regname_to_dw2regnum): Likewise.
+       * config/tc-i370.c (i370_elf_suffix): Likewise.
+       * config/tc-i960.c (struct tabentry): Likewise.
+       * config/tc-m32r.c: Likewise.
+       * config/tc-m68k.c: Likewise.
+       * config/tc-m68k.h: Likewise.
+       * config/tc-mcore.c (parse_psrmod): Likewise.
+       * config/tc-metag.c (struct metag_core_option): Likewise.
+       (struct metag_long_option): Likewise.
+       * config/tc-microblaze.c: Likewise.
+       * config/tc-mips.c (macro): Likewise.
+       * config/tc-mn10200.c: Likewise.
+       * config/tc-mn10300.c: Likewise.
+       * config/tc-msp430.c (struct rcodes_s): Likewise.
+       (struct hcodes_s): Likewise.
+       (md_parse_option): Likewise.
+       * config/tc-ns32k.c (struct ns32k_option): Likewise.
+       (optlist): Likewise.
+       * config/tc-ppc.c (ppc_elf_suffix): Likewise.
+       (tc_ppc_regname_to_dw2regnum): Likewise.
+       * config/tc-ppc.h: Likewise.
+       * config/tc-rl78.c: Likewise.
+       * config/tc-rx.c (struct cpu_type): Likewise.
+       * config/tc-sh.c (sh_regname_to_dw2regnum): Likewise.
+       * config/tc-sparc.c (struct priv_reg_entry): Likewise.
+       (sparc_ip): Likewise.
+       * config/tc-spu.c (insn_fmt_string): Likewise.
+       * config/tc-tic54x.c (tic54x_set_default_include): Likewise.
+       * config/tc-v850.c: Likewise.
+       * config/tc-visium.c (struct visium_arch_option_table): Likewise.
+       (struct visium_long_option_table): Likewise.
+       * config/tc-xgate.c: Likewise.
+       * config/tc-z8k.c: Likewise.
+       * read.c (add_include_dir): Likewise.
+       * read.h: Likewise.
+
 2016-02-25  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * testsuite/gas/all/gas.exp: Change target pattern to cover
index 9bfac61..55214f4 100644 (file)
--- a/gas/as.c
+++ b/gas/as.c
@@ -142,7 +142,8 @@ static void
 select_emulation_mode (int argc, char **argv)
 {
   int i;
-  char *p, *em = 0;
+  char *p;
+  const char *em = NULL;
 
   for (i = 1; i < argc; i++)
     if (!strncmp ("--em", argv[i], 4))
@@ -275,7 +276,7 @@ Options:\n\
 #ifdef USE_EMULATIONS
   {
     int i;
-    char *def_em;
+    const char *def_em;
 
     fprintf (stream, "\
   --em=[");
index 4ee3f1b..bf1206f 100644 (file)
--- a/gas/as.h
+++ b/gas/as.h
@@ -380,7 +380,7 @@ COMMON int flag_execstack;
 COMMON int flag_noexecstack;
 
 /* name of emitted object file */
-COMMON char *out_file_name;
+COMMON const char *out_file_name;
 
 /* name of file defining extensions to the basic instruction set */
 COMMON char *insttbl_file_name;
index 5f05406..4c1d8b7 100644 (file)
@@ -378,7 +378,7 @@ extern "C" {
 
 extern int debug_codeselection;
 
-void error (char *format, ...);
+void error (const char *format, ...);
 void warn (char *format, ...);
 int  semantic_error (char *syntax);
 void semantic_error_2 (char *syntax);
index bb478e6..be53280 100644 (file)
@@ -158,16 +158,16 @@ extern INSTR_T insn;
 static Expr_Node *binary (Expr_Op_Type, Expr_Node *, Expr_Node *);
 static Expr_Node *unary  (Expr_Op_Type, Expr_Node *);
 
-static void notethat (char *, ...);
+static void notethat (const char *, ...);
 
 char *current_inputline;
 extern char *yytext;
-int yyerror (char *);
+int yyerror (const char *);
 
 /* Used to set SRCx fields to all 1s as described in the PRM.  */
 static Register reg7 = {REG_R7, 0};
 
-void error (char *format, ...)
+void error (const char *format, ...)
 {
     va_list ap;
     static char buffer[2000];
@@ -180,7 +180,7 @@ void error (char *format, ...)
 }
 
 int
-yyerror (char *msg)
+yyerror (const char *msg)
 {
   if (msg[0] == '\0')
     error ("%s", msg);
@@ -4651,7 +4651,7 @@ unary (Expr_Op_Type op, Expr_Node *x)
 
 int debug_codeselection = 0;
 static void
-notethat (char *format, ...)
+notethat (const char *format, ...)
 {
   va_list ap;
   va_start (ap, format);
index 7a7eb70..3bd37d0 100644 (file)
@@ -1277,7 +1277,7 @@ token_table[] =
 
 static struct
 {
-  char * string;
+  const char * string;
   int    token;
 }
 condition_opcode_table[] =
@@ -1291,7 +1291,7 @@ condition_opcode_table[] =
 
 static struct
 {
-  char * string;
+  const char * string;
   int    val;
 }
 condition_table[] =
@@ -1333,7 +1333,7 @@ rx_lex_init (char * beginning, char * ending)
 }
 
 static int
-check_condition (char * base)
+check_condition (const char * base)
 {
   char * cp;
   unsigned int i;
index b455dc8..b06c46a 100644 (file)
@@ -7715,8 +7715,8 @@ size_t md_longopts_size = sizeof (md_longopts);
 
 struct aarch64_option_table
 {
-  char *option;                        /* Option name to match.  */
-  char *help;                  /* Help information.  */
+  const char *option;                  /* Option name to match.  */
+  const char *help;                    /* Help information.  */
   int *var;                    /* Variable to change.  */
   int value;                   /* What to change it to.  */
   char *deprecated;            /* If non-null, print this message.  */
@@ -7738,7 +7738,7 @@ static struct aarch64_option_table aarch64_opts[] = {
 
 struct aarch64_cpu_option_table
 {
-  char *name;
+  const char *name;
   const aarch64_feature_set value;
   /* The canonical name of the CPU, or NULL to use NAME converted to upper
      case.  */
@@ -7780,7 +7780,7 @@ static const struct aarch64_cpu_option_table aarch64_cpus[] = {
 
 struct aarch64_arch_option_table
 {
-  char *name;
+  const char *name;
   const aarch64_feature_set value;
 };
 
@@ -7797,7 +7797,7 @@ static const struct aarch64_arch_option_table aarch64_archs[] = {
 /* ISA extensions.  */
 struct aarch64_option_cpu_value_table
 {
-  char *name;
+  const char *name;
   const aarch64_feature_set value;
 };
 
@@ -7819,8 +7819,8 @@ static const struct aarch64_option_cpu_value_table aarch64_features[] = {
 
 struct aarch64_long_option_table
 {
-  char *option;                        /* Substring to match.  */
-  char *help;                  /* Help information.  */
+  const char *option;                  /* Substring to match.  */
+  const char *help;                    /* Help information.  */
   int (*func) (char *subopt);  /* Function to decode sub-option.  */
   char *deprecated;            /* If non-null, print this message.  */
 };
@@ -7979,7 +7979,7 @@ aarch64_parse_arch (char *str)
 /* ABIs.  */
 struct aarch64_option_abi_value_table
 {
-  char *name;
+  const char *name;
   enum aarch64_abi_type value;
 };
 
index 6cc7edc..5d3bae4 100644 (file)
@@ -516,7 +516,7 @@ struct asm_barrier_opt
 
 struct reloc_entry
 {
-  char *                    name;
+  const char *                    name;
   bfd_reloc_code_real_type  reloc;
 };
 
@@ -24095,7 +24095,7 @@ tc_gen_reloc (asection *section, fixS *fixp)
 
     default:
       {
-       char * type;
+       const char * type;
 
        switch (fixp->fx_r_type)
          {
@@ -24906,11 +24906,11 @@ size_t md_longopts_size = sizeof (md_longopts);
 
 struct arm_option_table
 {
-  char *option;                /* Option name to match.  */
-  char *help;          /* Help information.  */
+  const char *option;          /* Option name to match.  */
+  const char *help;            /* Help information.  */
   int  *var;           /* Variable to change.  */
   int  value;          /* What to change it to.  */
-  char *deprecated;    /* If non-null, print this message.  */
+  const char *deprecated;      /* If non-null, print this message.  */
 };
 
 struct arm_option_table arm_opts[] =
@@ -24943,10 +24943,10 @@ struct arm_option_table arm_opts[] =
 
 struct arm_legacy_option_table
 {
-  char *option;                                /* Option name to match.  */
+  const char *option;                          /* Option name to match.  */
   const arm_feature_set        **var;          /* Variable to change.  */
   const arm_feature_set        value;          /* What to change it to.  */
-  char *deprecated;                    /* If non-null, print this message.  */
+  const char *deprecated;                      /* If non-null, print this message.  */
 };
 
 const struct arm_legacy_option_table arm_legacy_opts[] =
@@ -25064,7 +25064,7 @@ const struct arm_legacy_option_table arm_legacy_opts[] =
 
 struct arm_cpu_option_table
 {
-  char *name;
+  const char *name;
   size_t name_len;
   const arm_feature_set        value;
   /* For some CPUs we assume an FPU unless the user explicitly sets
@@ -25245,7 +25245,7 @@ static const struct arm_cpu_option_table arm_cpus[] =
 
 struct arm_arch_option_table
 {
-  char *name;
+  const char *name;
   size_t name_len;
   const arm_feature_set        value;
   const arm_feature_set        default_fpu;
@@ -25316,7 +25316,7 @@ static const struct arm_arch_option_table arm_archs[] =
 /* ISA extensions in the co-processor and main instruction set space.  */
 struct arm_option_extension_value_table
 {
-  char *name;
+  const char *name;
   size_t name_len;
   const arm_feature_set merge_value;
   const arm_feature_set clear_value;
@@ -25378,7 +25378,7 @@ static const struct arm_option_extension_value_table arm_extensions[] =
 /* ISA floating-point and Advanced SIMD extensions.  */
 struct arm_option_fpu_value_table
 {
-  char *name;
+  const char *name;
   const arm_feature_set value;
 };
 
@@ -25434,7 +25434,7 @@ static const struct arm_option_fpu_value_table arm_fpus[] =
 
 struct arm_option_value_table
 {
-  char *name;
+  const char *name;
   long value;
 };
 
@@ -25459,10 +25459,10 @@ static const struct arm_option_value_table arm_eabis[] =
 
 struct arm_long_option_table
 {
-  char * option;               /* Substring to match.  */
-  char * help;                 /* Help information.  */
+  const char * option;         /* Substring to match.  */
+  const char * help;                   /* Help information.  */
   int (* func) (char * subopt);        /* Function to decode sub-option.  */
-  char * deprecated;           /* If non-null, print this message.  */
+  const char * deprecated;             /* If non-null, print this message.  */
 };
 
 static bfd_boolean
index 767e82c..69881b7 100644 (file)
@@ -37,9 +37,9 @@ struct avr_property_record_link
 
 struct avr_opcodes_s
 {
-  char *        name;
-  char *        constraints;
-  char *        opcode;
+  const char *        name;
+  const char *        constraints;
+  const char *        opcode;
   int           insn_size;             /* In words.  */
   int           isa;
   unsigned int  bin_opcode;
@@ -61,7 +61,7 @@ const char line_separator_chars[] = "$";
 const char *md_shortopts = "m:";
 struct mcu_type_s
 {
-  char *name;
+  const char *name;
   int isa;
   int mach;
 };
@@ -380,7 +380,7 @@ const pseudo_typeS md_pseudo_table[] =
 
 struct exp_mod_s
 {
-  char *                    name;
+  const char *                    name;
   bfd_reloc_code_real_type  reloc;
   bfd_reloc_code_real_type  neg_reloc;
   int                       have_pm;
@@ -860,7 +860,7 @@ avr_ldi_expression (expressionS *exp)
 static unsigned int
 avr_operand (struct avr_opcodes_s *opcode,
             int where,
-            char *op,
+            const char *op,
             char **line)
 {
   expressionS op_expr;
@@ -998,7 +998,7 @@ avr_operand (struct avr_opcodes_s *opcode,
       if (*str == '+')
        {
          ++str;
-          char *s;
+          const char *s;
           for (s = opcode->opcode; *s; ++s)
             {
               if (*s == '+')
@@ -1145,7 +1145,7 @@ avr_operand (struct avr_opcodes_s *opcode,
 static unsigned int
 avr_operands (struct avr_opcodes_s *opcode, char **line)
 {
-  char *op = opcode->constraints;
+  const char *op = opcode->constraints;
   unsigned int bin = opcode->bin_opcode;
   char *frag = frag_more (opcode->insn_size * 2);
   char *str = *line;
index fca7b6b..f2855fc 100644 (file)
@@ -275,7 +275,7 @@ md_section_align (asection *seg, valueT addr)
 void
 md_begin (void)
 {
-  char *prev_name = "";
+  const char *prev_name = "";
   struct d10v_opcode *opcode;
   d10v_hash = hash_new ();
 
index 3efd36f..39b1903 100644 (file)
@@ -84,7 +84,7 @@ const char EXP_CHARS[] = "eE";
 const char FLT_CHARS[] = "rRsSfFdDxXpP";
 
 static void
-insert_sreg (char *regname, int regnum)
+insert_sreg (const char *regname, int regnum)
 {
   /* Must be large enough to hold the names of the special registers.  */
   char buf[80];
@@ -153,7 +153,7 @@ match_sft_register (char *name)
 #define MAX_REG_NO  35
 /* Currently we have 35 software registers defined -
    we borrowed from MIPS.   */
-  static char *soft_reg[] =
+  static const char *soft_reg[] =
     {
       "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
       "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "t9",
index 83714aa..683da32 100644 (file)
@@ -363,7 +363,7 @@ fr30_is_colon_insn (char *start, char *nul_char)
        {
          /* Yup - it might be delay slot instruction.  */
          int           i;
-         static char * delay_insns [] =
+         static const char * delay_insns [] =
          {
            "call", "jmp", "ret", "bra", "bno",
            "beq",  "bne", "bc",  "bnc", "bn",
@@ -373,7 +373,7 @@ fr30_is_colon_insn (char *start, char *nul_char)
 
          for (i = sizeof (delay_insns) / sizeof (delay_insns[0]); i--;)
            {
-             char * insn = delay_insns[i];
+             const char * insn = delay_insns[i];
              int    len  = strlen (insn);
 
              if (start [len] != 0)
index 85722b3..88ea4f7 100644 (file)
@@ -79,7 +79,7 @@ parse_condition (char **ptr)
 {
   char *s = *ptr;
   static const struct {
-    char *name;
+    const char *name;
     int bits;
   } ccs[] = {
     { "gt,"   , (2 << FT32_FLD_CR_BIT) | (5 << FT32_FLD_CB_BIT) | (1 << FT32_FLD_CV_BIT)},
index 063c40d..5e6695f 100644 (file)
@@ -355,7 +355,7 @@ static void clever_message (const struct h8_instruction *, struct h8_op *);
 static void fix_operand_size (struct h8_op *, int);
 static void build_bytes (const struct h8_instruction *, struct h8_op *);
 static void do_a_fix_imm (int, int, struct h8_op *, int, const struct h8_instruction *);
-static void check_operand (struct h8_op *, unsigned int, char *);
+static void check_operand (struct h8_op *, unsigned int, const char *);
 static const struct h8_instruction * get_specific (const struct h8_instruction *, struct h8_op *, int) ;
 static char *get_operands (unsigned, char *, struct h8_op *);
 static void get_operand (char **, struct h8_op *, int);
@@ -1286,7 +1286,7 @@ get_specific (const struct h8_instruction *instruction,
 }
 
 static void
-check_operand (struct h8_op *operand, unsigned int width, char *string)
+check_operand (struct h8_op *operand, unsigned int width, const char *string)
 {
   if (operand->exp.X_add_symbol == 0
       && operand->exp.X_op_symbol == 0)
@@ -1340,7 +1340,7 @@ do_a_fix_imm (int offset, int nibble, struct h8_op *operand, int relaxmode, cons
   int where;
   char *bytes = frag_now->fr_literal + offset;
 
-  char *t = ((operand->mode & MODE) == IMM) ? "#" : "@";
+  const char *t = ((operand->mode & MODE) == IMM) ? "#" : "@";
 
   if (operand->exp.X_add_symbol == 0)
     {
index 765398e..c3e1d75 100644 (file)
@@ -465,7 +465,7 @@ struct hppa_fix_struct
 
 struct pd_reg
   {
-    char *name;
+    const char *name;
     int value;
   };
 
@@ -473,7 +473,7 @@ struct pd_reg
    to a condition number which can be recorded in an instruction.  */
 struct fp_cond_map
   {
-    char *string;
+    const char *string;
     int cond;
   };
 
@@ -481,7 +481,7 @@ struct fp_cond_map
    string to a field selector type.  */
 struct selector_entry
   {
-    char *prefix;
+    const char *prefix;
     int field_selector;
   };
 
@@ -3167,7 +3167,7 @@ pa_parse_addb_64_cmpltr (char **s)
 static void
 pa_ip (char *str)
 {
-  char *error_message = "";
+  const char *error_message = "";
   char *s, c, *argstart, *name, *save_s;
   const char *args;
   int match = FALSE;
@@ -8694,7 +8694,7 @@ hppa_regname_to_dw2regnum (char *regname)
   unsigned int i;
   const char *p;
   char *q;
-  static struct { char *name; int dw2regnum; } regnames[] =
+  static struct { const char *name; int dw2regnum; } regnames[] =
     {
       { "sp", 30 }, { "rp", 2 },
     };
index 4795560..bfcc0b3 100644 (file)
@@ -102,7 +102,7 @@ static bfd_boolean reg_names_p = TARGET_REG_NAMES_P;
 /* Structure to hold information about predefined registers.  */
 struct pd_reg
   {
-    char *name;
+    const char *name;
     int value;
   };
 
@@ -582,7 +582,7 @@ i370_elf_suffix (char **str_p, expressionS *exp_p)
 {
   struct map_bfd
   {
-    char *string;
+    const char *string;
     int length;
     bfd_reloc_code_real_type reloc;
   };
index b927965..d09e3cf 100644 (file)
@@ -240,7 +240,7 @@ struct regop
    operands.  */
 static const struct
   {
-    char *reg_name;
+    const char *reg_name;
     int reg_num;
   }
 regnames[] =
@@ -335,7 +335,7 @@ regnames[] =
    'abase' (indirect addressing) registers.  */
 static const struct
 {
-  char *areg_name;
+  const char *areg_name;
   int areg_num;
 }
 aregs[] =
@@ -559,7 +559,7 @@ emit (long instr)           /* Word to be output, host byte order.  */
 
 static void
 get_cdisp (char *dispP, /* Displacement as specified in source instruction.  */
-          char *ifmtP, /* "COBR" or "CTRL" (for use in error message).  */
+          const char *ifmtP, /* "COBR" or "CTRL" (for use in error message).  */
           long instr,  /* Instruction needing the displacement.  */
           int numbits, /* # bits of displacement (13 for COBR, 24 for CTRL).  */
           int var_frag,/* 1 if varying length code fragment should be emitted;
@@ -1809,7 +1809,7 @@ size_t md_longopts_size = sizeof (md_longopts);
 
 struct tabentry
 {
-  char *flag;
+  const char *flag;
   int arch;
 };
 static const struct tabentry arch_tab[] =
index 833cbff..18553bb 100644 (file)
@@ -2300,7 +2300,7 @@ printf(" => %s\n",reloc->howto->name);
 }
 
 inline static char *
-m32r_end_of_match (char *cont, char *what)
+m32r_end_of_match (char *cont, const char *what)
 {
   int len = strlen (what);
 
index 7ef5ff4..bd6eac6 100644 (file)
@@ -8098,7 +8098,7 @@ m68k_elf_cons (int nbytes /* 4=.long */)
 #endif
 
 int
-tc_m68k_regname_to_dw2regnum (char *regname)
+tc_m68k_regname_to_dw2regnum (const char *regname)
 {
   unsigned int regnum;
   static const char *const regnames[] =
index f5a7595..30ca2cb 100644 (file)
@@ -172,7 +172,7 @@ extern struct relax_type md_relax_table[];
 #define DWARF2_CIE_DATA_ALIGNMENT (-4)
 
 #define tc_regname_to_dw2regnum tc_m68k_regname_to_dw2regnum
-extern int tc_m68k_regname_to_dw2regnum (char *regname);
+extern int tc_m68k_regname_to_dw2regnum (const char *regname);
 
 #define tc_cfi_frame_initial_instructions tc_m68k_frame_initial_instructions
 extern void tc_m68k_frame_initial_instructions (void);
index f73f3b7..6e57316 100644 (file)
@@ -141,7 +141,7 @@ static struct hash_control * opcode_hash_control;   /* Opcode mnemonics.  */
 #define POOL_START_LABEL ".LS"
 
 static void
-make_name (char * s, char * p, int n)
+make_name (char * s, const char * p, int n)
 {
   static const char hex[] = "0123456789ABCDEF";
 
@@ -455,7 +455,7 @@ void
 md_begin (void)
 {
   const mcore_opcode_info * opcode;
-  char * prev_name = "";
+  const char * prev_name = "";
 
   opcode_hash_control = hash_new ();
 
@@ -523,7 +523,7 @@ parse_reg (char * s, unsigned * reg)
 
 static struct Cregs
 {
-  char * name;
+  const char * name;
   unsigned int crnum;
 }
 cregs[] =
@@ -611,7 +611,7 @@ parse_psrmod (char * s, unsigned * reg)
   char buf[10];
   static struct psrmods
   {
-    char *       name;
+    const char *       name;
     unsigned int value;
   }
   psrmods[] =
index ff4d2cf..b0b2604 100644 (file)
@@ -5791,7 +5791,7 @@ static const insn_parser insn_parsers[ENC_MAX] =
 
 struct metag_core_option
 {
-  char *name;
+  const char *name;
   unsigned int value;
 };
 
@@ -5899,10 +5899,10 @@ metag_parse_dsp (char * str)
 
 struct metag_long_option
 {
-  char * option;                /* Substring to match.  */
-  char * help;                  /* Help information.  */
+  const char * option;                /* Substring to match.  */
+  const char * help;                  /* Help information.  */
   int (* func) (char * subopt); /* Function to decode sub-option.  */
-  char * deprecated;            /* If non-null, print this message.  */
+  const char * deprecated;            /* If non-null, print this message.  */
 };
 
 struct metag_long_option metag_long_opts[] =
@@ -6879,7 +6879,7 @@ metag_handle_align (fragS * fragP)
 }
 
 static char *
-metag_end_of_match (char * cont, char * what)
+metag_end_of_match (char * cont, const char * what)
 {
   int len = strlen (what);
 
index 16c70ad..70ceb21 100644 (file)
@@ -621,7 +621,7 @@ parse_exp (char *s, expressionS *e)
 #define IMM_MAX    9
 
 struct imm_type {
-       char *isuffix;   /* Suffix String */
+       const char *isuffix;     /* Suffix String */
        int itype;       /* Suffix Type */
        int otype;       /* Offset Type */
 };
index 862454d..4657ce2 100644 (file)
@@ -12693,8 +12693,8 @@ macro (struct mips_cl_insn *ip, char *str)
     case M_DROL_I:
       {
        unsigned int rot;
-       char *l;
-       char *rr;
+       const char *l;
+       const char *rr;
 
        rot = imm_expr.X_add_number & 0x3f;
        if (ISA_HAS_DROR (mips_opts.isa) || CPU_HAS_DROR (mips_opts.arch))
@@ -12773,8 +12773,8 @@ macro (struct mips_cl_insn *ip, char *str)
     case M_DROR_I:
       {
        unsigned int rot;
-       char *l;
-       char *rr;
+       const char *l;
+       const char *rr;
 
        rot = imm_expr.X_add_number & 0x3f;
        if (ISA_HAS_DROR (mips_opts.isa) || CPU_HAS_DROR (mips_opts.arch))
index d6b4006..a7fd980 100644 (file)
@@ -682,7 +682,7 @@ md_section_align (asection *seg, valueT addr)
 void
 md_begin (void)
 {
-  char *prev_name = "";
+  const char *prev_name = "";
   const struct mn10200_opcode *op;
 
   mn10200_hash = hash_new ();
index 7369602..63d790a 100644 (file)
@@ -911,7 +911,7 @@ md_section_align (asection *seg, valueT addr)
 void
 md_begin (void)
 {
-  char *prev_name = "";
+  const char *prev_name = "";
   const struct mn10300_opcode *op;
 
   mn10300_hash = hash_new ();
@@ -2443,7 +2443,7 @@ set_arch_mach (int mach)
 }
 
 static inline char *
-mn10300_end_of_match (char *cont, char *what)
+mn10300_end_of_match (char *cont, const char *what)
 {
   int len = strlen (what);
 
index bf65944..4004b44 100644 (file)
@@ -105,7 +105,7 @@ int linkrelax = 1;
 
 struct rcodes_s
 {
-  char * name;
+  const char * name;
   int    index;        /* Corresponding insn_opnumb.  */
   int    sop;  /* Opcode if jump length is short.  */
   long   lpos; /* Label position.  */
@@ -160,7 +160,7 @@ static struct rcodes_s msp430x_rcodes[] =
 
 struct hcodes_s
 {
-  char * name;
+  const char * name;
   int    index;                /* Corresponding insn_opnumb.  */
   int    tlab;         /* Number of labels in short mode.  */
   int    op0;          /* Opcode for first word of short jump.  */
@@ -1339,7 +1339,7 @@ md_parse_option (int c, char * arg)
        signed int i;
        const struct
        {
-         char *       name;
+         const char *       name;
          unsigned int length;
          unsigned int bitfield;
        } erratas[] =
index 6fdca2b..2b88bf4 100644 (file)
@@ -102,7 +102,7 @@ const char FLT_CHARS[] = "fd";      /* We don't want to support lowercase,
 /* Internal structs.  */
 struct ns32k_option
 {
-  char *pattern;
+  const char *pattern;
   unsigned long or;
   unsigned long and;
 };
@@ -803,7 +803,7 @@ optlist (char *str,                 /* The string to extract options from.  */
         unsigned long *default_map)    /* Default pattern and output.  */
 {
   int i, j, k, strlen1, strlen2;
-  char *patternP, *strP;
+  const char *patternP, *strP;
 
   strlen1 = strlen (str);
 
index 71b2dac..02cbb95 100644 (file)
@@ -302,7 +302,7 @@ const pseudo_typeS md_pseudo_table[] =
 /* Structure to hold information about predefined registers.  */
 struct pd_reg
   {
-    char *name;
+    const char *name;
     int value;
   };
 
@@ -1402,7 +1402,7 @@ ppc_mach (void)
     return bfd_mach_ppc;
 }
 
-extern char*
+extern const char*
 ppc_target_format (void)
 {
 #ifdef OBJ_COFF
@@ -1864,7 +1864,7 @@ static bfd_reloc_code_real_type
 ppc_elf_suffix (char **str_p, expressionS *exp_p)
 {
   struct map_bfd {
-    char *string;
+    const char *string;
     unsigned int length : 8;
     unsigned int valid32 : 1;
     unsigned int valid64 : 1;
@@ -7171,7 +7171,7 @@ tc_ppc_regname_to_dw2regnum (char *regname)
   unsigned int i;
   const char *p;
   char *q;
-  static struct { char *name; int dw2regnum; } regnames[] =
+  static struct { const char *name; int dw2regnum; } regnames[] =
     {
       { "sp", 1 }, { "r.sp", 1 }, { "rtoc", 2 }, { "r.toc", 2 },
       { "mq", 64 }, { "lr", 65 }, { "ctr", 66 }, { "ap", 67 },
index 92120f9..e64107e 100644 (file)
@@ -51,7 +51,7 @@ extern int target_big_endian;
 
 /* The target BFD format.  */
 #define TARGET_FORMAT (ppc_target_format ())
-extern char *ppc_target_format (void);
+extern const char *ppc_target_format (void);
 
 /* Permit temporary numeric labels.  */
 #define LOCAL_LABELS_FB 1
index 1c7c9cf..bd05039 100644 (file)
@@ -436,7 +436,7 @@ md_number_to_chars (char * buf, valueT val, int n)
 }
 
 static void
-require_end_of_expr (char *fname)
+require_end_of_expr (const char *fname)
 {
   while (* input_line_pointer == ' '
         || * input_line_pointer == '\t')
@@ -454,7 +454,7 @@ require_end_of_expr (char *fname)
 
 static struct
 {
-  char * fname;
+  const char * fname;
   int    reloc;
 }
 reloc_functions[] =
index 91d4828..b74ee72 100644 (file)
@@ -108,7 +108,7 @@ size_t md_longopts_size = sizeof (md_longopts);
 
 struct cpu_type
 {
-  char *cpu_name;
+  const char *cpu_name;
   int type;
 };
 
@@ -1223,7 +1223,7 @@ md_number_to_chars (char * buf, valueT val, int n)
 
 static struct
 {
-  char * fname;
+  const char * fname;
   int    reloc;
 }
 reloc_functions[] =
index 6d25907..9da94a8 100644 (file)
@@ -950,7 +950,7 @@ void
 md_begin (void)
 {
   const sh_opcode_info *opcode;
-  char *prev_name = "";
+  const char *prev_name = "";
   unsigned int target_arch;
 
   target_arch
@@ -4490,7 +4490,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
 
 #ifdef OBJ_ELF
 inline static char *
-sh_end_of_match (char *cont, char *what)
+sh_end_of_match (char *cont, const char *what)
 {
   int len = strlen (what);
 
@@ -4603,7 +4603,7 @@ sh_regname_to_dw2regnum (char *regname)
   unsigned int i;
   const char *p;
   char *q;
-  static struct { char *name; int dw2regnum; } regnames[] =
+  static struct { const char *name; int dw2regnum; } regnames[] =
     {
       { "pr", 17 }, { "t", 18 }, { "gbr", 19 }, { "mach", 20 },
       { "macl", 21 }, { "fpul", 23 }
index bfa9aac..cac5d18 100644 (file)
@@ -47,7 +47,7 @@ static int get_expression (char *);
 #ifndef DEFAULT_ARCH
 #define DEFAULT_ARCH "sparclite"
 #endif
-static char *default_arch = DEFAULT_ARCH;
+static const char *default_arch = DEFAULT_ARCH;
 
 /* Non-zero if the initial values of `max_architecture' and `sparc_arch_size'
    have been set.  */
@@ -241,8 +241,8 @@ enum sparc_arch_types {v6, v7, v8, leon, sparclet, sparclite, sparc86x, v8plus,
   | HWCAP2_XMPMUL | HWCAP2_XMONT
 
 static struct sparc_arch {
-  char *name;
-  char *opcode_arch;
+  const char *name;
+  const char *opcode_arch;
   enum sparc_arch_types arch_type;
   /* Default word size, as specified during configuration.
      A value of zero means can't be used to specify default architecture.  */
@@ -300,7 +300,7 @@ static struct sparc_arch {
 static enum sparc_arch_types default_arch_type;
 
 static struct sparc_arch *
-lookup_arch (char *name)
+lookup_arch (const char *name)
 {
   struct sparc_arch *sa;
 
@@ -760,9 +760,9 @@ md_show_usage (FILE *stream)
 /* Native operand size opcode translation.  */
 struct
   {
-    char *name;
-    char *name32;
-    char *name64;
+    const char *name;
+    const char *name32;
+    const char *name64;
   } native_op_table[] =
 {
   {"ldn", "ld", "ldx"},
@@ -782,7 +782,7 @@ struct
 
 struct priv_reg_entry
 {
-  char *name;
+  const char *name;
   int regnum;
 };
 
@@ -904,7 +904,7 @@ md_begin (void)
   for (i = 0; native_op_table[i].name; i++)
     {
       const struct sparc_opcode *insn;
-      char *name = ((sparc_arch_size == 32)
+      const char *name = ((sparc_arch_size == 32)
                    ? native_op_table[i].name32
                    : native_op_table[i].name64);
       insn = (struct sparc_opcode *) hash_find (op_hash, name);
@@ -1547,7 +1547,7 @@ get_hwcap_name (bfd_uint64_t mask)
 static int
 sparc_ip (char *str, const struct sparc_opcode **pinsn)
 {
-  char *error_message = "";
+  const char *error_message = "";
   char *s;
   const char *args;
   char c;
@@ -2065,7 +2065,7 @@ sparc_ip (char *str, const struct sparc_opcode **pinsn)
                  static const struct ops
                  {
                    /* The name as it appears in assembler.  */
-                   char *name;
+                   const char *name;
                    /* strlen (name), precomputed for speed */
                    int len;
                    /* The reloc this pseudo-op translates to.  */
@@ -2518,7 +2518,7 @@ sparc_ip (char *str, const struct sparc_opcode **pinsn)
 
              {
                char *s1;
-               char *op_arg = NULL;
+               const char *op_arg = NULL;
                static expressionS op_exp;
                bfd_reloc_code_real_type old_reloc = the_insn.reloc;
 
@@ -2527,7 +2527,7 @@ sparc_ip (char *str, const struct sparc_opcode **pinsn)
                  {
                    static const struct ops {
                      /* The name as it appears in assembler.  */
-                     char *name;
+                     const char *name;
                      /* strlen (name), precomputed for speed */
                      int len;
                      /* The reloc this pseudo-op translates to.  */
index 205df46..69264c1 100644 (file)
@@ -245,7 +245,7 @@ insn_fmt_string (struct spu_opcode *format)
   for (i = 1; i <= format->arg[0]; i++)
     {
       int arg = format->arg[i];
-      char *exp;
+      const char *exp;
       if (i > 1 && arg != A_P && format->arg[i-1] != A_P)
        buf[len++] =  ',';
       if (arg == A_P)
index 3ed7933..e071f95 100644 (file)
@@ -1891,7 +1891,7 @@ tic54x_set_default_include (int dot)
       len = strlen (dir);
       if (include_dir_count == 0)
        {
-         include_dirs = (char **) xmalloc (sizeof (*include_dirs));
+         include_dirs = XNEWVEC (const char *, 1);
          include_dir_count = 1;
        }
       include_dirs[0] = dir;
index 53c9077..00ff00d 100644 (file)
@@ -1885,7 +1885,7 @@ md_section_align (asection *seg, valueT addr)
 void
 md_begin (void)
 {
-  char *prev_name = "";
+  const char *prev_name = "";
   const struct v850_opcode *op;
 
   if (strncmp (TARGET_CPU, "v850e3v5", 8) == 0)
index c81a7fa..3758a35 100644 (file)
@@ -265,7 +265,7 @@ static struct visium_option_table visium_opts[] =
 
 struct visium_arch_option_table
 {
-  char *name;
+  const char *name;
   enum visium_arch_val value;
 };
 
@@ -280,10 +280,10 @@ static struct visium_arch_option_table visium_archs[] =
 
 struct visium_long_option_table
 {
-  char *option;                        /* Substring to match.  */
-  char *help;                  /* Help information.  */
+  const char *option;                  /* Substring to match.  */
+  const char *help;                    /* Help information.  */
   int (*func) (char *subopt);  /* Function to decode sub-option.  */
-  char *deprecated;            /* If non-null, print this message.  */
+  const char *deprecated;              /* If non-null, print this message.  */
 };
 
 static int
index cafca95..70554fe 100644 (file)
@@ -291,7 +291,7 @@ md_begin (void)
   struct xgate_opcode *xgate_opcode_ptr = NULL;
   struct xgate_opcode *xgate_op_table = NULL;
   struct xgate_opcode_handle *op_handles = 0;
-  char *prev_op_name = 0;
+  const char *prev_op_name = 0;
   int handle_enum = 0;
   int number_of_op_handles = 0;
   int i, j = 0;
index e8d04bf..c09d826 100644 (file)
@@ -380,7 +380,7 @@ checkfor (char *ptr, char what)
 /* Make sure the mode supplied is the size of a word.  */
 
 static void
-regword (int mode, char *string)
+regword (int mode, const char *string)
 {
   int ok;
 
@@ -394,7 +394,7 @@ regword (int mode, char *string)
 /* Make sure the mode supplied is the size of an address.  */
 
 static void
-regaddr (int mode, char *string)
+regaddr (int mode, const char *string)
 {
   int ok;
 
@@ -407,7 +407,7 @@ regaddr (int mode, char *string)
 
 struct ctrl_names {
   int value;
-  char *name;
+  const char *name;
 };
 
 static struct ctrl_names ctrl_table[] = {
@@ -450,7 +450,7 @@ get_ctrl_operand (char **ptr, struct z8k_op *mode, unsigned int dst ATTRIBUTE_UN
 
 struct flag_names {
   int value;
-  char *name;
+  const char *name;
 };
 
 static struct flag_names flag_table[] = {
@@ -500,7 +500,7 @@ get_flags_operand (char **ptr, struct z8k_op *mode, unsigned int dst ATTRIBUTE_U
 
 struct interrupt_names {
   int value;
-  char *name;
+  const char *name;
 };
 
 static struct interrupt_names intr_table[] = {
@@ -564,7 +564,7 @@ get_interrupt_operand (char **ptr, struct z8k_op *mode, unsigned int dst ATTRIBU
 
 struct cc_names {
   int value;
-  char *name;
+  const char *name;
 };
 
 static struct cc_names table[] = {
index e992534..f308cdc 100644 (file)
@@ -166,7 +166,7 @@ int target_big_endian = TARGET_BYTES_BIG_ENDIAN;
 /* Variables for handling include file directory table.  */
 
 /* Table of pointers to directories to search for .include's.  */
-char **include_dirs;
+const char **include_dirs;
 
 /* How many are in the table.  */
 int include_dir_count;
@@ -809,7 +809,7 @@ do_align (unsigned int n, char *fill, unsigned int len, unsigned int max)
 /* We read the file, putting things into a web that represents what we
    have been reading.  */
 void
-read_a_source_file (char *name)
+read_a_source_file (const char *name)
 {
   char nul_char;
   char next_char;
@@ -5972,16 +5972,15 @@ add_include_dir (char *path)
 
   if (include_dir_count == 0)
     {
-      include_dirs = (char **) xmalloc (2 * sizeof (*include_dirs));
+      include_dirs = XNEWVEC (const char *, 2);
       include_dirs[0] = ".";   /* Current dir.  */
       include_dir_count = 2;
     }
   else
     {
       include_dir_count++;
-      include_dirs =
-       (char **) xrealloc (include_dirs,
-                           include_dir_count * sizeof (*include_dirs));
+      include_dirs = XRESIZEVEC (const char *, include_dirs,
+                                include_dir_count);
     }
 
   include_dirs[include_dir_count - 1] = path;  /* New one.  */
index 146dc36..0787eab 100644 (file)
@@ -74,7 +74,7 @@ extern const char line_comment_chars[];
 extern const char line_separator_chars[];
 
 /* Table of -I directories.  */
-extern char **include_dirs;
+extern const char **include_dirs;
 extern int include_dir_count;
 extern int include_dir_maxlen;
 
@@ -134,7 +134,7 @@ extern void ignore_rest_of_line (void);
 #define discard_rest_of_line ignore_rest_of_line
 extern unsigned output_leb128 (char *, valueT, int);
 extern void pseudo_set (symbolS * symbolP);
-extern void read_a_source_file (char *name);
+extern void read_a_source_file (const char *name);
 extern void read_begin (void);
 extern void read_print_statistics (FILE *);
 extern char *read_symbol_name (void);