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]

PATCH fix regression in cpperror.c


The attached patch fixes 2 testsuite regressions I
introduced with my 08-21 patch.  Somehow I must have
overlooked it when testing.  Sorry about that.

Before my 08-21 patch, I'm not sure if pfile->buffer
could ever be NULL (when an error is being reported),
so it appears the tests were useless.  After my 08-21
patch, the tests for pfile->buffer!=NULL were wrong.

I checked this into both the trunk and the compile-server
branch.
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/


2003-08-27  Per Bothner  <pbothner@apple.com>

	* cpperror.c (print_location):  Don't check for !pfile->buffer.  That
	test fails following my 08-21 change, and it seems unnecessary anyway.
	(cpp_error):  Likewise.

Index: cpperror.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cpperror.c,v
retrieving revision 1.68
diff -u -p -r1.68 cpperror.c
--- cpperror.c	26 Aug 2003 22:53:21 -0000	1.68
+++ cpperror.c	28 Aug 2003 00:14:33 -0000
@@ -38,7 +38,7 @@ static void print_location (cpp_reader *
 static void
 print_location (cpp_reader *pfile, fileline line, unsigned int col)
 {
-  if (!pfile->buffer || line == 0)
+  if (line == 0)
     fprintf (stderr, "%s: ", progname);
   else
     {
@@ -131,24 +131,19 @@ cpp_error (cpp_reader * pfile, int level
   
   va_start (ap, msgid);
 
-  if (pfile->buffer)
+  if (CPP_OPTION (pfile, traditional))
     {
-      if (CPP_OPTION (pfile, traditional))
-	{
-	  if (pfile->state.in_directive)
-	    line = pfile->directive_line;
-	  else
-	    line = pfile->line;
-	  column = 0;
-	}
+      if (pfile->state.in_directive)
+	line = pfile->directive_line;
       else
-	{
-	  line = pfile->cur_token[-1].line;
-	  column = pfile->cur_token[-1].col;
-	}
+	line = pfile->line;
+      column = 0;
     }
   else
-    line = column = 0;
+    {
+      line = pfile->cur_token[-1].line;
+      column = pfile->cur_token[-1].col;
+    }
 
   if (_cpp_begin_message (pfile, level, line, column))
     v_message (msgid, ap);

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