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]

[CPP] -M vs -include


The following test case:

  % echo > x.h
  % echo > z.h
  % echo '#include "z.h"' > z.c
  % gcc -M -include x.h z.c

produced

  z.o: z.c x.h

instead of the expected

  z.o: z.c x.h z.h

This caused the dependencies created by glibc to be wrong, which
leads to extremely irritating non-recompilation errors.

The following patch appears to cure the problem.  Neil, can you
comment on why you added this in the first place?


r~


	* cppmacro.c (cpp_scan_nooutput): Do not set return_at_eof.

Index: cppmacro.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cppmacro.c,v
retrieving revision 1.126
diff -c -p -d -u -r1.126 cppmacro.c
--- cppmacro.c	9 Oct 2002 09:56:07 -0000	1.126
+++ cppmacro.c	2 Nov 2002 22:16:23 -0000
@@ -1198,10 +1198,6 @@ void
 cpp_scan_nooutput (pfile)
      cpp_reader *pfile;
 {
-  /* Request a CPP_EOF token at the end of this file, rather than
-     transparently continuing with the including file.  */
-  pfile->buffer->return_at_eof = true;
-
   if (CPP_OPTION (pfile, traditional))
     while (_cpp_read_logical_line_trad (pfile))
       ;


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