[LLVMdev] Re: Re: Re: Re: New GCC4-based C/C++/ObjC front-end for LLVM

Vladimir Prus ghost at cs.msu.su
Mon Mar 6 23:12:46 PST 2006


Chris Lattner wrote:

> On Mon, 6 Mar 2006, Vladimir Prus wrote:
>> ../../2006-03-02-llvm-gcc-4/gcc/llvm-convert.cpp:1305: error: parse
> error
>>   before `__attribute__'
> 
> Can you send me the preprocessed .i file for this file?

Sure, I've sent it by private email (180K is too big for list).

> To work around the above error, just remove "ATTRIBUTE_UNUSED" from that
> line.

Ok, done.

>> ../../2006-03-02-llvm-gcc-4/gcc/llvm-convert.cpp: In function `tree_node*
>>   StripLLVMTranslationFn(...)':
>> ../../2006-03-02-llvm-gcc-4/gcc/llvm-convert.cpp:1312: error: `I'
>> undeclared
>>   (first use this function)
>> ../../2006-03-02-llvm-gcc-4/gcc/llvm-convert.cpp:1312: error: (Each
>> undeclared
>>   identifier is reported only once for each function it appears in.)
>> ../../2006-03-02-llvm-gcc-4/gcc/llvm-convert.cpp:1312: error: ISO C++
>> forbids
>>   declaration of `tsi_next' with no type
>> ../../2006-03-02-llvm-gcc-4/gcc/llvm-convert.cpp:1312: error: `int
>> tsi_next'
> 
> This is more strange.  The code likes this for me:
> 
>      for (tree_stmt_iterator I = tsi_start(node); !tsi_end_p(I);
>      tsi_next(&I))
>        if (TREE_CODE(tsi_stmt(I)) == LABEL_EXPR)
>          SET_DECL_LLVM(TREE_OPERAND(tsi_stmt(I), 0), 0);
> 
> Is this what you have?  

Yes, but after removing ATTRIBUTE_UNUSED the second error is gone. <rumbling
about syntax errors recovery quality in gcc.../>

> What host compiler are you using?

  gcc version 3.3.5 (Debian 1:3.3.5-13)

Should handle attributes just fine, I think. Ah, I know the problem. The
compile fails with:

    void  *data ATTRIBUTE_UNUSED) {

but works with:

    void ATTRIBUTE_UNUSED *data) {

and with:

    ATTRIBUTE_UNUSED void *data) {


IIRC, gcc used to be picky about placements of attributes. Any change you'll
change to any of working syntaxes, or, you 100% portable approach of:

    void*  /* data */) {


Thanks,
Volodya





More information about the llvm-dev mailing list