Integrated preprocessor bug

Neil Booth neilb@earthling.net
Sun Nov 26 11:30:00 GMT 2000


Laurynas Biveinis wrote:-

> Consider you have dummy.h and dummy.c (their content
> doesn't matter, they can be empty), then the following 
> segfaults:
> 
> ./cc1 -imacros ./dummy.h dummy.c
> 
> If 'cc1' is replaced with 'cpp0', then it works. Also it
> works if '-imacros' is replaced with '-include'.

Actually, -imacros wasn't working either, it would just appear to.  It
would end up treating the main file as -imacros too.

Fixed with this patch.  Unfortunately, test cases are not possible
until I have -imacros and -include falling back to a path-based
scheme.

Neil.

	* cppmacro.c (cpp_scan_buffer_nooutput): Only scan the
	current buffer.

Index: cppmacro.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cppmacro.c,v
retrieving revision 1.29
diff -u -p -r1.29 cppmacro.c
--- cppmacro.c	2000/11/26 17:31:12	1.29
+++ cppmacro.c	2000/11/26 19:24:56
@@ -990,13 +990,14 @@ void
 cpp_scan_buffer_nooutput (pfile)
      cpp_reader *pfile;
 {
+  cpp_buffer *buffer = pfile->buffer->prev;
   cpp_token token;
 
   do
     do
       cpp_get_token (pfile, &token);
     while (token.type != CPP_EOF);
-  while (cpp_pop_buffer (pfile) != 0);
+  while (cpp_pop_buffer (pfile) != buffer);
 }
 
 /* Lookahead handling.  */



More information about the Gcc mailing list