[LLVMbugs] [Bug 4513] New: Builtin::BIalloca not defined under MSVC
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Tue Jul 7 13:04:41 PDT 2009
http://llvm.org/bugs/show_bug.cgi?id=4513
Summary: Builtin::BIalloca not defined under MSVC
Product: clang
Version: unspecified
Platform: PC
OS/Version: Windows XP
Status: NEW
Keywords: build-problem, portability
Severity: normal
Priority: P2
Component: Basic
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: abbeyj at gmail.com
CC: llvmbugs at cs.uiuc.edu
When compiling under MSVC, Builtin::BIalloca is not declared. This causes
CGBuiltin.cpp to fail to compile.
The problem is that the system headers have this:
#if !__STDC__
/* Non-ANSI names for compatibility */
#define alloca _alloca
#endif /* __STDC__*/
When Builtin.h #includes Builtins.def it does so with BUILTIN defined as:
#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
LIBBUILTIN is not defined so Builtins.def supplies a default definition:
#if defined(BUILTIN) && !defined(LIBBUILTIN)
# define LIBBUILTIN(ID, TYPE, ATTRS, HEADER) BUILTIN(ID, TYPE, ATTRS)
#endif
Then the line
LIBBUILTIN(alloca, "v*z", "f", "stdlib.h")
expands to |BI_alloca,| instead of the intended |BIalloca,|
This happens because LIBBUILTIN is defined in terms of BUILTIN. The
preprocessor rescans and expands the parameter before the concat. If the line
was |BUILTIN(alloca, ...)| then it would work properly.
Any of the following should fix this:
1) Explicitly #undef alloca
2) Change Builtins.h to explictly #define LIBBUILTIN and remove the default
definition from Builtins.def
3) Change the default definition in Builtins.def to:
# define LIBBUILTIN(ID, TYPE, ATTRS, HEADER) BUILTIN(##ID, TYPE, ATTRS)
but this isn't portable. I don't know if there's a portable way to stop the
preprocessor from rescanning.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list