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]

64-bit patch for cpplib



Committed: obvious bugfix - `int' and `unsigned long' are not the same
thing on a 64-bit system.

It is arguably silly to use 64 bits to count lines in a source file,
but the rest of the compiler seems to be using long, so consistency
wins.

(Please, keep the bugreports coming! :)

zw

1999-04-18 17:46 -0400  Zack Weinberg  <zack@rabi.columbia.edu>

	* cppfiles.c (find_position, read_and_prescan): Use `unsigned
	long' variables consistently to count line and column numbers.

===================================================================
Index: cppfiles.c
--- cppfiles.c	1999/04/10 04:27:06	1.22
+++ cppfiles.c	1999/04/18 20:24:50
@@ -764,10 +764,10 @@
 find_position (start, limit, linep, colp)
      U_CHAR *start;
      U_CHAR *limit;
-     long *linep;
-     long *colp;
+     unsigned long *linep;
+     unsigned long *colp;
 {
-  long line = *linep, col = 0;
+  unsigned long line = *linep, col = 0;
   while (start < limit)
     {
       U_CHAR ch = *start++;
@@ -818,7 +818,8 @@
   U_CHAR *buf = (U_CHAR *) xmalloc (len);
   U_CHAR *ip, *op, *line_base;
   U_CHAR *ibase;
-  unsigned int line, deferred_newlines;
+  unsigned long line;
+  unsigned int deferred_newlines;
   int count;
   size_t offset;
   /* PIPE_BUF bytes of buffer proper, 2 to detect running off the end
@@ -1014,7 +1015,7 @@
 
 		if (CPP_OPTIONS (pfile)->warn_trigraphs)
 		  {
-		    long col;
+		    unsigned long col;
 		    find_position (line_base, op, &line, &col);
 		    line_base = op - col;
 		    cpp_warning_with_line (pfile, line, col,
@@ -1066,7 +1067,7 @@
 
   if (op[-1] != '\n')
     {
-      long col;
+      unsigned long col;
       find_position (line_base, op, &line, &col);
       cpp_warning_with_line (pfile, line, col, "no newline at end of file\n");
       if (offset + 1 > len)


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