[LLVMdev] Apple's GCC and .s/.S files in llvm-test (fwd)
Chris Lattner
sabre at nondot.org
Tue Mar 25 11:28:27 PDT 2008
On Tue, 25 Mar 2008, Dale Johannesen wrote:
>> On Mar 24, 2008, at 5:40 PM, Dale Johannesen wrote:
>> [...]
>>> I don't see a good way to do
>>> full-line comments that works both if you run the preprocessor and if
>>> you don't.
>>
>>
>> Could you use "##" instead of "#"?
>
> Pragmatically, that works (as I'm sure you know). Digging into the
> legalities of C99 I'm not sure that it's guaranteed to work, though.
> Unknown directives actually match the "non-directive" case in the
> grammar in 6.10; while nothing is said anywhere about semantics that I
> can find, I'm not sure why gcc feels this should be a hard error at
> all....
I think that this is an extremely clever hack, and is nice and simple. It
works because ## is a token that just gets passed through when not in a
macro replacement list. Because of maximal munch, it prevents the
preprocessor from seeing it as a #.
Dale, do you see any problem with changing the "comment character" to
"##"?
-Chris
--
http://nondot.org/sabre/
http://llvm.org/
More information about the llvm-dev
mailing list