delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1998/07/06/13:55:04

From: ian AT cygnus DOT com (Ian Lance Taylor)
Subject: cpplib and -xc-header
6 Jul 1998 13:55:04 -0700 :
Message-ID: <199807062032.QAA13128.cygnus.cygwin32.developers@subrogation.cygnus.com>
To: brolley AT cygnus DOT com
Cc: egcs-patches AT cygnus DOT com, cygwin32-developers AT cygnus DOT com

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 AT cygnus DOT 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;

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019