[cfe-dev] [PATCH]: adding of -x assembler-with-cpp
Chris Lattner
clattner at apple.com
Mon Nov 10 21:51:36 PST 2008
On Nov 10, 2008, at 4:05 AM, Roman Divacky wrote:
>> Please note that the preprocessor in .S mode is supposed to behave
>> slightly differently than it does on .c files. There are some
>> fixme's
>> in the preprocessor that mention some cases where this is, but they
>> obviously haven't been implemented. If you're interested in tackling
>> these, the right place to start is to add a bit to LangOptions to
>> indicate that the preprocessor should be have in assembler mode, then
>> update the PP to check this where needed.
>
> hm... I haven't found any asm related FIXME's in PP code, maybe I
> didn't
> look at the correct place. can you be more specific? or give me a
> pointer
> where I can find a documentation on the differences.
Huh, you're right. Sorry about that, I thought I added them. The
differences look like:
1) This is not a #line directive in assembler mode (it should be
passed through afaik):
# 4
2) This should not complain about an invalid preprocessor directive,
it should just pass through:
# foo
3) This #define should be implicitly set: __ASSEMBLER__=1
4) Token pasting invalid C tokens should not return an error (e.g. ".
## ." in a macro). It isn't clear if they should be returned as two
tokens, or made into one bogus pasted token ('..' in this case).
5) The stringification operator should get passed through if it's
operator is not a macro parameter. Something like this should do it:
#define X(Y) Y # Z
X(1) -> 1 # Z
It would be great to write testcases for these and compare them
against GCC in cpp-assembler mode before implementing them. These
should all be really easy to do, it is mostly just disabling existing
functionality.
-Chris
More information about the cfe-dev
mailing list