* read.c (potable): Add string8, string16, string32 and string64. Add bit size for...
[binutils-gdb.git] / gas / config / tc-tic30.c
index 514a995b34c45fc17687793bd489e487840e1553..a86ade0353f51ab14f9b85575e2ad1271a728d5e 100644 (file)
@@ -1,5 +1,5 @@
 /* tc-c30.c -- Assembly code for the Texas Instruments TMS320C30
-   Copyright 1998, 1999, 2000, 2001, 2002, 2003
+   Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2006, 2007
    Free Software Foundation, Inc.
    Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au)
 
@@ -7,7 +7,7 @@
 
    GAS is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    GAS is distributed in the hope that it will be useful,
 #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 characters that may occur in an
    operand.  */
@@ -42,8 +37,6 @@ static char *ordinal_names[] =
   "first", "second", "third", "fourth", "fifth"
 };
 
-const int md_reloc_size = 0;
-
 const char comment_chars[]        = ";";
 const char line_comment_chars[]   = "*";
 const char line_separator_chars[] = "";
@@ -86,7 +79,7 @@ const pseudo_typeS md_pseudo_table[] =
   {0, 0, 0}
 };
 
-static int
+static int ATTRIBUTE_PRINTF_1
 debug (const char *string, ...)
 {
   if (flag_debug)
@@ -279,15 +272,17 @@ struct tic30_insn
 struct tic30_insn insn;
 static int found_parallel_insn;
 
-static char output_invalid_buf[8];
+static char output_invalid_buf[sizeof (unsigned char) * 2 + 6];
 
 static char *
 output_invalid (char c)
 {
   if (ISPRINT (c))
-    sprintf (output_invalid_buf, "'%c'", c);
+    snprintf (output_invalid_buf, sizeof (output_invalid_buf),
+             "'%c'", c);
   else
-    sprintf (output_invalid_buf, "(0x%x)", (unsigned) c);
+    snprintf (output_invalid_buf, sizeof (output_invalid_buf), 
+             "(0x%x)", (unsigned char) c);
   return output_invalid_buf;
 }
 
@@ -439,9 +434,9 @@ tic30_operand (char *token)
 
          debug ("Expression type: %d\n",
                 current_op->direct.direct_expr.X_op);
-         debug ("Expression addnum: %d\n",
-                current_op->direct.direct_expr.X_add_number);
-         debug ("Segment: %d\n", retval);
+         debug ("Expression addnum: %ld\n",
+                (long) current_op->direct.direct_expr.X_add_number);
+         debug ("Segment: %p\n", retval);
 
          input_line_pointer = save_input_line_pointer;
 
@@ -609,9 +604,9 @@ tic30_operand (char *token)
              retval = expression (&current_op->immediate.imm_expr);
              debug ("Expression type: %d\n",
                     current_op->immediate.imm_expr.X_op);
-             debug ("Expression addnum: %d\n",
-                    current_op->immediate.imm_expr.X_add_number);
-             debug ("Segment: %d\n", retval);
+             debug ("Expression addnum: %ld\n",
+                    (long) current_op->immediate.imm_expr.X_add_number);
+             debug ("Segment: %p\n", retval);
              input_line_pointer = save_input_line_pointer;
 
              if (current_op->immediate.imm_expr.X_op == O_constant)
@@ -1140,7 +1135,7 @@ md_apply_fix (fixS *fixP,
   debug ("Values in fixP\n");
   debug ("fx_size = %d\n", fixP->fx_size);
   debug ("fx_pcrel = %d\n", fixP->fx_pcrel);
-  debug ("fx_where = %d\n", fixP->fx_where);
+  debug ("fx_where = %ld\n", fixP->fx_where);
   debug ("fx_offset = %d\n", (int) fixP->fx_offset);
   {
     char *buf = fixP->fx_frag->fr_literal + fixP->fx_where;
@@ -1182,11 +1177,11 @@ md_undefined_symbol (char *name ATTRIBUTE_UNUSED)
 valueT
 md_section_align (segT segment, valueT size)
 {
-  debug ("In md_section_align() segment = %d and size = %d\n",
-        segment, size);
+  debug ("In md_section_align() segment = %p and size = %lu\n",
+        segment, (unsigned long) size);
   size = (size + 3) / 4;
   size *= 4;
-  debug ("New size value = %d\n", size);
+  debug ("New size value = %lu\n", (unsigned long) size);
   return size;
 }
 
@@ -1196,7 +1191,7 @@ md_pcrel_from (fixS *fixP)
   int offset;
 
   debug ("In md_pcrel_from()\n");
-  debug ("fx_where = %d\n", fixP->fx_where);
+  debug ("fx_where = %ld\n", fixP->fx_where);
   debug ("fx_size = %d\n", fixP->fx_size);
   /* Find the opcode that represents the current instruction in the
      fr_literal storage area, and check bit 21.  Bit 21 contains whether the