This is the mail archive of the gcc-help@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]

GNU cpp vs. '%:'


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


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