[LLVMbugs] Compile error on 64-bit x86 Solaris
zvrba at ifi.uio.no
Wed Oct 24 04:09:08 PDT 2007
I'm using gcc-4.2.2 and while compiling, I get the following error:
In file included from /home/zvrba/llvm-2.1/lib/VMCore/AsmWriter.cpp:18:
/home/zvrba/llvm-2.1/include/llvm/Assembly/PrintModulePass.h:34: error: expected ',' or '...' before numeric constant
/home/zvrba/llvm-2.1/include/llvm/Assembly/PrintModulePass.h:60: error: expected ',' or '...' before numeric constant
/home/zvrba/llvm-2.1/include/llvm/Assembly/PrintModulePass.h:60: error: default argument missing for parameter 3 of 'llvm::PrintFunctionPass::PrintFunctionPass(const std::string&, llvm::OStream*, bool)'
/home/zvrba/llvm-2.1/lib/VMCore/AsmWriter.cpp: In function 'void WriteConstantInt(std::ostream&, const llvm::Constant*, std::map<const llvm::Type*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<const llvm::Type*>, std::allocator<std::pair<const llvm::Type* const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >&, llvm::SlotMachine*)':
/home/zvrba/llvm-2.1/lib/VMCore/AsmWriter.cpp:569: error: expected primary-expression before 'const'
/home/zvrba/llvm-2.1/lib/VMCore/AsmWriter.cpp:569: error: expected `)' before 'const'
PrintModulePass(OStream *o, bool DS = false) ..
Now, the problem is that the system header <sys/regset.h> gets
included which contains the following #defines:
#define CS 15
#define DS 3
(among others). The LLVM code uses very much both of those names
which results in a buch of compiler errors similar to the above.
I have traced the error, and this header is included indirectly
through <signal.h>. Unfortunately, other system header files also
include <signal.h> so it's not _that_ simple to put #undef CS /
#undef DS in the few (3) LLVM files that explicitly include
I have tried to modify the Makefile.rules that originally contains
CPP.BaseFlags += -D_GNU_SOURCE ... [at line 455]
CPP.BaseFlags += -D_XPG4_2 ...
This still produces the error. Setting the variable to
CPP.BaseFlags += -D_XPG4_2 -U__EXTENSIONS__
produces _another_ compiler error saying that
error: '::vfwscanf' has not been declared
(among other "wide" functions). [I have played with those exact
macros after reading through the <sys/regset.h> header].
Any suggestions on how to fix this problem? I have been thinking
of a global search/replace perl script (replacing eg. CS -> CSs,
DS -> DSs), but given different contexts where these words can
appear, this seems fragile (e.g. after parentheses, before
More information about the llvm-bugs