[LLVMdev] Apple's GCC and .s/.S files in llvm-test (fwd)

David Vandevoorde daveed at vandevoorde.com
Tue Mar 25 11:04:19 PDT 2008


On Mar 25, 2008, at 1:08 PM, Dale Johannesen wrote:
>
> On Mar 24, 2008, at 3:18 PM, David Vandevoorde 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....

"##" is a punctuator (6.4.6) and therefore a preprocessing token of  
its own (6.4/1).

A line that starts with "##" is therefore a text-line in 6.10/1  
parlance (i.e., it doesn't match the "# non-directive" rule), and so  
yes, I think it's guaranteed to work on the preprocessor side of  
things.  (I know next to nothing about the assembler side of things.)

I don't know either why GCC faults non-directive "# ..." cases.  Maybe  
it's a C89 leftover, or maybe it has to do with the older "# <line- 
number>" forms.

	Daveed




More information about the llvm-dev mailing list