SUMMARY: strange "cc -E" behaviour

From: Willi Burmeister <>
Date: Sun Jun 05 2005 - 14:37:52 EDT
Hi SunManagers,

my problem:

I tried to understand the different behaviour of several C preprocessors
while parsing a small test file on my Solaris 10 x86

#define SWITCH -g

- /usr/ccs/lib/cpp
- /usr/sfw/bin/cpp
- /usr/sfw/bin/gcc -E

creates '-g'

- /opt/SUNWspro/bin/cc -E

creates '- g'. Note the extra whitespace.

The "solution"

This behaviour of all preprocessors is correct, because C preprocessors
has to create standard compliant C code, and '-g' is equal to '- g' in C.

We can get the output without whitespace with Suns C compiler too by using 
"cc -E -Xs".

Thanks again to Casper Dik for his full description of the behaviour.

Wesley W. Garland asked what I really tried to do.

I tried to compile emacs 21.4 on my Solaris 10 x86 system using Suns C
compiler. The configure script uses /usr/ccs/lib/cpp as preprocessor
and this is not able to parse for example /usr/include/sys/isa_defs.h
without an error.

Setting CPP to 'cc -E' creates:

  What compiler should emacs be built with?               cc  - g - O 

The configure script creates a small file with several defines and than
calls eval with the output of the preprocessed file:

eval `${CPP} -Isrc ${tempcname} \
       | sed -n -e 's/^configure___ \([^=]*=\)\(.*\)$/\1"\2"/p'`

The maintainer of emacs should better go with M4 for this.

I'm now calling configure with

  CC="cc -xc99=%none"
  CPP=""cc -E -Xs"

Thanks again to all for this great list

sunmanagers mailing list
Received on Sun Jun 5 14:38:35 2005

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:47 EST