Fix bug in cppcharset on 64-bit platforms

Andreas Jaeger aj@suse.de
Mon Apr 21 10:31:00 GMT 2003


I just got on x86-64 this error while bootstrapping mainline:

/usr/src/aj/cvs/gcc/gcc/cppcharset.c: In function `_cpp_valid_ucn':
/usr/src/aj/cvs/gcc/gcc/cppcharset.c:95: warning: field precision is not type int (arg 4)
/usr/src/aj/cvs/gcc/gcc/cppcharset.c:104: warning: field precision is not type int (arg 4)
/usr/src/aj/cvs/gcc/gcc/cppcharset.c:113: warning: field precision is not type int (arg 4)
/usr/src/aj/cvs/gcc/gcc/cppcharset.c:117: warning: field precision is not type int (arg 4)
make[2]: *** [cppcharset.o] Error 1

I'm testing the appended patch now and will commit it as obvious after
bootstrapping,

Andreas

2003-04-21  Andreas Jaeger  <aj@suse.de>

	* cppcharset.c (_cpp_valid_ucn): Cast field precision to int.

============================================================
Index: gcc/cppcharset.c
--- gcc/cppcharset.c	20 Apr 2003 07:29:20 -0000	1.1
+++ gcc/cppcharset.c	21 Apr 2003 10:30:01 -0000
@@ -92,7 +92,7 @@ _cpp_valid_ucn (pfile, pstr, identifier_
   if (length)
     /* We'll error when we try it out as the start of an identifier.  */
     cpp_error (pfile, DL_ERROR, "incomplete universal character name %.*s",
-	       str - base, base);
+	       (int) (str - base), base);
   /* The standard permits $, @ and ` to be specified as UCNs.  We use
      hex escapes so that this also works with EBCDIC hosts.  */
   else if ((result < 0xa0
@@ -101,7 +101,7 @@ _cpp_valid_ucn (pfile, pstr, identifier_
 	   || (result >= 0xD800 && result <= 0xDFFF))
     {
       cpp_error (pfile, DL_ERROR, "%.*s is not a valid universal character",
-		 str - base, base);
+		 (int) (str - base), base);
     }
   else if (identifier_pos)
     {
@@ -110,11 +110,11 @@ _cpp_valid_ucn (pfile, pstr, identifier_
       if (validity == 0)
 	cpp_error (pfile, DL_ERROR,
 		   "universal character %.*s is not valid in an identifier",
-		   str - base, base);
+		   (int) (str - base), base);
       else if (validity == 2 && identifier_pos == 1)
 	cpp_error (pfile, DL_ERROR,
    "universal character %.*s is not valid at the start of an identifier",
-		   str - base, base);
+		   (int) (str - base), base);
     }
 
   if (result == 0)

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



More information about the Gcc-patches mailing list