[PATCH]: adding of -x assembler-with-cpp

hi

I need ccc -x assembler-with-cpp so I got to implement it. I am
not sure if this is correct but it seems to work... what do you
think about it?

roman

clang.patch (2.42 KB)

Looks like a great first step, applied, thanks!:
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20081020/008416.html

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.

-Chris

I got confused by freebsd strange nomenclature and I made a mistake,
please commit this:

Index: Driver/clang.cpp

hi

I need ccc -x assembler-with-cpp so I got to implement it. I am
not sure if this is correct but it seems to work... what do you
think about it?

I got confused by freebsd strange nomenclature and I made a mistake,
please commit this:

Yep, you're right, applied!

-chris

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.

thnx!

roman

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