This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

Fix format mismatches in gengtype.c


I got on x86-64 these warnings:

/cvs/gcc/gcc/gengtype.c:532: warning: int format, different type arg (arg 4)
/cvs/gcc/gcc/gengtype.c:576: warning: int format, different type arg (arg 5)
/cvs/gcc/gcc/gengtype.c:585: warning: int format, different type arg (arg 2)
/cvs/gcc/gcc/gengtype.c:1455: warning: int format, different type arg (arg 3)

The appended patch fixes them.  I'm currently bootstrapping and
regtesting on x86-64-linux-gnu.  Ok to commmit if it passes?

Andreas

2002-10-03  Andreas Jaeger  <aj@suse.de>

	* gengtype.c (adjust_field_rtx_def): Cast variables of type size_t
	to unsigned long, adjust printf format string.
	(output_mangled_typename): Likewise.

============================================================
Index: gcc/gengtype.c
--- gcc/gengtype.c	29 Sep 2002 13:16:42 -0000	1.18
+++ gcc/gengtype.c	3 Oct 2002 08:17:12 -0000
@@ -528,8 +528,8 @@ adjust_field_rtx_def (t, opt)
 	      else
 		{
 		  error_at_line (&lexer_line, 
-			"rtx type `%s' has `0' in position %d, can't handle",
-				 rtx_name[i], aindex);
+			"rtx type `%s' has `0' in position %lu, can't handle",
+				 rtx_name[i], (unsigned long) aindex);
 		  t = &string_type;
 		  subname = "rtint";
 		}
@@ -571,9 +571,9 @@ adjust_field_rtx_def (t, opt)
 
 	    default:
 	      error_at_line (&lexer_line, 
-		     "rtx type `%s' has `%c' in position %d, can't handle",
+		     "rtx type `%s' has `%c' in position %lu, can't handle",
 			     rtx_name[i], rtx_format[i][aindex],
-			     aindex);
+			     (unsigned long)aindex);
 	      t = &string_type;
 	      subname = "rtint";
 	      break;
@@ -582,7 +582,8 @@ adjust_field_rtx_def (t, opt)
 	  subfields = xmalloc (sizeof (*subfields));
 	  subfields->next = old_subf;
 	  subfields->type = t;
-	  subfields->name = xasprintf ("[%d].%s", aindex, subname);
+	  subfields->name = xasprintf ("[%lu].%s", (unsigned long)aindex,
+				       subname);
 	  subfields->line.file = __FILE__;
 	  subfields->line.line = __LINE__;
 	  if (t == note_union_tp)
@@ -1452,7 +1453,7 @@ output_mangled_typename (of, t)
     case TYPE_STRUCT:
     case TYPE_UNION:
     case TYPE_LANG_STRUCT:
-      oprintf (of, "%d%s", strlen (t->u.s.tag), t->u.s.tag);
+      oprintf (of, "%lu%s", (unsigned long) strlen (t->u.s.tag), t->u.s.tag);
       break;
     case TYPE_PARAM_STRUCT:
       {

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj


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