This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
GNU cpp vs. '%:'
- From: Ruppert <ru at swb dot siemens dot de>
- To: gcc-help at gcc dot gnu dot org
- Cc: ru at swb dot siemens dot de
- Date: Wed, 8 May 2002 18:21:30 +0200 (MEST)
- Subject: GNU cpp vs. '%:'
- Reply-to: Ruppert <ru at swb dot siemens dot de>
Hi,
I just observed a strange behaviour of the cpp which comes with gcc-2.95.3,
which puzzles me:
A single line
#define Hugo() %:
gives the error message
`#' operator is not followed by a macro argument name
Apparently, the string '%:' is somehow interpreted specially. I looked
through the manual, but found no reference to any special treatment
of the percent sign.
Can anybody explain this?
(Note: the above macro is, of course, useless. The original error
cropped up in a much larger macro in a Imakefile which contained
substitution patterns, and these patterns contain strings like '%:'.
The macro above is the smallest string which produces the error;
if I omit the '%' or the ':' the error vanishes. If I invoke cpp
with -traditional, or if I use the cpp from Sun the error vanishes
also).
For completeness, the cpp version (built for Sparc/Solaris8):
/u1/gcc-2.95.3/solaris-sparc/bin/cpp -v
Reading specs from
/u1/gcc-2.95.3/solaris-sparc/lib/gcc-lib/sparc-sun-solaris2.8/2.95.3/specs
gcc version 2.95.3 20010315 (release)
/u1/gcc-2.95.3/solaris-sparc/lib/gcc-lib/sparc-sun-solaris2.8/2.95.3/cpp0
-lang-c -v -iprefix
/u1/snnck/gnu/gnu95q3.004/i960/lib/gcc-lib/sparc-sun-solaris2.8/2.95.3/ -Dsparc
-Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__ -D__svr4__
-D__SVR4 -D__sparc -D__sun -D__unix -Asystem(unix) -Asystem(svr4)
-D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc) -
GNU CPP version 2.95.3 20010315 (release) (sparc)
#include "..." search starts here:
#include <...> search starts here:
/u1/gcc-2.95.3/solaris-sparc/include
/u1/gcc-2.95.3/solaris-sparc/lib/gcc-lib/sparc-sun-solaris2.8/2.95.3/../../../..
/sparc-sun-solaris2.8/include
/u1/gcc-2.95.3/solaris-sparc/lib/gcc-lib/sparc-sun-solaris2.8/2.95.3/include
/usr/include
End of search list.
The following default directories have been omitted from the search path:
/u1/gcc-2.95.3/solaris-sparc/lib/gcc-lib/sparc-sun-solaris2.8/2.95.3/../../../..
/include/g++-3
End of omitted list.
Regards
Dieter Ruppert
RTS GmbH
Schwieberdingen/Germany
ru@swb.siemens.de