* config/obj-ieee.c: Remove duplicate prototypes.
[deliverable/binutils-gdb.git] / gas / config / tc-h8300.c
index f383e79d232230175ded87bf944e15ad7b31dcda..359e3481384783ed3755a7edd3508dbfb341685a 100644 (file)
@@ -43,22 +43,21 @@ const char comment_chars[] = ";";
 const char line_comment_chars[] = "#";
 const char line_separator_chars[] = "";
 
-void cons         PARAMS ((int));
-void sbranch      PARAMS ((int));
-void h8300hmode   PARAMS ((int));
-void h8300smode   PARAMS ((int));
-void h8300hnmode  PARAMS ((int));
-void h8300snmode  PARAMS ((int));
-void h8300sxmode  PARAMS ((int));
-void h8300sxnmode PARAMS ((int));
-static void pint  PARAMS ((int));
+void sbranch (int);
+void h8300hmode (int);
+void h8300smode (int);
+void h8300hnmode (int);
+void h8300snmode (int);
+void h8300sxmode (int);
+void h8300sxnmode (int);
+static void pint (int);
 
 int Hmode;
 int Smode;
 int Nmode;
 int SXmode;
 
-#define PSIZE (Hmode ? L_32 : L_16)
+#define PSIZE (Hmode && !Nmode ? L_32 : L_16)
 
 int bsize = L_8;               /* Default branch displacement.  */
 
@@ -74,8 +73,7 @@ struct h8_instruction
 struct h8_instruction *h8_instructions;
 
 void
-h8300hmode (arg)
-     int arg ATTRIBUTE_UNUSED;
+h8300hmode (int arg ATTRIBUTE_UNUSED)
 {
   Hmode = 1;
   Smode = 0;
@@ -86,8 +84,7 @@ h8300hmode (arg)
 }
 
 void
-h8300smode (arg)
-     int arg ATTRIBUTE_UNUSED;
+h8300smode (int arg ATTRIBUTE_UNUSED)
 {
   Smode = 1;
   Hmode = 1;
@@ -98,8 +95,7 @@ h8300smode (arg)
 }
 
 void
-h8300hnmode (arg)
-     int arg ATTRIBUTE_UNUSED;
+h8300hnmode (int arg ATTRIBUTE_UNUSED)
 {
   Hmode = 1;
   Smode = 0;
@@ -111,8 +107,7 @@ h8300hnmode (arg)
 }
 
 void
-h8300snmode (arg)
-     int arg ATTRIBUTE_UNUSED;
+h8300snmode (int arg ATTRIBUTE_UNUSED)
 {
   Smode = 1;
   Hmode = 1;
@@ -124,8 +119,7 @@ h8300snmode (arg)
 }
 
 void
-h8300sxmode (arg)
-     int arg ATTRIBUTE_UNUSED;
+h8300sxmode (int arg ATTRIBUTE_UNUSED)
 {
   Smode = 1;
   Hmode = 1;
@@ -137,8 +131,7 @@ h8300sxmode (arg)
 }
 
 void
-h8300sxnmode (arg)
-     int arg ATTRIBUTE_UNUSED;
+h8300sxnmode (int arg ATTRIBUTE_UNUSED)
 {
   Smode = 1;
   Hmode = 1;
@@ -151,15 +144,13 @@ h8300sxnmode (arg)
 }
 
 void
-sbranch (size)
-     int size;
+sbranch (int size)
 {
   bsize = size;
 }
 
 static void
-pint (arg)
-     int arg ATTRIBUTE_UNUSED;
+pint (int arg ATTRIBUTE_UNUSED)
 {
   cons (Hmode ? 4 : 2);
 }
@@ -209,7 +200,7 @@ static struct hash_control *opcode_hash_control;    /* Opcode mnemonics.  */
    needs.  */
 
 void
-md_begin ()
+md_begin (void)
 {
   unsigned int nopcodes;
   struct h8_opcode *p, *p1;
@@ -333,20 +324,20 @@ struct h8_op
   expressionS exp;
 };
 
-static void clever_message PARAMS ((const struct h8_instruction *, struct h8_op *));
-static void fix_operand_size PARAMS ((struct h8_op *, int));
-static void build_bytes    PARAMS ((const struct h8_instruction *, struct h8_op *));
-static void do_a_fix_imm   PARAMS ((int, int, struct h8_op *, int));
-static void check_operand  PARAMS ((struct h8_op *, unsigned int, char *));
-static const struct h8_instruction * get_specific PARAMS ((const struct h8_instruction *, struct h8_op *, int));
-static char *get_operands PARAMS ((unsigned, char *, struct h8_op *));
-static void get_operand PARAMS ((char **, struct h8_op *, int));
-static int parse_reg PARAMS ((char *, op_type *, unsigned *, int));
-static char *skip_colonthing PARAMS ((char *, int *));
-static char *parse_exp PARAMS ((char *, struct h8_op *));
-
-static int constant_fits_width_p PARAMS ((struct h8_op *, unsigned int));
-static int constant_fits_size_p PARAMS ((struct h8_op *, int, int));
+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);
+static void check_operand (struct h8_op *, unsigned int, 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);
+static int parse_reg (char *, op_type *, unsigned *, int);
+static char *skip_colonthing (char *, int *);
+static char *parse_exp (char *, struct h8_op *);
+
+static int constant_fits_width_p (struct h8_op *, unsigned int);
+static int constant_fits_size_p (struct h8_op *, int, int);
 
 /*
   parse operands
@@ -362,11 +353,7 @@ static int constant_fits_size_p PARAMS ((struct h8_op *, int, int));
 /* Try to parse a reg name.  Return the number of chars consumed.  */
 
 static int
-parse_reg (src, mode, reg, direction)
-     char *src;
-     op_type *mode;
-     unsigned int *reg;
-     int direction;
+parse_reg (char *src, op_type *mode, unsigned int *reg, int direction)
 {
   char *end;
   int len;
@@ -479,9 +466,7 @@ parse_reg (src, mode, reg, direction)
    in OP->MODE, otherwise leave it for later code to decide.  */
 
 static char *
-parse_exp (src, op)
-     char *src;
-     struct h8_op *op;
+parse_exp (char *src, struct h8_op *op)
 {
   char *save;
 
@@ -501,9 +486,7 @@ parse_exp (src, op)
    in *MODE.  Leave *MODE unchanged otherwise.  */
 
 static char *
-skip_colonthing (src, mode)
-     char *src;
-     int *mode;
+skip_colonthing (char *src, int *mode)
 {
   if (*src == ':')
     {
@@ -550,18 +533,14 @@ skip_colonthing (src, mode)
    @@aa[:8]            memory indirect.  */
 
 static int
-constant_fits_width_p (operand, width)
-     struct h8_op *operand;
-     unsigned int width;
+constant_fits_width_p (struct h8_op *operand, unsigned int width)
 {
   return ((operand->exp.X_add_number & ~width) == 0
          || (operand->exp.X_add_number | width) == (unsigned)(~0));
 }
 
 static int
-constant_fits_size_p (operand, size, no_symbols)
-     struct h8_op *operand;
-     int size, no_symbols;
+constant_fits_size_p (struct h8_op *operand, int size, int no_symbols)
 {
   offsetT num = operand->exp.X_add_number;
   if (no_symbols
@@ -595,10 +574,7 @@ constant_fits_size_p (operand, size, no_symbols)
 }
 
 static void
-get_operand (ptr, op, direction)
-     char **ptr;
-     struct h8_op *op;
-     int direction;
+get_operand (char **ptr, struct h8_op *op, int direction)
 {
   char *src = *ptr;
   op_type mode;
@@ -689,7 +665,7 @@ get_operand (ptr, op, direction)
          *ptr = parse_exp (src + 1, op);
          if (op->exp.X_add_number >= 0x100)
            {
-             int divisor;
+             int divisor = 1;
 
              op->mode = VECIND;
              /* FIXME : 2?  or 4?  */
@@ -718,7 +694,9 @@ get_operand (ptr, op, direction)
              return;
            }
 
-         if ((mode & SIZE) != PSIZE)
+         if (((mode & SIZE) != PSIZE)
+             /* For Normal mode accept 16 bit and 32 bit pointer registers.  */
+             && (!Nmode || ((mode & SIZE) != L_32)))
            as_bad (_("Wrong size pointer register for architecture."));
 
          op->mode = src[0] == '-' ? RDPREDEC : RDPREINC;
@@ -828,7 +806,9 @@ get_operand (ptr, op, direction)
          src += len;
          if (*src == '+' || *src == '-')
            {
-             if ((mode & SIZE) != PSIZE)
+             if (((mode & SIZE) != PSIZE)
+                 /* For Normal mode accept 16 bit and 32 bit pointer registers.  */
+                 && (!Nmode || ((mode & SIZE) != L_32)))
                as_bad (_("Wrong size pointer register for architecture."));
              op->mode = *src == '+' ? RSPOSTINC : RSPOSTDEC;
              op->reg = num;
@@ -836,7 +816,9 @@ get_operand (ptr, op, direction)
              *ptr = src;
              return;
            }
-         if ((mode & SIZE) != PSIZE)
+         if (((mode & SIZE) != PSIZE)
+             /* For Normal mode accept 16 bit and 32 bit pointer registers.  */
+             && (!Nmode || ((mode & SIZE) != L_32)))
            as_bad (_("Wrong size pointer register for architecture."));
 
          op->mode = direction | IND | PSIZE;
@@ -879,10 +861,7 @@ get_operand (ptr, op, direction)
 }
 
 static char *
-get_operands (noperands, op_end, operand)
-     unsigned int noperands;
-     char *op_end;
-     struct h8_op *operand;
+get_operands (unsigned int noperands, char *op_end, struct h8_op *operand)
 {
   char *ptr = op_end;
 
@@ -1054,10 +1033,8 @@ get_rtsl_operands (char *ptr, struct h8_op *operand)
    provided.  */
 
 static const struct h8_instruction *
-get_specific (instruction, operands, size)
-     const struct h8_instruction *instruction;
-     struct h8_op *operands;
-     int size;
+get_specific (const struct h8_instruction *instruction,
+             struct h8_op *operands, int size)
 {
   const struct h8_instruction *this_try = instruction;
   const struct h8_instruction *found_other = 0, *found_mismatched = 0;
@@ -1283,10 +1260,7 @@ get_specific (instruction, operands, size)
 }
 
 static void
-check_operand (operand, width, string)
-     struct h8_op *operand;
-     unsigned int width;
-     char *string;
+check_operand (struct h8_op *operand, unsigned int width, char *string)
 {
   if (operand->exp.X_add_symbol == 0
       && operand->exp.X_op_symbol == 0)
@@ -1333,10 +1307,7 @@ check_operand (operand, width, string)
      (may relax into an 8bit absolute address).  */
 
 static void
-do_a_fix_imm (offset, nibble, operand, relaxmode)
-     int offset, nibble;
-     struct h8_op *operand;
-     int relaxmode;
+do_a_fix_imm (int offset, int nibble, struct h8_op *operand, int relaxmode)
 {
   int idx;
   int size;
@@ -1448,9 +1419,7 @@ do_a_fix_imm (offset, nibble, operand, relaxmode)
 /* Now we know what sort of opcodes it is, let's build the bytes.  */
 
 static void
-build_bytes (this_try, operand)
-     const struct h8_instruction *this_try;
-     struct h8_op *operand;
+build_bytes (const struct h8_instruction *this_try, struct h8_op *operand)
 {
   int i;
   char *output = frag_more (this_try->length);
@@ -1746,9 +1715,8 @@ build_bytes (this_try, operand)
    detect errors.  */
 
 static void
-clever_message (instruction, operand)
-     const struct h8_instruction *instruction;
-     struct h8_op *operand;
+clever_message (const struct h8_instruction *instruction,
+               struct h8_op *operand)
 {
   /* Find out if there was more than one possible opcode.  */
 
@@ -1817,9 +1785,7 @@ clever_message (instruction, operand)
    displacement in an @(d:2,ERn) operand.  */
 
 static void
-fix_operand_size (operand, size)
-     struct h8_op *operand;
-     int size;
+fix_operand_size (struct h8_op *operand, int size)
 {
   if (SXmode && (operand->mode & MODE) == DISP)
     {
@@ -1855,6 +1821,7 @@ fix_operand_size (operand, size)
           is safe.  get_specific() will relax L_24 into L_32 where
           necessary.  */
        if (Hmode
+           && !Nmode 
            && (operand->exp.X_add_number < -32768
                || operand->exp.X_add_number > 32767
                || operand->exp.X_add_symbol != 0
@@ -1881,8 +1848,7 @@ fix_operand_size (operand, size)
    the frags/bytes it assembles.  */
 
 void
-md_assemble (str)
-     char *str;
+md_assemble (char *str)
 {
   char *op_start;
   char *op_end;
@@ -2036,24 +2002,21 @@ md_assemble (str)
 
 #ifndef BFD_ASSEMBLER
 void
-tc_crawl_symbol_chain (headers)
-     object_headers *headers ATTRIBUTE_UNUSED;
+tc_crawl_symbol_chain (object_headers *headers ATTRIBUTE_UNUSED)
 {
   printf (_("call to tc_crawl_symbol_chain \n"));
 }
 #endif
 
 symbolS *
-md_undefined_symbol (name)
-     char *name ATTRIBUTE_UNUSED;
+md_undefined_symbol (char *name ATTRIBUTE_UNUSED)
 {
   return 0;
 }
 
 #ifndef BFD_ASSEMBLER
 void
-tc_headers_hook (headers)
-     object_headers *headers ATTRIBUTE_UNUSED;
+tc_headers_hook (object_headers *headers ATTRIBUTE_UNUSED)
 {
   printf (_("call to tc_headers_hook \n"));
 }
@@ -2069,10 +2032,7 @@ tc_headers_hook (headers)
    returned, or NULL on OK.  */
 
 char *
-md_atof (type, litP, sizeP)
-     char type;
-     char *litP;
-     int *sizeP;
+md_atof (int type, char *litP, int *sizeP)
 {
   int prec;
   LITTLENUM_TYPE words[MAX_LITTLENUMS];
@@ -2130,37 +2090,34 @@ struct option md_longopts[] = {
 size_t md_longopts_size = sizeof (md_longopts);
 
 int
-md_parse_option (c, arg)
-     int c ATTRIBUTE_UNUSED;
-     char *arg ATTRIBUTE_UNUSED;
+md_parse_option (int c ATTRIBUTE_UNUSED, char *arg ATTRIBUTE_UNUSED)
 {
   return 0;
 }
 
 void
-md_show_usage (stream)
-     FILE *stream ATTRIBUTE_UNUSED;
+md_show_usage (FILE *stream ATTRIBUTE_UNUSED)
 {
 }
 \f
-void tc_aout_fix_to_chars PARAMS ((void));
+void tc_aout_fix_to_chars (void);
 
 void
-tc_aout_fix_to_chars ()
+tc_aout_fix_to_chars (void)
 {
   printf (_("call to tc_aout_fix_to_chars \n"));
   abort ();
 }
 
 void
-md_convert_frag (headers, seg, fragP)
+md_convert_frag (
 #ifdef BFD_ASSEMBLER
-     bfd *headers ATTRIBUTE_UNUSED;
+                bfd *headers ATTRIBUTE_UNUSED,
 #else
-     object_headers *headers ATTRIBUTE_UNUSED;
+                object_headers *headers ATTRIBUTE_UNUSED,
 #endif
-     segT seg ATTRIBUTE_UNUSED;
-     fragS *fragP ATTRIBUTE_UNUSED;
+                segT seg ATTRIBUTE_UNUSED,
+                fragS *fragP ATTRIBUTE_UNUSED)
 {
   printf (_("call to md_convert_frag \n"));
   abort ();
@@ -2168,18 +2125,14 @@ md_convert_frag (headers, seg, fragP)
 
 #ifdef BFD_ASSEMBLER
 valueT
-md_section_align (segment, size)
-     segT segment;
-     valueT size;
+md_section_align (segT segment, valueT size)
 {
   int align = bfd_get_section_alignment (stdoutput, segment);
   return ((size + (1 << align) - 1) & (-1 << align));
 }
 #else
 valueT
-md_section_align (seg, size)
-     segT seg;
-     valueT size;
+md_section_align (segT seg, valueT size)
 {
   return ((size + (1 << section_alignment[(int) seg]) - 1)
          & (-1 << section_alignment[(int) seg]));
@@ -2188,10 +2141,7 @@ md_section_align (seg, size)
 
 
 void
-md_apply_fix3 (fixP, valP, seg)
-     fixS *fixP;
-     valueT *valP;
-     segT seg ATTRIBUTE_UNUSED;
+md_apply_fix3 (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
 {
   char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
   long val = *valP;
@@ -2220,9 +2170,8 @@ md_apply_fix3 (fixP, valP, seg)
 }
 
 int
-md_estimate_size_before_relax (fragP, segment_type)
-     register fragS *fragP ATTRIBUTE_UNUSED;
-     register segT segment_type ATTRIBUTE_UNUSED;
+md_estimate_size_before_relax (register fragS *fragP ATTRIBUTE_UNUSED,
+                              register segT segment_type ATTRIBUTE_UNUSED)
 {
   printf (_("call tomd_estimate_size_before_relax \n"));
   abort ();
@@ -2230,28 +2179,20 @@ md_estimate_size_before_relax (fragP, segment_type)
 
 /* Put number into target byte order.  */
 void
-md_number_to_chars (ptr, use, nbytes)
-     char *ptr;
-     valueT use;
-     int nbytes;
+md_number_to_chars (char *ptr, valueT use, int nbytes)
 {
   number_to_chars_bigendian (ptr, use, nbytes);
 }
 
 long
-md_pcrel_from (fixP)
-     fixS *fixP ATTRIBUTE_UNUSED;
+md_pcrel_from (fixS *fixP ATTRIBUTE_UNUSED)
 {
   abort ();
 }
 
 #ifndef BFD_ASSEMBLER
 void
-tc_reloc_mangle (fix_ptr, intr, base)
-     fixS *fix_ptr;
-     struct internal_reloc *intr;
-     bfd_vma base;
-
+tc_reloc_mangle (fixS *fix_ptr, struct internal_reloc *intr, bfd_vma base)
 {
   symbolS *symbol_ptr;
 
@@ -2310,9 +2251,7 @@ tc_reloc_mangle (fix_ptr, intr, base)
 }
 #else /* BFD_ASSEMBLER */
 arelent *
-tc_gen_reloc (section, fixp)
-     asection *section ATTRIBUTE_UNUSED;
-     fixS *fixp;
+tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
 {
   arelent *rel;
   bfd_reloc_code_real_type r_type;
This page took 0.028918 seconds and 4 git commands to generate.