-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Builtin::BIalloca not defined under MSVC #4885
Comments
#undef'ing alloca is the right fix. Please prepare a patch for this and I'd be happy to apply it. I would do it, but I can't test on VC++. |
#undef alloca for VC++ |
The #undef shouldn't go in the .def file, please add it to the .cpp or .h file that #includes the .def file. Thanks, sorry for the confusion. |
#undef alloca for VC++ (take 2) |
Looks great, applied, thanks! |
[swift/release/5.7][LLDB][ClangASTImporter] Revert "[lldb] Disable minimal import mode for RecordDecls that back FieldDecls"
Added in 26670dc to workaround #4885. Windows CI and a local Windows build are happy with this change, so it seems like this has been properly fixed at some point. If this does break somebody, this can be easily reverted. (Also, Linux does the same `#define alloca` in system headers, so I'm not sure why it'd be different on Windows) This is tech debt that caused breakages, see comments on #71709.
Extended Description
When compiling under MSVC,
Builtin::BIalloca
is not declared. This causesCGBuiltin.cpp
to fail to compile.The problem is that the system headers have this:
When
Builtin.h
#include
sBuiltins.def
it does so withBUILTIN
defined as:LIBBUILTIN
is not defined soBuiltins.def
supplies a default definition:Then the line
expands to
BI_alloca,
instead of the intendedBIalloca,
This happens because
LIBBUILTIN
is defined in terms ofBUILTIN
. The preprocessor rescans and expands the parameter before the concat. If the line wasBUILTIN(alloca, ...)
then it would work properly.Any of the following should fix this:
#undef alloca
Builtins.h
to explictly#define LIBBUILTIN
and remove the default definition fromBuiltins.def
Builtins.def
to:but this isn't portable. I don't know if there's a portable way to stop the preprocessor from rescanning.
The text was updated successfully, but these errors were encountered: