This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gas warning fixes


	* 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.

Index: gas/config/tc-tic30.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-tic30.c,v
retrieving revision 1.9
diff -u -p -r1.9 tc-tic30.c
--- gas/config/tc-tic30.c	5 Sep 2002 00:01:18 -0000	1.9
+++ gas/config/tc-tic30.c	12 Dec 2002 12:45:04 -0000
@@ -27,6 +27,11 @@
 #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.  */
@@ -77,53 +82,27 @@ const pseudo_typeS md_pseudo_table[] = {
   {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;
@@ -263,7 +242,7 @@ template *opcode;
 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 */
@@ -280,7 +259,7 @@ md_assemble (line)
   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));
@@ -426,8 +405,8 @@ md_assemble (line)
   /* 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.  */
@@ -787,7 +766,7 @@ md_assemble (line)
     }
   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)
@@ -801,7 +780,7 @@ md_assemble (line)
 
 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.  */
@@ -838,7 +817,7 @@ tic30_parallel_insn (char *token)
 	{0};
 	char second_opcode[6] =
 	{0};
-	int i;
+	unsigned int i;
 	int current_opcode = -1;
 	int char_ptr = 0;
 
@@ -1012,7 +991,7 @@ tic30_parallel_insn (char *token)
     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 &
@@ -1193,7 +1172,7 @@ tic30_parallel_insn (char *token)
     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]);
@@ -1207,7 +1186,7 @@ operand *
 tic30_operand (token)
      char *token;
 {
-  int count;
+  unsigned int count;
   char ind_buffer[strlen (token)];
   operand *current_op;
 
@@ -1411,7 +1390,7 @@ tic30_operand (token)
 	      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;
 	}
     }
@@ -1540,8 +1519,8 @@ tic30_unrecognized_line (c)
 
 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;
@@ -1549,9 +1528,9 @@ md_estimate_size_before_relax (fragP, se
 
 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");
 }
@@ -1588,8 +1567,8 @@ md_apply_fix3 (fixP, valP, seg)
 
 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;
@@ -1597,14 +1576,14 @@ md_parse_option (c, arg)
 
 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;
@@ -1800,7 +1779,7 @@ md_number_to_chars (buf, val, n)
 
 arelent *
 tc_gen_reloc (section, fixP)
-     asection *section;
+     asection *section ATTRIBUTE_UNUSED;
      fixS *fixP;
 {
   arelent *rel;
@@ -1843,14 +1822,8 @@ tc_gen_reloc (section, fixP)
 }
 
 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");
 }
Index: gas/config/tc-tic30.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-tic30.h,v
retrieving revision 1.3
diff -u -p -r1.3 tc-tic30.h
--- gas/config/tc-tic30.h	8 Mar 2001 23:24:25 -0000	1.3
+++ gas/config/tc-tic30.h	12 Dec 2002 12:45:04 -0000
@@ -52,4 +52,6 @@ char *output_invalid PARAMS ((int c));
 
 extern int tic30_unrecognized_line PARAMS ((int));
 
+#define tc_aout_pre_write_hook {}
+
 #endif
Index: gas/config/tc-tic80.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-tic80.c,v
retrieving revision 1.9
diff -u -p -r1.9 tc-tic80.c
--- gas/config/tc-tic80.c	8 Jun 2002 07:37:16 -0000	1.9
+++ gas/config/tc-tic80.c	12 Dec 2002 12:45:05 -0000
@@ -26,7 +26,7 @@
   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)
 
 /* Generic assembler global variables which must be defined by all
    targets.  */
@@ -57,8 +57,6 @@ const char FLT_CHARS[] = "fF";
    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?  */
@@ -85,8 +83,8 @@ static int tic80_relax = 0;
 
 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);
@@ -96,7 +94,7 @@ md_estimate_size_before_relax (fragP, se
 
 symbolS *
 md_undefined_symbol (name)
-     char *name;
+     char *name ATTRIBUTE_UNUSED;
 {
   return 0;
 }
@@ -118,7 +116,6 @@ md_atof (type, litP, sizeP)
   LITTLENUM_TYPE words[MAX_LITTLENUMS];
   LITTLENUM_TYPE *wordP;
   char *t;
-  char *atof_ieee ();
 
   switch (type)
     {
@@ -170,20 +167,21 @@ const_overflow (num, bits, flags)
   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
@@ -201,8 +199,6 @@ get_operands (exp)
 {
   char *p = input_line_pointer;
   int numexp = 0;
-  int mflag = 0;
-  int sflag = 0;
   int parens = 0;
 
   while (*p)
@@ -426,9 +422,9 @@ find_opcode (opcode, myops)
 		 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;
 		}
@@ -465,7 +461,7 @@ find_opcode (opcode, myops)
 	    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)
@@ -709,7 +705,7 @@ build_insn (opcode, opers)
 	  else
 	    {
 	      internal_error_a (_("unhandled operand modifier"),
-				opers[expi].X_add_number);
+				(long) opers[expi].X_add_number);
 	    }
 	  break;
 	case O_big:
@@ -750,7 +746,7 @@ build_insn (opcode, opers)
 	case O_logical_or:
 	case O_max:
 	default:
-	  internal_error_a (_("unhandled expression"), X_op);
+	  internal_error_a (_("unhandled expression"), (long) X_op);
 	  break;
 	}
     }
@@ -779,7 +775,6 @@ md_assemble (str)
   unsigned char *input_line_save;
   struct tic80_opcode *opcode;
   expressionS myops[16];
-  unsigned long insn;
 
   /* Ensure there is something there to assemble.  */
   assert (str);
@@ -890,7 +885,8 @@ md_begin ()
 	  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,
@@ -925,7 +921,7 @@ size_t md_longopts_size = sizeof (md_lon
 int
 md_parse_option (c, arg)
      int c;
-     char *arg;
+     char *arg ATTRIBUTE_UNUSED;
 {
   switch (c)
     {
@@ -1000,7 +996,7 @@ md_apply_fix3 (fixP, valP, seg)
       break;
     default:
       internal_error_a (_("unhandled relocation type in fixup"),
-			fixP->fx_r_type);
+			(long) fixP->fx_r_type);
       break;
     }
 
@@ -1034,9 +1030,9 @@ md_pcrel_from (fixP)
 
 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 ();
@@ -1044,7 +1040,7 @@ md_convert_frag (headers, seg, fragP)
 
 void
 tc_coff_symbol_emit_hook (ignore)
-     symbolS *ignore;
+     symbolS *ignore ATTRIBUTE_UNUSED;
 {
 }
 
Index: gas/config/tc-tic80.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-tic80.h,v
retrieving revision 1.3
diff -u -p -r1.3 tc-tic80.h
--- gas/config/tc-tic80.h	8 Mar 2001 23:24:25 -0000	1.3
+++ gas/config/tc-tic80.h	12 Dec 2002 12:45:05 -0000
@@ -56,6 +56,6 @@
 
 #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 */

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]