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 in line-map.c for preprocessor/11361


This makes add_line_map more robust wrt erroneous #line directives, as in the bug report. Ok to check in?
--
--Per Bothner
per@bothner.com http://per.bothner.com/



2003-07-22  Per Bothner  <pbothner@apple.com>

	* line-map.c (add_line_map):  Handle invalid LEAVE request.
	Fixes PR preprocessor/11361.

Index: line-map.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/line-map.c,v
retrieving revision 1.9
diff -u -p -r1.9 line-map.c
--- line-map.c	20 Jun 2003 05:51:13 -0000	1.9
+++ line-map.c	1 Jul 2003 16:38:26 -0000
@@ -99,9 +99,15 @@ add_line_map (struct line_maps *set, enu
 
       if (MAIN_FILE_P (map - 1))
 	{
-	  set->depth--;
-	  set->used--;
-	  return NULL;
+	  if (to_file == NULL)
+	    {
+	      set->depth--;
+	      set->used--;
+	      return NULL;
+	    }
+	  error = true;
+          reason = LC_RENAME;
+          from = map - 1;
 	}
       else
 	{

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