* dwarf2.c: Convert to C90, remove unneeded casts and prototypes.
[deliverable/binutils-gdb.git] / gas / config / tc-d30v.c
index b0b058f3330866d0e6e8a448f4de872ed7bc7ceb..7507c46cf3ede6428474ef1c39de1cc1b700de89 100644 (file)
@@ -101,7 +101,7 @@ static int d30v_current_align;
 static segT d30v_current_align_seg;
 
 /* The last seen label in the current section.  This is used to auto-align
-   labels preceeding instructions.  */
+   labels preceding instructions.  */
 static symbolS *d30v_last_label;
 
 /* Two nops.  */
@@ -252,32 +252,31 @@ check_range (num, bits, flags)
         Allow either.  */
       min = -((unsigned long) 1 << (bits - 1));
       max = ((unsigned long) 1 << bits) - 1;
-      return (long)num < min || (long)num > max;
+      return (long) num < min || (long) num > max;
     }
 
   if (flags & OPERAND_SHIFT)
     {
       /* We know that all shifts are right by three bits.  */
+      num >>= 3;
 
       if (flags & OPERAND_SIGNED)
-       num = (unsigned long) ((long) num >= 0)
-               ? (((long) num) >> 3)
-               : ((num >> 3) | ~(~(unsigned long) 0 >> 3));
-      else
-       num >>= 3;
+       {
+         unsigned long sign_bit = ((unsigned long) -1L >> 4) + 1;
+         num = (num ^ sign_bit) - sign_bit;
+       }
     }
 
   if (flags & OPERAND_SIGNED)
     {
       max = ((unsigned long) 1 << (bits - 1)) - 1;
       min = - ((unsigned long) 1 << (bits - 1));
-      return (long)num > max || (long)num < min;
+      return (long) num > max || (long) num < min;
     }
   else
     {
       max = ((unsigned long) 1 << bits) - 1;
-      min = 0;
-      return num > max || num < min;
+      return num > (unsigned long) max;
     }
 }
 
@@ -296,7 +295,7 @@ md_show_usage (stream)
 int
 md_parse_option (c, arg)
      int c;
-     char *arg;
+     char *arg ATTRIBUTE_UNUSED;
 {
   switch (c)
     {
@@ -332,7 +331,7 @@ md_parse_option (c, arg)
 
 symbolS *
 md_undefined_symbol (name)
-     char *name;
+     char *name ATTRIBUTE_UNUSED;
 {
   return 0;
 }
@@ -382,9 +381,9 @@ md_atof (type, litP, sizeP)
 
 void
 md_convert_frag (abfd, sec, fragP)
-     bfd *abfd;
-     asection *sec;
-     fragS *fragP;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     asection *sec ATTRIBUTE_UNUSED;
+     fragS *fragP ATTRIBUTE_UNUSED;
 {
   abort ();
 }
@@ -653,7 +652,7 @@ build_insn (opcode, opers)
 
       /* Truncate to the proper number of bits.  */
       if ((opers[i].X_op == O_constant) && check_range (number, bits, flags))
-       as_bad (_("operand out of range: %d"), number);
+       as_bad (_("operand out of range: %ld"), number);
       if (bits < 31)
        number &= 0x7FFFFFFF >> (31 - bits);
       if (flags & OPERAND_SHIFT)
@@ -677,7 +676,7 @@ build_insn (opcode, opers)
 
 static void
 write_long (opcode, insn, fx)
-     struct d30v_insn *opcode;
+     struct d30v_insn *opcode ATTRIBUTE_UNUSED;
      long long insn;
      Fixups *fx;
 {
@@ -793,11 +792,11 @@ write_2_short (opcode1, insn1, opcode2, insn2, exec_type, fx)
         we are not optimizing, then we have been asked to produce
         an error about such constructs.  For the purposes of this
         test, subroutine calls are considered to be branches.  */
-      write_1_short (opcode1, insn1, fx->next, false);
+      write_1_short (opcode1, insn1, fx->next, FALSE);
       return 1;
     }
 
-  /* Note: we do not have to worry about subroutine calls occuring
+  /* Note: we do not have to worry about subroutine calls occurring
      in the right hand container.  The return address is always
      aligned to the next 64 bit boundary, be that 64 or 32 bit away.  */
   switch (exec_type)
@@ -833,14 +832,14 @@ write_2_short (opcode1, insn1, opcode2, insn2, exec_type, fx)
          /* We must treat repeat instructions likewise, since the
             following instruction has to be separate from the repeat
             in order to be repeated.  */
-         write_1_short (opcode1, insn1, fx->next, false);
+         write_1_short (opcode1, insn1, fx->next, FALSE);
          return 1;
        }
       else if (prev_left_kills_right_p)
        {
          /* The left instruction kils the right slot, so we
             must leave it empty.  */
-         write_1_short (opcode1, insn1, fx->next, false);
+         write_1_short (opcode1, insn1, fx->next, FALSE);
          return 1;
        }
       else if (opcode1->op->unit == IU)
@@ -850,7 +849,7 @@ write_2_short (opcode1, insn1, opcode2, insn2, exec_type, fx)
              /* Case 103810 is a request from Mitsubishi that opcodes
                 with EITHER_BUT_PREFER_MU should not be executed in
                 reverse sequential order.  */
-             write_1_short (opcode1, insn1, fx->next, false);
+             write_1_short (opcode1, insn1, fx->next, FALSE);
              return 1;
            }
 
@@ -1243,7 +1242,7 @@ md_assemble (str)
 
   if ((prev_insn != -1) && prev_seg
       && ((prev_seg != now_seg) || (prev_subseg != now_subseg)))
-    d30v_cleanup (false);
+    d30v_cleanup (FALSE);
 
   if (d30v_current_align < 3)
     d30v_align (3, NULL, d30v_last_label);
@@ -1282,7 +1281,7 @@ md_assemble (str)
 
          /* If two instructions are present and we already have one saved,
             then first write it out.  */
-         d30v_cleanup (false);
+         d30v_cleanup (FALSE);
 
          /* Assemble first instruction and save it.  */
          prev_insn = do_assemble (str, &prev_opcode, 1, 0);
@@ -1343,13 +1342,13 @@ md_assemble (str)
             of NOPs for us.  */
 
          if (prev_insn != -1 && (strcmp (prev_opcode.op->name, "nop") == 0))
-           d30v_cleanup (false);
+           d30v_cleanup (FALSE);
          else
            {
              char *f;
 
              if (prev_insn != -1)
-               d30v_cleanup (true);
+               d30v_cleanup (TRUE);
              else
                {
                  f = frag_more (8);
@@ -1374,7 +1373,7 @@ md_assemble (str)
     {
       /* Can't parallelize, flush current instruction and add a
          sequential NOP.  */
-      write_1_short (&opcode, (long) insn, fixups->next->next, true);
+      write_1_short (&opcode, (long) insn, fixups->next->next, TRUE);
 
       /* Make the previous instruction the current one.  */
       extype = EXEC_UNKNOWN;
@@ -1393,7 +1392,7 @@ md_assemble (str)
     {
       if (extype != EXEC_UNKNOWN)
        as_bad (_("Instruction uses long version, so it cannot be mixed as specified"));
-      d30v_cleanup (false);
+      d30v_cleanup (FALSE);
       write_long (&opcode, insn, fixups);
       prev_insn = -1;
     }
@@ -1565,7 +1564,7 @@ do_assemble (str, opcode, shortp, is_parallel)
 
   insn = build_insn (opcode, myops);
 
-  /* Propigate multiply status.  */
+  /* Propagate multiply status.  */
   if (insn != -1)
     {
       if (is_parallel && prev_mul32_p)
@@ -1792,7 +1791,7 @@ find_format (opcode, myops, fsize, cmp_hack)
 
 arelent *
 tc_gen_reloc (seg, fixp)
-     asection *seg;
+     asection *seg ATTRIBUTE_UNUSED;
      fixS *fixp;
 {
   arelent *reloc;
@@ -1808,14 +1807,15 @@ tc_gen_reloc (seg, fixp)
                    (int) fixp->fx_r_type);
       return NULL;
     }
-  reloc->addend = fixp->fx_addnumber;
+
+  reloc->addend = 0;
   return reloc;
 }
 
 int
 md_estimate_size_before_relax (fragp, seg)
-     fragS *fragp;
-     asection *seg;
+     fragS *fragp ATTRIBUTE_UNUSED;
+     asection *seg ATTRIBUTE_UNUSED;
 {
   abort ();
   return 0;
@@ -1836,33 +1836,19 @@ md_pcrel_from_section (fixp, sec)
 void
 md_apply_fix3 (fixP, valP, seg)
      fixS *fixP;
-     valueT * valP;
-     segT seg;
+     valueT *valP;
+     segT seg ATTRIBUTE_UNUSED;
 {
   char *where;
   unsigned long insn, insn2;
-  long value = * (long *) valP;
+  long value = *valP;
 
   if (fixP->fx_addsy == (symbolS *) NULL)
     fixP->fx_done = 1;
 
-  else if (fixP->fx_pcrel)
-    ;
-
-  else
-    {
-      value = fixP->fx_offset;
-
-      if (fixP->fx_subsy != (symbolS *) NULL)
-       {
-         if (S_GET_SEGMENT (fixP->fx_subsy) == absolute_section)
-           value -= S_GET_VALUE (fixP->fx_subsy);
-         else
-           /* We don't actually support subtracting a symbol.  */
-           as_bad_where (fixP->fx_file, fixP->fx_line,
-                         _("expression too complex"));
-       }
-    }
+  /* We don't support subtracting a symbol.  */
+  if (fixP->fx_subsy != (symbolS *) NULL)
+    as_bad_where (fixP->fx_file, fixP->fx_line, _("expression too complex"));
 
   /* Fetch the instruction, insert the fully resolved operand
      value, and stuff the instruction back again.  */
@@ -1876,7 +1862,7 @@ md_apply_fix3 (fixP, valP, seg)
        as_bad (_("line %d: unable to place address of symbol '%s' into a byte"),
                fixP->fx_line, S_GET_NAME (fixP->fx_addsy));
       else if (((unsigned)value) > 0xff)
-       as_bad (_("line %d: unable to place value %x into a byte"),
+       as_bad (_("line %d: unable to place value %lx into a byte"),
                fixP->fx_line, value);
       else
        *(unsigned char *) where = value;
@@ -1887,7 +1873,7 @@ md_apply_fix3 (fixP, valP, seg)
        as_bad (_("line %d: unable to place address of symbol '%s' into a short"),
                fixP->fx_line, S_GET_NAME (fixP->fx_addsy));
       else if (((unsigned)value) > 0xffff)
-       as_bad (_("line %d: unable to place value %x into a short"),
+       as_bad (_("line %d: unable to place value %lx into a short"),
                fixP->fx_line, value);
       else
        bfd_putb16 ((bfd_vma) value, (unsigned char *) where);
@@ -2012,7 +1998,7 @@ d30v_cleanup (use_sequential)
       subseg_set (seg, subseg);
       prev_insn = -1;
       if (use_sequential)
-       prev_mul32_p = false;
+       prev_mul32_p = FALSE;
     }
 
   return 1;
@@ -2044,7 +2030,7 @@ d30v_start_line ()
     c++;
 
   if (*c == '.')
-    d30v_cleanup (false);
+    d30v_cleanup (FALSE);
 }
 
 static void
@@ -2065,8 +2051,6 @@ check_size (value, bits, file, line)
 
   if (tmp > max)
     as_bad_where (file, line, _("value too large to fit in %d bits"), bits);
-
-  return;
 }
 
 /* d30v_frob_label() is called when after a label is recognized.  */
@@ -2076,7 +2060,7 @@ d30v_frob_label (lab)
      symbolS *lab;
 {
   /* Emit any pending instructions.  */
-  d30v_cleanup (false);
+  d30v_cleanup (FALSE);
 
   /* Update the label's address with the current output pointer.  */
   symbol_set_frag (lab, frag_now);
@@ -2123,10 +2107,10 @@ d30v_align (n, pfill, label)
 
   /* Do not assume that if 'd30v_current_align >= n' and
      '! switched_seg_p' that it is safe to avoid performing
-     this alignement request.  The alignment of the current frag
+     this alignment request.  The alignment of the current frag
      can be changed under our feet, for example by a .ascii
      directive in the source code.  cf testsuite/gas/d30v/reloc.s  */
-  d30v_cleanup (false);
+  d30v_cleanup (FALSE);
 
   if (pfill == NULL)
     {
@@ -2153,7 +2137,7 @@ d30v_align (n, pfill, label)
   if (label != NULL)
     {
       symbolS     *sym;
-      int          label_seen = false;
+      int          label_seen = FALSE;
       struct frag *old_frag;
       valueT       old_value;
       valueT       new_value;
@@ -2180,7 +2164,7 @@ d30v_align (n, pfill, label)
          if (symbol_get_frag (sym) == old_frag
              && S_GET_VALUE (sym) == old_value)
            {
-             label_seen = true;
+             label_seen = TRUE;
              symbol_set_frag (sym, frag_now);
              S_SET_VALUE (sym, new_value);
            }
@@ -2197,7 +2181,7 @@ d30v_align (n, pfill, label)
 
 static void
 s_d30v_align (ignore)
-     int ignore;
+     int ignore ATTRIBUTE_UNUSED;
 {
   int align;
   char fill, *pfill = NULL;
This page took 0.028145 seconds and 4 git commands to generate.