[cfe-dev] Builtins.def compile error on Windows

Kovarththanan Rajaratnam krj at rajaratnam.dk
Sat Jun 20 02:00:49 PDT 2009


Eli Friedman wrote:
> On Wed, Jun 10, 2009 at 12:03 PM, John
> Thompson<john.thompson.jtsoftware at gmail.com> wrote:
>> The file include/llvm/Config/alloca.h has a "#define alloca _alloca" which
>> substitutes the "alloca" in Builtins.def, resulting in the Builtin::BIalloca
>> reference in CGBuiltin.cpp being undefined.
> 
> Ouch, that's really, really, nasty.
> 
>> Changing "LIBBUILTIN(alloca, "v*z",         "f",     "stdlib.h")" to
>> "LIBBUILTIN(_alloca, "v*z",         "f",     "stdlib.h")",
>> and the one reference to "Builtin::BIalloca" to "Builtin::BI_alloca" in
>> CGBuiltin.cpp seems an easy fix, but I don't know if there are other issues
>> with this.
> 
> That's quite clearly the wrong fix: it's supposed to detect "alloca",
> not "_alloca".  The "alloca" being referred to here is from the source
> code being compiled and has nothing to do with any alloca function
> available on the host.
> 
> Can you find where include/llvm/Config/alloca.h is getting included
> from?  I can't seem to figure it out.

Neither could I. I did find the following in MSVC's malloc.h:

#if     !__STDC__
/* Non-ANSI names for compatibility */
#define alloca  _alloca
#endif  /* __STDC__*/

Could that be what is causing all this and not include/llvm/Config/alloca.h?

-- 
Best regards,
Kovarththanan Rajaratnam




More information about the cfe-dev mailing list