cpp problem with asm
Jonathan Larmour
jlarmour@redhat.com
Tue Jan 16 13:38:00 GMT 2001
Hi guys,
First off, I know there have been points made here that cpp is not
supported with languages other than C/C++, and I've read the relevant bit
of cpp.texi. Still, it is useful for preprocessing assembler, and even the
driver recognises that by accepting .S files and passing -lang-asm to cpp0,
which then knows to not complain about unknown directives (in
cpplib.c:354). However there is still a problem:
The issue is revealed in the following snippet. The "# foo" etc. would be
assembler comments.
#if 0 // must be false
# foo
# fee
# fie
# foe only this one
# fum and this one are reported
#elif 0 // dont care
# bundy
#endif
If this is saved as foo.S, and compiled with (e.g.) "sh-elf-gcc -Wundef -E
foo.S" with current gcc, we get:
foo.S:6:11: warning: "fum" is not defined
foo.S:5:11: warning: "foe" is not defined
foo.S:5:11: missing binary operator
Curiously, as described, this only matters when a #elif is present and the
#if is false. The only tokens reported are the latter two.
I think the code at cpplib.c:354 isn't correct. It does not result in the #
and token just being output verbatim - instead it is put in the lookahead
list for possible processing in subsequent directives. I think.
So can anyone wiser about cpp have a look or give me more pointers? Thanks.
Jifl
--
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Un cheval, pas du glue. Pas du cheval, beaucoup du glue. || Opinions==mine
More information about the Gcc
mailing list