cpplib: Fix -M with -include bug
Neil Booth
neilb@earthling.net
Tue Nov 28 13:28:00 GMT 2000
cpplib buffer and file handling really needs a good look at.
Neil.
* cppmacro.c (cpp_scan_buffer_nooutput): Take a boolean
indicating whether to scan all buffers on the stack or
just one.
* cppinit.c (do_includes): Update.
* cppmain.c (main): Update.
* cpplib.h: Update prototype.
Index: cppinit.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cppinit.c,v
retrieving revision 1.121
diff -u -p -r1.121 cppinit.c
--- cppinit.c 2000/11/28 21:13:33 1.121
+++ cppinit.c 2000/11/28 21:19:16
@@ -931,7 +931,7 @@ do_includes (pfile, p, scan)
/* Later: maybe update this to use the #include "" search path
if cpp_read_file fails. */
if (cpp_read_file (pfile, p->arg) && scan)
- cpp_scan_buffer_nooutput (pfile);
+ cpp_scan_buffer_nooutput (pfile, 0);
q = p->next;
free (p);
p = q;
Index: cpplib.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cpplib.h,v
retrieving revision 1.142
diff -u -p -r1.142 cpplib.h
--- cpplib.h 2000/11/28 21:13:33 1.142
+++ cpplib.h 2000/11/28 21:19:17
@@ -777,7 +777,7 @@ extern void cpp_forall_identifiers PARAM
void *));
/* In cppmacro.c */
-extern void cpp_scan_buffer_nooutput PARAMS ((cpp_reader *));
+extern void cpp_scan_buffer_nooutput PARAMS ((cpp_reader *, int));
extern void cpp_start_lookahead PARAMS ((cpp_reader *));
extern void cpp_stop_lookahead PARAMS ((cpp_reader *, int));
Index: cppmacro.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cppmacro.c,v
retrieving revision 1.31
diff -u -p -r1.31 cppmacro.c
--- cppmacro.c 2000/11/27 19:08:36 1.31
+++ cppmacro.c 2000/11/28 21:19:22
@@ -990,11 +994,12 @@ cpp_get_token (pfile, token)
/* Read each token in, until EOF. Directives are transparently
processed. */
void
-cpp_scan_buffer_nooutput (pfile)
+cpp_scan_buffer_nooutput (pfile, all_buffers)
cpp_reader *pfile;
+ int all_buffers;
{
- cpp_buffer *buffer = pfile->buffer->prev;
cpp_token token;
+ cpp_buffer *buffer = all_buffers ? 0: pfile->buffer->prev;
do
do
Index: cppmain.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cppmain.c,v
retrieving revision 1.43
diff -u -p -r1.43 cppmain.c
--- cppmain.c 2000/11/28 21:13:33 1.43
+++ cppmain.c 2000/11/28 21:19:23
@@ -95,7 +95,7 @@ main (argc, argv)
if (CPP_BUFFER (pfile))
{
if (CPP_OPTION (pfile, no_output))
- cpp_scan_buffer_nooutput (pfile);
+ cpp_scan_buffer_nooutput (pfile, 1);
else
scan_buffer (pfile);
}
More information about the Gcc-patches
mailing list