From 44105a941b1b973fe4554024e34e09b8aeab64b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20K=C3=BCmmel?= Date: Fri, 27 Jul 2012 23:09:52 +0200 Subject: also build with msvc --- src/hash_map.h | 6 +++--- src/minidump-win32.cc | 3 ++- src/ninja.cc | 6 +++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/hash_map.h b/src/hash_map.h index 15e86da..ff2f7ba 100644 --- a/src/hash_map.h +++ b/src/hash_map.h @@ -55,16 +55,16 @@ using stdext::hash_compare; struct StringPieceCmp : public hash_compare { size_t operator()(const StringPiece& key) const { - return MurmurHash2(key.str_, key.len_); + return MurmurHash2(key.str(), key.len()); } bool operator()(const StringPiece& a, const StringPiece& b) const { - int cmp = strncmp(a.str_, b.str_, min(a.len_, b.len_)); + int cmp = strncmp(a.str(), b.str(), min(a.len(), b.len())); if (cmp < 0) { return true; } else if (cmp > 0) { return false; } else { - return a.len_ < b.len_; + return a.len() < b.len(); } } }; diff --git a/src/minidump-win32.cc b/src/minidump-win32.cc index f7067f3..c79ec0e 100644 --- a/src/minidump-win32.cc +++ b/src/minidump-win32.cc @@ -14,8 +14,9 @@ #ifndef NINJA_BOOTSTRAP -#include #include +#include + #include "util.h" diff --git a/src/ninja.cc b/src/ninja.cc index c1caf37..538d0d7 100644 --- a/src/ninja.cc +++ b/src/ninja.cc @@ -628,9 +628,13 @@ int RunBuild(Globals* globals, int argc, char** argv) { #ifdef _MSC_VER +} // anonymous namespace + // Defined in minidump-win32.cc. void CreateWin32MiniDump(_EXCEPTION_POINTERS* pep); +namespace { + /// This handler processes fatal crashes that you can't catch /// Test example: C++ exception in a stack-unwind-block /// Real-world example: ninja launched a compiler to process a tricky @@ -820,7 +824,7 @@ int main(int argc, char** argv) { #if !defined(NINJA_BOOTSTRAP) && defined(_MSC_VER) // Set a handler to catch crashes not caught by the __try..__except // block (e.g. an exception in a stack-unwind-block). - set_terminate(ninja_terminate_fct); + set_terminate(TerminateHandler); __try { // Running inside __try ... __except suppresses any Windows error // dialogs for errors such as bad_alloc. -- cgit v0.12