Vladimir Prus
2006-Mar-06 15:13 UTC
[LLVMdev] Re: Re: Re: New GCC4-based C/C++/ObjC front-end for LLVM
Chris Lattner wrote:> On Thu, 2 Mar 2006, Chris Lattner wrote: >>> Any ideas what could be wrong? >> >> Sorry for the delay, please try this tarball: >> http://nondot.org/sabre/2006-03-02-llvm-gcc-4.tar.gz > > Actually, do to a recent change in CVS, this tarball will probably not > work anymore. Please apply the attached (small) patch on top of it in > the gcc directory. > > Worth noting, this front-end only works with LLVM mainline, not LLVM 1.6.Without the patch, I get this: TreeToLLVM::StartFunctionBody()': ../../2006-03-02-llvm-gcc-4/gcc/llvm-convert.cpp:344: warning: statement with no effect ../../2006-03-02-llvm-gcc-4/gcc/llvm-convert.cpp: At global scope: ../../2006-03-02-llvm-gcc-4/gcc/llvm-convert.cpp:1305: error: parse error before `__attribute__' ../../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' With the patch, I get exactly the same error. The configure command was: ../2006-03-02-llvm-gcc-4/configure --enable-languages=c,c++ --enable-llvm=/space/p2/ghost/build/llvm-cvs/install --prefix=`pwd`/install --program-prefix=llvm- and my LLVM is CVS state as of Friday. Any suggestions? - Volodya
Chris Lattner
2006-Mar-07 02:43 UTC
[LLVMdev] Re: Re: Re: New GCC4-based C/C++/ObjC front-end for LLVM
On Mon, 6 Mar 2006, Vladimir Prus wrote:> ../../2006-03-02-llvm-gcc-4/gcc/llvm-convert.cpp:1305: error: parseerror> before `__attribute__'Can you send me the preprocessed .i file for this file? To work around the above error, just remove "ATTRIBUTE_UNUSED" from that line.> ../../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? If so, can you send me the preprocessed source file? What host compiler are you using? -Chris -- http://nondot.org/sabre/ http://llvm.org/
Vladimir Prus
2006-Mar-07 07:12 UTC
[LLVMdev] Re: Re: Re: Re: New GCC4-based C/C++/ObjC front-end for LLVM
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
Reasonably Related Threads
- [LLVMdev] Re: Re: Re: New GCC4-based C/C++/ObjC front-end for LLVM
- [LLVMdev] Re: Re: Re: Re: New GCC4-based C/C++/ObjC front-end for LLVM
- [LLVMdev] Re: Re: New GCC4-based C/C++/ObjC front-end for LLVM
- [LLVMdev] Re: Re: New GCC4-based C/C++/ObjC front-end for LLVM
- daemon/ warnings