CBackend: Fix MSVC build.

This may produce warnings on MSVS, but it's better than failures.

llvm-svn: 113834
This commit is contained in:
Michael J. Spencer 2010-09-14 04:27:38 +00:00
parent a845c8d2ff
commit 26fe225080
2 changed files with 8 additions and 4 deletions

View File

@ -50,6 +50,10 @@
#include "llvm/System/Host.h"
#include "llvm/Config/config.h"
#include <algorithm>
// Some ms header decided to define setjmp as _setjmp, undo this for this file.
#ifdef _MSC_VER
#undef setjmp
#endif
using namespace llvm;
extern "C" void LLVMInitializeCBackendTarget() {

View File

@ -69,15 +69,15 @@ void IntrinsicEmitter::run(raw_ostream &OS) {
void IntrinsicEmitter::EmitPrefix(raw_ostream &OS) {
OS << "// VisualStudio defines setjmp as _setjmp\n"
"#if defined(_MSC_VER) && defined(setjmp)\n"
"#define setjmp_undefined_for_visual_studio\n"
"#undef setjmp\n"
"# pragma push_macro(\"setjmp\")\n"
"# undef setjmp\n"
"#endif\n\n";
}
void IntrinsicEmitter::EmitSuffix(raw_ostream &OS) {
OS << "#if defined(_MSC_VER) && defined(setjmp_undefined_for_visual_studio)\n"
OS << "#if defined(_MSC_VER)\n"
"// let's return it to _setjmp state\n"
"#define setjmp _setjmp\n"
"# pragma pop_macro(\"setjmp\")\n"
"#endif\n\n";
}