Vladimir A. Merzliakov
2005-Oct-24 04:48 UTC
[LLVMdev] [patch] Fix problems with build LLVM using gcc 4.1.0 (gcc CVS mainline)
Hi! I have some problems with build current CVS version LLVM using GCC 4.1.0 (GCC CVS mainline version). 1) Build terminate with error: llvm[3]: Compiling SparcV8CodeEmitter.cpp for Debug build /usr/home/wanderer/pkg/build/llvm/obj/lib/Target/SparcV8/SparcV8GenCodeEmitter.inc:11: error: definition of 'unsigned int llvm::<unnamed>::SparcV8CodeEmitter::getBinaryCodeForInstr(llvm::MachineInstr&)' is not in namespace enclosing 'llvm::<unnamed>::SparcV8CodeEmitter' gmake[3]: *** [/usr/home/wanderer/pkg/build/llvm/obj/lib/Target/SparcV8/Debug/SparcV8CodeEmitter.o] Error 1 Problem in including SparcV8GenCodeEmitter.inc: namespace llvm { ... #include "SparcV8GenCodeEmitter.inc" } // end llvm namespace But SparcV8GenCodeEmitter.inc generated with namespace llvm { ... } // end llvm namespace 2) Same error but some diff. problem with AlphaCodeEmitter.cpp and PPCCodeEmitter.cpp: GCC don't like definition member-functions in global namespace with declaration in llvm::<unnamed> : 3) Patch suggested in http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20051017/028898.html move END_WITH_NULL to before function name. Vladimir === Patches ========================== --- lib/Target/SparcV8/SparcV8CodeEmitter.cpp Mon Oct 24 08:25:17 2005 +++ lib/Target/SparcV8/SparcV8CodeEmitter.cpp.new Mon Oct 24 03:17:38 2005 @@ -181,6 +181,6 @@ abort(); } -#include "SparcV8GenCodeEmitter.inc" - } // end llvm namespace + +#include "SparcV8GenCodeEmitter.inc" --- lib/Target/Alpha/AlphaCodeEmitter.cpp Mon Oct 24 08:25:17 2005 +++ lib/Target/Alpha/AlphaCodeEmitter.cpp.new Mon Oct 24 07:08:42 2005 @@ -23,7 +23,8 @@ #include "llvm/Function.h" #include "llvm/Support/Debug.h" #include "llvm/ADT/Statistic.h" -using namespace llvm; + +namespace llvm { namespace { Statistic<> @@ -72,7 +73,7 @@ /// createAlphaCodeEmitterPass - Return a pass that emits the collected Alpha code /// to the specified MCE object. -FunctionPass *llvm::createAlphaCodeEmitterPass(MachineCodeEmitter &MCE) { +FunctionPass *createAlphaCodeEmitterPass(MachineCodeEmitter &MCE) { return new AlphaCodeEmitter(MCE); } @@ -234,6 +235,7 @@ return rv; } +} // end llvm namespace #include "AlphaGenCodeEmitter.inc" --- lib/Target/PowerPC/PPCCodeEmitter.cpp Mon Oct 24 08:25:17 2005 +++ lib/Target/PowerPC/PPCCodeEmitter.cpp.new Mon Oct 24 06:39:29 2005 @@ -22,7 +22,8 @@ #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/Passes.h" #include "llvm/Support/Debug.h" -using namespace llvm; + +namespace llvm { namespace { class PPCCodeEmitter : public MachineFunctionPass { @@ -260,6 +261,8 @@ return rv; } + +} // end llvm namespace #include "PPCGenCodeEmitter.inc" --- include/llvm/Support/CommandLine.h Mon Oct 24 08:25:16 2005 +++ include/llvm/Support/CommandLine.h.new Mon Oct 24 08:17:09 2005 @@ -334,13 +334,8 @@ } }; -// Silly GCC doesn't allow attributes on a function definition. template<class DataType> -ValuesClass<DataType> values(const char *Arg, DataType Val, const char *Desc, - ...) END_WITH_NULL; - -template<class DataType> -ValuesClass<DataType> values(const char *Arg, DataType Val, const char *Desc, +ValuesClass<DataType> END_WITH_NULL values(const char *Arg, DataType Val, const char *Desc, ...) { va_list ValueArgs; va_start(ValueArgs, Desc);
Chris Lattner
2005-Oct-24 05:04 UTC
[LLVMdev] [patch] Fix problems with build LLVM using gcc 4.1.0 (gcc CVS mainline)
On Mon, 24 Oct 2005, Vladimir A. Merzliakov wrote:> I have some problems with build current CVS version LLVM using GCC 4.1.0 (GCC > CVS mainline version).Thanks!> 1) Build terminate with error: > > llvm[3]: Compiling SparcV8CodeEmitter.cpp for Debug build > /usr/home/wanderer/pkg/build/llvm/obj/lib/Target/SparcV8/SparcV8GenCodeEmitter.inc:11: > error: definition of 'unsigned intPatch applied: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20051017/028993.html> 2) Same error but some diff. problem with AlphaCodeEmitter.cpp and > PPCCodeEmitter.cpp: > > GCC don't like definition member-functions in global namespace with > declaration in llvm::<unnamed> :Can you try this patch and see if it works? I'd rather not put the entire file in namespace scope like V8: Index: AlphaCodeEmitter.cpp ==================================================================RCS file: /home/vadve/shared/PublicCVS/llvm/lib/Target/Alpha/AlphaCodeEmitter.cpp,v retrieving revision 1.6 diff -u -r1.6 AlphaCodeEmitter.cpp --- AlphaCodeEmitter.cpp 4 Aug 2005 15:32:36 -0000 1.6 +++ AlphaCodeEmitter.cpp 24 Oct 2005 04:57:10 -0000 @@ -72,9 +72,11 @@ /// createAlphaCodeEmitterPass - Return a pass that emits the collected Alpha code /// to the specified MCE object. -FunctionPass *llvm::createAlphaCodeEmitterPass(MachineCodeEmitter &MCE) { +namespace llvm { +FunctionPass *createAlphaCodeEmitterPass(MachineCodeEmitter &MCE) { return new AlphaCodeEmitter(MCE); } +} bool AlphaCodeEmitter::runOnMachineFunction(MachineFunction &MF) { II = ((AlphaTargetMachine&)MF.getTarget()).getInstrInfo(); If this works, I'll fix Alpha and PPC. I'm suprised though that it doesn't work and if not, that it only affects these two files. Maybe I don't understand the issue.> 3) Patch suggested in > http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20051017/028898.html > move END_WITH_NULL to before function name.Looks good, applied: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20051024/028994.html Thanks! -Chris> === Patches ==========================> > --- lib/Target/SparcV8/SparcV8CodeEmitter.cpp Mon Oct 24 08:25:17 2005 > +++ lib/Target/SparcV8/SparcV8CodeEmitter.cpp.new Mon Oct 24 03:17:38 2005 > @@ -181,6 +181,6 @@ > abort(); > } > > -#include "SparcV8GenCodeEmitter.inc" > - > } // end llvm namespace > + > +#include "SparcV8GenCodeEmitter.inc" > > --- lib/Target/Alpha/AlphaCodeEmitter.cpp Mon Oct 24 08:25:17 2005 > +++ lib/Target/Alpha/AlphaCodeEmitter.cpp.new Mon Oct 24 07:08:42 2005 > @@ -23,7 +23,8 @@ > #include "llvm/Function.h" > #include "llvm/Support/Debug.h" > #include "llvm/ADT/Statistic.h" > -using namespace llvm; > + > +namespace llvm { > > namespace { > Statistic<> > @@ -72,7 +73,7 @@ > > /// createAlphaCodeEmitterPass - Return a pass that emits the collected Alpha > code > /// to the specified MCE object. > -FunctionPass *llvm::createAlphaCodeEmitterPass(MachineCodeEmitter &MCE) { > +FunctionPass *createAlphaCodeEmitterPass(MachineCodeEmitter &MCE) { > return new AlphaCodeEmitter(MCE); > } > > @@ -234,6 +235,7 @@ > return rv; > } > > +} // end llvm namespace > > #include "AlphaGenCodeEmitter.inc" > > --- lib/Target/PowerPC/PPCCodeEmitter.cpp Mon Oct 24 08:25:17 2005 > +++ lib/Target/PowerPC/PPCCodeEmitter.cpp.new Mon Oct 24 06:39:29 2005 > @@ -22,7 +22,8 @@ > #include "llvm/CodeGen/MachineInstrBuilder.h" > #include "llvm/CodeGen/Passes.h" > #include "llvm/Support/Debug.h" > -using namespace llvm; > + > +namespace llvm { > > namespace { > class PPCCodeEmitter : public MachineFunctionPass { > @@ -260,6 +261,8 @@ > > return rv; > } > + > +} // end llvm namespace > > #include "PPCGenCodeEmitter.inc" > > --- include/llvm/Support/CommandLine.h Mon Oct 24 08:25:16 2005 > +++ include/llvm/Support/CommandLine.h.new Mon Oct 24 08:17:09 2005 > @@ -334,13 +334,8 @@ > } > }; > > -// Silly GCC doesn't allow attributes on a function definition. > template<class DataType> > -ValuesClass<DataType> values(const char *Arg, DataType Val, const char > *Desc, > - ...) END_WITH_NULL; > - > -template<class DataType> > -ValuesClass<DataType> values(const char *Arg, DataType Val, const char > *Desc, > +ValuesClass<DataType> END_WITH_NULL values(const char *Arg, DataType Val, > const char *Desc, > ...) { > va_list ValueArgs; > va_start(ValueArgs, Desc); > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-Chris -- http://nondot.org/sabre/ http://llvm.org/
Vladimir A. Merzliakov
2005-Oct-24 06:32 UTC
[LLVMdev] [patch] Fix problems with build LLVM using gcc 4.1.0(gcc CVS mainline)
>> 2) Same error but some diff. problem with AlphaCodeEmitter.cpp and >> PPCCodeEmitter.cpp: >> >> GCC don't like definition member-functions in global namespace with >> declaration in llvm::<unnamed> :Sorry for wrong comment. Must be: GCC 4.1.0 don't like definition member-functions in llvm namespace with declaration in <global>::<unnamed> namespace For example PPCCodeEmitter.cpp: using namespace llvm; namespace { class PPCCodeEmitter : public MachineFunctionPass { ... } ... } ... #include "PPCGenCodeEmitter.inc" But PPCCodeEmitter.inc: namespace llvm { ... } // end llvm namespace As result LLVM build terminate with error: /usr/home/wanderer/pkg/build/llvm/obj/lib/Target/PowerPC/PPCGenCodeEmitter.inc:11: error: definition of 'unsigned int<unnamed>::PPCCodeEmitter::getBinaryCodeForInstr(llvm::MachineInstr&)' is not in namespace enclosing '<unnamed>::PPCCodeEmitter' After adding "namespace llvm {" in AlphaCodeEmitter.cpp gcc 4.1.0 terminate build with error: /home/wanderer/pkg/build/llvm/src/llvm/lib/Target/Alpha/AlphaCodeEmitter.cpp:76: error: explicit qualification in declaration of 'llvm::FunctionPass* llvm::createAlphaCodeEmitterPass(llvm::MachineCodeEmitter&)' As result I remove llvm:: from line: FunctionPass *llvm::createAlphaCodeEmitterPass(MachineCodeEmitter &MCE) { Vladimir
Apparently Analagous Threads
- [LLVMdev] [patch] Fix problems with build LLVM using gcc 4.1.0 (gcc CVS mainline)
- [LLVMdev] [patch] Fix problems with build LLVM using gcc 4.1.0(gcc CVS mainline)
- [LLVMdev] [patch] Fix problems with build LLVM using gcc 4.1.0(gcc CVS mainline)
- [LLVMdev] JITCodeEmitter patch - up for comments
- [LLVMdev] PowerPC : Assertion `MovePCtoLROffset && "MovePCtoLR not seen yet?"' failed.