(debug): Rewrite using VA_* macros.
(md_estimate_size_before_relax): Add ATTRIBUTE_UNUSED to args.
(md_convert_frag): Likewise.
(md_parse_option): Likewise.
(md_show_usage): Likewise.
(md_undefined_symbol): Likewise.
(tc_gen_reloc): Likewise.
(md_operand): Likewise.
(tc_aout_pre_write_hook): Delete.
(struct tic30_insn): Make "operands" unsigned.
(struct tic30_par_insn): Likewise.
(md_assemble): Likewise for "count", "i" and "numops".
(tic30_parallel_insn): Likewise for vars here.
(tic30_operand): Likewise. Remove useless unsigned >= 0 comparison.
* config/tc-tic30.h (tc_aout_pre_write_hook): Define as empty.
* config/tc-tic80.c (obj_coff_section): Delete declaration.
(md_estimate_size_before_relax): Add ATTRIBUTE_UNUSED on args.
(md_undefined_symbol): Likewise.
(md_parse_option): Likewise.
(md_convert_frag): Likewise.
(tc_coff_symbol_emit_hook): Likewise.
(md_atof): Remove declaration of atof_ieee.
(const_overflow): Warning fixes, tidy.
(get_operands): Delete unused vars.
(internal_error_a): Adjust format string to expect a long for arg.
(find_opcode): Warning fixes, simplify.
(build_insn): Cast internal_error_a arg.
(md_begin): Likewise.
(md_apply_fix3): Likewise.
(md_assemble): Delete unused var.
* config/tc-tic80.h (tc_coff_fix2rtype): Prototype.
2002-12-13 Alan Modra <amodra@bigpond.net.au>
+ * config/tc-tic30.c: #include stdarg.h or varargs.h.
+ (debug): Rewrite using VA_* macros.
+ (md_estimate_size_before_relax): Add ATTRIBUTE_UNUSED to args.
+ (md_convert_frag): Likewise.
+ (md_parse_option): Likewise.
+ (md_show_usage): Likewise.
+ (md_undefined_symbol): Likewise.
+ (tc_gen_reloc): Likewise.
+ (md_operand): Likewise.
+ (tc_aout_pre_write_hook): Delete.
+ (struct tic30_insn): Make "operands" unsigned.
+ (struct tic30_par_insn): Likewise.
+ (md_assemble): Likewise for "count", "i" and "numops".
+ (tic30_parallel_insn): Likewise for vars here.
+ (tic30_operand): Likewise. Remove useless unsigned >= 0 comparison.
+ * config/tc-tic30.h (tc_aout_pre_write_hook): Define as empty.
+ * config/tc-tic80.c (obj_coff_section): Delete declaration.
+ (md_estimate_size_before_relax): Add ATTRIBUTE_UNUSED on args.
+ (md_undefined_symbol): Likewise.
+ (md_parse_option): Likewise.
+ (md_convert_frag): Likewise.
+ (tc_coff_symbol_emit_hook): Likewise.
+ (md_atof): Remove declaration of atof_ieee.
+ (const_overflow): Warning fixes, tidy.
+ (get_operands): Delete unused vars.
+ (internal_error_a): Adjust format string to expect a long for arg.
+ (find_opcode): Warning fixes, simplify.
+ (build_insn): Cast internal_error_a arg.
+ (md_begin): Likewise.
+ (md_apply_fix3): Likewise.
+ (md_assemble): Delete unused var.
+ * config/tc-tic80.h (tc_coff_fix2rtype): Prototype.
* config/tc-z8k.c (cons, obj_coff_section): Delete declarations.
(whatreg, parse_reg, parse_exp): Make static, prototype.
(checkfor, regword, regaddr, get_ctrl_operand): Prototype.
#include "as.h"
#include "safe-ctype.h"
#include "opcode/tic30.h"
+#ifdef ANSI_PROTOTYPES
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
/* Put here all non-digit non-letter charcters that may occur in an
operand. */
{0, 0, 0}
};
-#ifdef USE_STDARG
-
-#include <stdarg.h>
+int debug PARAMS ((const char *string, ...));
int
-debug (const char *string, ...)
+debug VPARAMS ((const char *string, ...))
{
if (flag_debug)
{
- va_list argptr;
char str[100];
- va_start (argptr, string);
+ VA_OPEN (argptr, string);
+ VA_FIXEDARG (argptr, const char *, string);
vsprintf (str, string, argptr);
+ VA_CLOSE (argptr);
if (str[0] == '\0')
return (0);
- va_end (argptr);
fputs (str, USE_STDOUT ? stdout : stderr);
return strlen (str);
}
else
return 0;
}
-#else
-int
-debug (string, va_alist)
- const char *string;
- va_dcl
-{
- if (flag_debug)
- {
- va_list argptr;
- char str[100];
- int cnt;
-
- va_start (argptr, string);
- cnt = vsprintf (str, string, argptr);
- if (str[0] == NULL)
- return (0);
- va_end (argptr);
- fputs (str, USE_STDOUT ? stdout : stderr);
- return (cnt);
- }
- else
- return 0;
-}
-#endif
/* hash table for opcode lookup */
static struct hash_control *op_hash;
struct tic30_insn {
template *tm; /* Template of current instruction */
unsigned opcode; /* Final opcode */
- int operands; /* Number of given operands */
+ unsigned int operands; /* Number of given operands */
/* Type of operand given in instruction */
operand *operand_type[MAX_OPERANDS];
unsigned addressing_mode; /* Final addressing mode of instruction */
char *current_posn;
char *token_start;
char save_char;
- int count;
+ unsigned int count;
debug ("In md_assemble() with argument %s\n", line);
memset (&insn, '\0', sizeof (insn));
/* Check that number of operands is correct */
if (insn.operands != insn.tm->operands)
{
- int i;
- int numops = insn.tm->operands;
+ unsigned int i;
+ unsigned int numops = insn.tm->operands;
/* If operands are not the same, then see if any of the operands are not
required. Then recheck with number of given operands. If they are still not
the same, then give an error, otherwise carry on. */
}
debug ("Addressing mode: %08X\n", insn.addressing_mode);
{
- int i;
+ unsigned int i;
for (i = 0; i < insn.operands; i++)
{
if (insn.operand_type[i]->immediate.label)
struct tic30_par_insn {
partemplate *tm; /* Template of current parallel instruction */
- int operands[2]; /* Number of given operands for each insn */
+ unsigned operands[2]; /* Number of given operands for each insn */
/* Type of operand given in instruction */
operand *operand_type[2][MAX_OPERANDS];
int swap_operands; /* Whether to swap operands around. */
{0};
char second_opcode[6] =
{0};
- int i;
+ unsigned int i;
int current_opcode = -1;
int char_ptr = 0;
int num_ind = 0;
for (count = 0; count < 2; count++)
{
- int i;
+ unsigned int i;
for (i = 0; i < p_insn.operands[count]; i++)
{
if ((p_insn.operand_type[count][i]->op_type &
md_number_to_chars (p, (valueT) p_insn.opcode, INSN_SIZE);
}
{
- int i, j;
+ unsigned int i, j;
for (i = 0; i < 2; i++)
for (j = 0; j < p_insn.operands[i]; j++)
free (p_insn.operand_type[i][j]);
tic30_operand (token)
char *token;
{
- int count;
+ unsigned int count;
char ind_buffer[strlen (token)];
operand *current_op;
current_op->immediate.resolved = 1;
}
current_op->op_type = Disp | Abs24 | Imm16 | Imm24;
- if (current_op->immediate.u_number >= 0 && current_op->immediate.u_number <= 31)
+ if (current_op->immediate.u_number <= 31)
current_op->op_type |= IVector;
}
}
int
md_estimate_size_before_relax (fragP, segment)
- fragS *fragP;
- segT segment;
+ fragS *fragP ATTRIBUTE_UNUSED;
+ segT segment ATTRIBUTE_UNUSED;
{
debug ("In md_estimate_size_before_relax()\n");
return 0;
void
md_convert_frag (abfd, sec, fragP)
- bfd *abfd;
- segT sec;
- register fragS *fragP;
+ bfd *abfd ATTRIBUTE_UNUSED;
+ segT sec ATTRIBUTE_UNUSED;
+ register fragS *fragP ATTRIBUTE_UNUSED;
{
debug ("In md_convert_frag()\n");
}
int
md_parse_option (c, arg)
- int c;
- char *arg;
+ int c ATTRIBUTE_UNUSED;
+ char *arg ATTRIBUTE_UNUSED;
{
debug ("In md_parse_option()\n");
return 0;
void
md_show_usage (stream)
- FILE *stream;
+ FILE *stream ATTRIBUTE_UNUSED;
{
debug ("In md_show_usage()\n");
}
symbolS *
md_undefined_symbol (name)
- char *name;
+ char *name ATTRIBUTE_UNUSED;
{
debug ("In md_undefined_symbol()\n");
return (symbolS *) 0;
arelent *
tc_gen_reloc (section, fixP)
- asection *section;
+ asection *section ATTRIBUTE_UNUSED;
fixS *fixP;
{
arelent *rel;
return rel;
}
-void
-tc_aout_pre_write_hook ()
-{
- debug ("In tc_aout_pre_write_hook()\n");
-}
-
void
md_operand (expressionP)
- expressionS *expressionP;
+ expressionS *expressionP ATTRIBUTE_UNUSED;
{
debug ("In md_operand()\n");
}
extern int tic30_unrecognized_line PARAMS ((int));
+#define tc_aout_pre_write_hook {}
+
#endif
as_fatal (_("internal error:%s:%d: %s\n"), __FILE__, __LINE__, what)
#define internal_error_a(what,arg) \
- as_fatal (_("internal error:%s:%d: %s %d\n"), __FILE__, __LINE__, what, arg)
+ as_fatal (_("internal error:%s:%d: %s %ld\n"), __FILE__, __LINE__, what, arg)
\f
/* Generic assembler global variables which must be defined by all
targets. */
function to call to execute this pseudo-op
integer arg to pass to the function */
-extern void obj_coff_section ();
-
const pseudo_typeS md_pseudo_table[] = {
{ "align", s_align_bytes, 4 }, /* Do byte alignment, default is a 4 byte boundary */
{ "word", cons, 4 }, /* FIXME: Should this be machine independent? */
\f
int
md_estimate_size_before_relax (fragP, segment_type)
- fragS *fragP;
- segT segment_type;
+ fragS *fragP ATTRIBUTE_UNUSED;
+ segT segment_type ATTRIBUTE_UNUSED;
{
internal_error (_("Relaxation is a luxury we can't afford"));
return (-1);
symbolS *
md_undefined_symbol (name)
- char *name;
+ char *name ATTRIBUTE_UNUSED;
{
return 0;
}
LITTLENUM_TYPE words[MAX_LITTLENUMS];
LITTLENUM_TYPE *wordP;
char *t;
- char *atof_ieee ();
switch (type)
{
int retval = 0;
/* Only need to check fields less than 32 bits wide. */
- if (bits < 32)
- if (flags & TIC80_OPERAND_SIGNED)
- {
- max = (1 << (bits - 1)) - 1;
- min = - (1 << (bits - 1));
- retval = ((long) num > max) || ((long) num < min);
- }
- else
- {
- max = (1 << bits) - 1;
- min = 0;
- retval = (num > max) || (num < min);
- }
- return (retval);
+ if (bits >= 32)
+ return retval;
+
+ if (flags & TIC80_OPERAND_SIGNED)
+ {
+ max = (1 << (bits - 1)) - 1;
+ min = - (1 << (bits - 1));
+ retval = (long) num > max || (long) num < min;
+ }
+ else
+ {
+ max = (1 << bits) - 1;
+ retval = num > (unsigned long) max;
+ }
+ return retval;
}
/* get_operands () parses a string of operands and fills in a passed
{
char *p = input_line_pointer;
int numexp = 0;
- int mflag = 0;
- int sflag = 0;
int parens = 0;
while (*p)
expression that supplies additional information about
the operand, such as ":m" or ":s" modifiers. Check to
see that the operand matches this requirement. */
- if (!((num & TIC80_OPERAND_M_SI) && (flags & TIC80_OPERAND_M_SI)
- || (num & TIC80_OPERAND_M_LI) && (flags & TIC80_OPERAND_M_LI)
- || (num & TIC80_OPERAND_SCALED) && (flags & TIC80_OPERAND_SCALED)))
+ if (!((num & flags & TIC80_OPERAND_M_SI)
+ || (num & flags & TIC80_OPERAND_M_LI)
+ || (num & flags & TIC80_OPERAND_SCALED)))
{
match = 0;
}
case O_logical_or:
case O_max:
default:
- internal_error_a (_("unhandled expression type"), X_op);
+ internal_error_a (_("unhandled expression type"), (long) X_op);
}
}
if (!match)
else
{
internal_error_a (_("unhandled operand modifier"),
- opers[expi].X_add_number);
+ (long) opers[expi].X_add_number);
}
break;
case O_big:
case O_logical_or:
case O_max:
default:
- internal_error_a (_("unhandled expression"), X_op);
+ internal_error_a (_("unhandled expression"), (long) X_op);
break;
}
}
unsigned char *input_line_save;
struct tic80_opcode *opcode;
expressionS myops[16];
- unsigned long insn;
/* Ensure there is something there to assemble. */
assert (str);
valu = PDS_VALUE (pdsp) & ~TIC80_OPERAND_MASK;
break;
default:
- internal_error_a (_("unhandled predefined symbol bits"), symtype);
+ internal_error_a (_("unhandled predefined symbol bits"),
+ (long) symtype);
break;
}
symbol_table_insert (symbol_create (PDS_NAME (pdsp), segment, valu,
int
md_parse_option (c, arg)
int c;
- char *arg;
+ char *arg ATTRIBUTE_UNUSED;
{
switch (c)
{
break;
default:
internal_error_a (_("unhandled relocation type in fixup"),
- fixP->fx_r_type);
+ (long) fixP->fx_r_type);
break;
}
void
md_convert_frag (headers, seg, fragP)
- object_headers *headers;
- segT seg;
- fragS *fragP;
+ object_headers *headers ATTRIBUTE_UNUSED;
+ segT seg ATTRIBUTE_UNUSED;
+ fragS *fragP ATTRIBUTE_UNUSED;
{
internal_error (_("md_convert_frag() not implemented yet"));
abort ();
\f
void
tc_coff_symbol_emit_hook (ignore)
- symbolS *ignore;
+ symbolS *ignore ATTRIBUTE_UNUSED;
{
}
#define TC_COFF_FIX2RTYPE(fixP) tc_coff_fix2rtype(fixP)
-extern short tc_coff_fix2rtype ();
+extern short tc_coff_fix2rtype PARAMS ((struct fix *));
#endif /* OBJ_COFF */