This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
cpp problem with asm
- To: gcc at gcc dot gnu dot org
- Subject: cpp problem with asm
- From: Jonathan Larmour <jlarmour at redhat dot com>
- Date: Tue, 16 Jan 2001 21:38:14 +0000
- Organization: Red Hat UK Ltd.
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