cpplib: diagnostic tweak

Neil Booth neilb@earthling.net
Fri Nov 17 11:16:00 GMT 2000


-include with a non-existent file would output a line number of zero
in the error message.

Neil.

	* cpperror.c (print_file_and_line): Don't display line number
	if 0.

Index: cpperror.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cpperror.c,v
retrieving revision 1.40
diff -u -p -r1.40 cpperror.c
--- cpperror.c	2000/10/28 17:59:04	1.40
+++ cpperror.c	2000/11/17 19:14:55
@@ -86,19 +86,19 @@ print_containing_files (pfile, ip)
 }
 
 static void
-print_file_and_line (filename, line, column)
+print_file_and_line (filename, line, col)
      const char *filename;
-     unsigned int line, column;
+     unsigned int line, col;
 {
   if (filename == 0 || *filename == '\0')
     filename = "<stdin>";
 
-  if (line == (unsigned int)-1)
+  if (line == 0)
     fprintf (stderr, "%s: ", filename);
-  else if (column > 0)
-    fprintf (stderr, "%s:%u:%u: ", filename, line, column);
-  else
+  else if (col == 0)
     fprintf (stderr, "%s:%u: ", filename, line);
+  else
+    fprintf (stderr, "%s:%u:%u: ", filename, line, col);
 }
 
 /* Set up for an error message: print the file and line, bump the error


More information about the Gcc-patches mailing list