From 48fe63526e35ddaee7e98879596a569911f41319 Mon Sep 17 00:00:00 2001 From: Sebastian Redl Date: Thu, 19 Mar 2009 23:26:52 +0000 Subject: [PATCH] Fix the Win32 VS2008 build: - Make type declarations match the struct/class keyword of the definition. - Move AddSignalHandler into the namespace where it belongs. - Correctly call functions from template base. - Some other small changes. With this patch, LLVM and Clang should build properly and with far less noise under VS2008. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67347 91177308-0d34-0410-b5e6-96231b3b80d8 --- CMakeLists.txt | 2 +- include/llvm/CodeGen/ScheduleDAG.h | 2 +- include/llvm/Support/CommandLine.h | 4 ++-- include/llvm/User.h | 4 ++++ lib/Analysis/CMakeLists.txt | 1 + lib/CodeGen/LiveIntervalAnalysis.cpp | 2 +- lib/System/Win32/Alarm.inc | 2 +- lib/System/Win32/Signals.inc | 22 ++++++++++++---------- utils/TableGen/TGParser.h | 2 +- 9 files changed, 24 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ee8d204007..1edea945c4b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -145,7 +145,7 @@ if( MSVC ) add_definitions( -D_SCL_SECURE_NO_WARNINGS -DCRT_NONSTDC_NO_WARNINGS ) add_definitions( -D_SCL_SECURE_NO_DEPRECATE ) add_definitions( -wd4146 -wd4503 -wd4996 -wd4800 -wd4244 -wd4624 ) - add_definitions( -wd4355 -wd4715 ) + add_definitions( -wd4355 -wd4715 -wd4180 -wd4345 -wd4224 ) endif( MSVC ) include_directories( ${LLVM_BINARY_DIR}/include ${LLVM_MAIN_INCLUDE_DIR}) diff --git a/include/llvm/CodeGen/ScheduleDAG.h b/include/llvm/CodeGen/ScheduleDAG.h index 685dc76d124..f258f6f0cce 100644 --- a/include/llvm/CodeGen/ScheduleDAG.h +++ b/include/llvm/CodeGen/ScheduleDAG.h @@ -23,7 +23,7 @@ #include "llvm/ADT/PointerIntPair.h" namespace llvm { - struct SUnit; + class SUnit; class MachineConstantPool; class MachineFunction; class MachineModuleInfo; diff --git a/include/llvm/Support/CommandLine.h b/include/llvm/Support/CommandLine.h index def5ce75014..1c6b3337dfd 100644 --- a/include/llvm/Support/CommandLine.h +++ b/include/llvm/Support/CommandLine.h @@ -833,8 +833,8 @@ class opt : public Option, typename ParserClass::parser_data_type(); if (Parser.parse(*this, ArgName, Arg, Val)) return true; // Parse error! - setValue(Val); - setPosition(pos); + this->setValue(Val); + this->setPosition(pos); return false; } diff --git a/include/llvm/User.h b/include/llvm/User.h index 69826c0d8cf..8a244068b24 100644 --- a/include/llvm/User.h +++ b/include/llvm/User.h @@ -84,6 +84,10 @@ public: void operator delete(void*, unsigned) { assert(0 && "Constructor throws?"); } + /// placement delete - required by std, but never called. + void operator delete(void*, unsigned, bool) { + assert(0 && "Constructor throws?"); + } protected: template static Use &OpFrom(const U *that) { return Idx < 0 diff --git a/lib/Analysis/CMakeLists.txt b/lib/Analysis/CMakeLists.txt index f63054b60ed..07a918b5aac 100644 --- a/lib/Analysis/CMakeLists.txt +++ b/lib/Analysis/CMakeLists.txt @@ -16,6 +16,7 @@ add_llvm_library(LLVMAnalysis IntervalPartition.cpp LibCallAliasAnalysis.cpp LibCallSemantics.cpp + LiveValues.cpp LoopInfo.cpp LoopPass.cpp LoopVR.cpp diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp index 3a8f40faec5..29be67bf605 100644 --- a/lib/CodeGen/LiveIntervalAnalysis.cpp +++ b/lib/CodeGen/LiveIntervalAnalysis.cpp @@ -2042,7 +2042,7 @@ addIntervalsForSpills(const LiveInterval &li, if (CanFold && !Ops.empty()) { if (tryFoldMemoryOperand(MI, vrm, NULL, index, Ops, true, Slot,VReg)){ Folded = true; - if (FoundUse > 0) { + if (FoundUse) { // Also folded uses, do not issue a load. eraseRestoreInfo(Id, index, VReg, RestoreMBBs, RestoreIdxes); nI.removeRange(getLoadIndex(index), getUseIndex(index)+1); diff --git a/lib/System/Win32/Alarm.inc b/lib/System/Win32/Alarm.inc index c413b096e7e..e0d00a0142b 100644 --- a/lib/System/Win32/Alarm.inc +++ b/lib/System/Win32/Alarm.inc @@ -39,5 +39,5 @@ int sys::AlarmStatus() { extern "C" void __stdcall Sleep(unsigned long); void sys::Sleep(unsigned n) { - Sleep(n*1000); + ::Sleep(n*1000); } diff --git a/lib/System/Win32/Signals.inc b/lib/System/Win32/Signals.inc index 9276ef41a0b..560ac3879e2 100644 --- a/lib/System/Win32/Signals.inc +++ b/lib/System/Win32/Signals.inc @@ -14,6 +14,7 @@ #include "Win32.h" #include #include +#include #ifdef __MINGW32__ #include @@ -111,6 +112,17 @@ void sys::SetInterruptFunction(void (*IF)()) { InterruptFunction = IF; LeaveCriticalSection(&CriticalSection); } + + +/// AddSignalHandler - Add a function to be called when a signal is delivered +/// to the process. The handler can have a cookie passed to it to identify +/// what instance of the handler it is. +void sys::AddSignalHandler(void (*FnPtr)(void *), void *Cookie) { + if (CallBacksToRun == 0) + CallBacksToRun = new std::vector >(); + CallBacksToRun->push_back(std::make_pair(FnPtr, Cookie)); + RegisterHandler(); +} } static void Cleanup() { @@ -256,13 +268,3 @@ static BOOL WINAPI LLVMConsoleCtrlHandler(DWORD dwCtrlType) { return FALSE; } -/// AddSignalHandler - Add a function to be called when a signal is delivered -/// to the process. The handler can have a cookie passed to it to identify -/// what instance of the handler it is. -void llvm::sys::AddSignalHandler(void (*FnPtr)(void *), void *Cookie) { - if (CallBacksToRun == 0) - CallBacksToRun = new std::vector >(); - CallBacksToRun->push_back(std::make_pair(FnPtr, Cookie)); - RegisterHandler(); -} - diff --git a/utils/TableGen/TGParser.h b/utils/TableGen/TGParser.h index 5d5330de517..b04139f80a5 100644 --- a/utils/TableGen/TGParser.h +++ b/utils/TableGen/TGParser.h @@ -24,7 +24,7 @@ namespace llvm { struct RecTy; struct Init; struct MultiClass; - class SubClassReference; + struct SubClassReference; struct LetRecord { std::string Name;