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]

cpplib and -xc-header


cccp.c does this in main:
      cplusplus_comments = 1;
cpplib.c does this in cpp_options_init:
  opts->cplusplus_comments = 0;

This difference normally does not matter, because cpp is normally
invoked with an implicit -lang-c option.  The -lang-c option will set
opts->cplusplus_comments to 1.

However, if you use the -xc-header option, then you get different
results:

subrogation> cat ~/foo1.c
// foo
subrogation> gcc/xgcc -Bgcc/ -E -xc-header ~/foo1.c
# 1 "/home/ian/foo1.c"
 
subrogation> gcc-cpplib/xgcc -Bgcc-cpplib/ -E -xc-header ~/foo1.c  
# 1 "/home/ian/foo1.c"
// foo

This happens to show up when gcc is invoked by the cygwin32 windres
program.  windres uses -xc-header because it needs to run the
preprocessor on files which do not have a -h extension.

I've appended the obvious patch.  This may be incorrect for some
reason, in which case the alternative is to fix the c-header entry in
gcc.c to pass -lang-c when invoking cpp.

Ian


Mon Jul  6 16:27:49 1998  Ian Lance Taylor  <ian@cygnus.com>

	* cpplib.c (cpp_options_init): Initialize cplusplus_comments to 1,
	matching July 18, 1995 change to cccp.c.


Index: cpplib.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/cpplib.c,v
retrieving revision 1.50
diff -p -r1.50 cpplib.c
*** cpplib.c	1998/06/24 18:50:28	1.50
--- cpplib.c	1998/07/06 20:25:55
*************** cpp_options_init (opts)
*** 757,763 ****
    opts->no_output = 0;
    opts->remap = 0;
    opts->cplusplus = 0;
!   opts->cplusplus_comments = 0;
  
    opts->verbose = 0;
    opts->objc = 0;
--- 757,763 ----
    opts->no_output = 0;
    opts->remap = 0;
    opts->cplusplus = 0;
!   opts->cplusplus_comments = 1;
  
    opts->verbose = 0;
    opts->objc = 0;


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