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 to clear cb.line_change in cpp_handle_deferred_pragma


See discussion at http://gcc.gnu.org/ml/gcc/2004-09/msg01369.html

Checked in to mainline.
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/

2004-09-29  Per Bothner  <per@bothner.com>

	* directives.c (cpp_handle_deferred_pragma):  Save, clear and restore
	cb.line_change.  Otherwise do_pragma will call the line_change
	call-back with a meaningless line number.

Index: directives.c
===================================================================
RCS file: /cvs/gcc/gcc/libcpp/directives.c,v
retrieving revision 1.6
diff -u -p -r1.6 directives.c
--- directives.c	18 Sep 2004 00:53:50 -0000	1.6
+++ directives.c	30 Sep 2004 01:13:04 -0000
@@ -1419,10 +1419,13 @@ cpp_handle_deferred_pragma (cpp_reader *
   cpp_token *saved_cur_token = pfile->cur_token;
   tokenrun *saved_cur_run = pfile->cur_run;
   bool saved_defer_pragmas = CPP_OPTION (pfile, defer_pragmas);
+  void (*saved_line_change) (cpp_reader *, const cpp_token *, int)
+    = pfile->cb.line_change;
 
   pfile->context = XNEW (cpp_context);
   pfile->context->macro = 0;
   pfile->context->prev = 0;
+  pfile->cb.line_change = NULL;
   CPP_OPTION (pfile, defer_pragmas) = false;
 
   run_directive (pfile, T_PRAGMA, s->text, s->len);
@@ -1431,6 +1434,7 @@ cpp_handle_deferred_pragma (cpp_reader *
   pfile->context = saved_context;
   pfile->cur_token = saved_cur_token;
   pfile->cur_run = saved_cur_run;
+  pfile->cb.line_change = saved_line_change;
   CPP_OPTION (pfile, defer_pragmas) = saved_defer_pragmas;
 }
 

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