sh{,64}: make arg type enum
authorTrevor Saunders <tbsaunde+binutils@tbsaunde.org>
Sun, 29 May 2016 02:31:07 +0000 (22:31 -0400)
committerTrevor Saunders <tbsaunde+binutils@tbsaunde.org>
Mon, 6 Jun 2016 03:27:41 +0000 (23:27 -0400)
The values are always members of the enum, except the two places -1 is assigned
only to playcate -Wuninitialized because gcc isn't or at least didn't used to
be smart enough to figure out its only used if it was set.

gas/ChangeLog:

2016-06-05  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* config/tc-sh.c (parse_reg): Change type of mode argument to
sh_arg_type.
(get_operand): Adjust.
(insert): Change type of how to bfd_reloc_code_real_type.
(insert4): Likewise.
* config/tc-sh64.c (shmedia_get_operand): Adjust.
(shmedia_parse_reg): Change type of mode to shmedia_arg_type.

gas/ChangeLog
gas/config/tc-sh.c
gas/config/tc-sh64.c

index cae94da..c97aa1d 100644 (file)
@@ -1,5 +1,15 @@
 2016-06-05  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>
 
+       * config/tc-sh.c (parse_reg): Change type of mode argument to
+       sh_arg_type.
+       (get_operand): Adjust.
+       (insert): Change type of how to bfd_reloc_code_real_type.
+       (insert4): Likewise.
+       * config/tc-sh64.c (shmedia_get_operand): Adjust.
+       (shmedia_parse_reg): Change type of mode to shmedia_arg_type.
+
+2016-06-05  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>
+
        * config/tc-nds32.c (nds32_parse_option): Make the type of ptr_arg
        const char *.
 
index b15acf8..f65fbb2 100644 (file)
@@ -987,7 +987,7 @@ static int reg_b;
 /* Try to parse a reg name.  Return the number of chars consumed.  */
 
 static unsigned int
-parse_reg_without_prefix (char *src, int *mode, int *reg)
+parse_reg_without_prefix (char *src, sh_arg_type *mode, int *reg)
 {
   char l0 = TOLOWER (src[0]);
   char l1 = l0 ? TOLOWER (src[1]) : 0;
@@ -1346,7 +1346,7 @@ parse_reg_without_prefix (char *src, int *mode, int *reg)
    $-prefixed register names if enabled by the user.  */
 
 static unsigned int
-parse_reg (char *src, int *mode, int *reg)
+parse_reg (char *src, sh_arg_type *mode, int *reg)
 {
   unsigned int prefix;
   unsigned int consumed;
@@ -1411,7 +1411,7 @@ static char *
 parse_at (char *src, sh_operand_info *op)
 {
   int len;
-  int mode;
+  sh_arg_type mode;
   src++;
   if (src[0] == '@')
     {
@@ -1583,7 +1583,7 @@ static void
 get_operand (char **ptr, sh_operand_info *op)
 {
   char *src = *ptr;
-  int mode = -1;
+  sh_arg_type mode = (sh_arg_type) -1;
   unsigned int len;
 
   if (src[0] == '#')
@@ -2235,7 +2235,8 @@ get_specific (sh_opcode_info *opcode, sh_operand_info *operands)
 }
 
 static void
-insert (char *where, int how, int pcrel, sh_operand_info *op)
+insert (char *where, bfd_reloc_code_real_type how, int pcrel,
+               sh_operand_info *op)
 {
   fix_new_exp (frag_now,
               where - frag_now->fr_literal,
@@ -2246,7 +2247,8 @@ insert (char *where, int how, int pcrel, sh_operand_info *op)
 }
 
 static void
-insert4 (char * where, int how, int pcrel, sh_operand_info * op)
+insert4 (char * where, bfd_reloc_code_real_type how, int pcrel,
+        sh_operand_info * op)
 {
   fix_new_exp (frag_now,
               where - frag_now->fr_literal,
index 4de044c..d4627f8 100644 (file)
@@ -133,7 +133,8 @@ static const unsigned char shmedia_little_nop_pattern[4] =
  };
 
 static void shmedia_md_begin (void);
-static int shmedia_parse_reg (char *, int *, int *, shmedia_arg_type);
+static int shmedia_parse_reg (char *, shmedia_arg_type *, int *,
+                             shmedia_arg_type);
 static void shmedia_md_assemble (char *);
 static void shmedia_md_apply_fix (fixS *, valueT *);
 static int shmedia_md_estimate_size_before_relax (fragS *, segT);
@@ -1611,7 +1612,8 @@ shmedia_immediate_op (char *where, shmedia_operand_info *op, int pcrel,
    chars consumed.  */
 
 static int
-shmedia_parse_reg (char *src, int *mode, int *reg, shmedia_arg_type argtype)
+shmedia_parse_reg (char *src, shmedia_arg_type *mode, int *reg,
+                  shmedia_arg_type argtype)
 {
   int l0 = TOLOWER (src[0]);
   int l1 = l0 ? TOLOWER (src[1]) : 0;
@@ -2222,7 +2224,7 @@ shmedia_get_operand (char **ptr, shmedia_operand_info *op,
                     shmedia_arg_type argtype)
 {
   char *src = *ptr;
-  int mode = -1;
+  shmedia_arg_type mode = (shmedia_arg_type) -1;
   unsigned int len;
 
   len = shmedia_parse_reg (src, &mode, &(op->reg), argtype);