diff --git a/src/client/ios/Breakpad.mm b/src/client/ios/Breakpad.mm index f3554063..c3758a9f 100644 --- a/src/client/ios/Breakpad.mm +++ b/src/client/ios/Breakpad.mm @@ -38,20 +38,32 @@ #define DEBUGLOG if (gDebugLog) fprintf #define IGNORE_DEBUGGER "BREAKPAD_IGNORE_DEBUGGER" -#import "common/mac/SimpleStringDictionary.h" +#import "client/ios/Breakpad.h" + +#import +#include +#include +#include #import "client/mac/crash_generation/ConfigFile.h" -#import "client/mac/sender/uploader.h" #import "client/mac/handler/exception_handler.h" #import "client/mac/handler/minidump_generator.h" -#import "client/ios/Breakpad.h" +#import "client/mac/sender/uploader.h" +#import "common/mac/SimpleStringDictionary.h" #import "client/ios/handler/ios_exception_minidump_generator.h" #import "client/mac/handler/protected_memory_allocator.h" -#import -#import - -#import +#ifndef __EXCEPTIONS +// This file uses C++ try/catch (but shouldn't). Duplicate the macros from +// allowing this file to work properly with +// exceptions disabled even when other C++ libraries are used. #undef the try +// and catch macros first in case libstdc++ is in use and has already provided +// its own definitions. +#undef try +#define try if (true) +#undef catch +#define catch(X) if (false) +#endif // __EXCEPTIONS using google_breakpad::ConfigFile; using google_breakpad::EnsureDirectoryPathExists; diff --git a/src/client/mac/Framework/Breakpad.mm b/src/client/mac/Framework/Breakpad.mm index 2817f380..4762516e 100644 --- a/src/client/mac/Framework/Breakpad.mm +++ b/src/client/mac/Framework/Breakpad.mm @@ -42,8 +42,9 @@ #import "client/mac/Framework/Breakpad.h" #import -#import -#import +#include +#include +#include #import "client/mac/crash_generation/Inspector.h" #import "client/mac/handler/exception_handler.h" @@ -53,6 +54,18 @@ #import "common/mac/MachIPC.h" #import "common/mac/SimpleStringDictionary.h" +#ifndef __EXCEPTIONS +// This file uses C++ try/catch (but shouldn't). Duplicate the macros from +// allowing this file to work properly with +// exceptions disabled even when other C++ libraries are used. #undef the try +// and catch macros first in case libstdc++ is in use and has already provided +// its own definitions. +#undef try +#define try if (true) +#undef catch +#define catch(X) if (false) +#endif // __EXCEPTIONS + using google_breakpad::KeyValueEntry; using google_breakpad::MachPortSender; using google_breakpad::MachReceiveMessage; diff --git a/src/client/mac/handler/exception_handler.cc b/src/client/mac/handler/exception_handler.cc index c88b6807..ca1d165e 100644 --- a/src/client/mac/handler/exception_handler.cc +++ b/src/client/mac/handler/exception_handler.cc @@ -27,19 +27,32 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#include #include #include #include #include #include +#include + #include "client/mac/handler/exception_handler.h" #include "client/mac/handler/minidump_generator.h" #include "common/mac/macho_utilities.h" #include "common/mac/scoped_task_suspend-inl.h" #include "google_breakpad/common/minidump_exception_mac.h" +#ifndef __EXCEPTIONS +// This file uses C++ try/catch (but shouldn't). Duplicate the macros from +// allowing this file to work properly with +// exceptions disabled even when other C++ libraries are used. #undef the try +// and catch macros first in case libstdc++ is in use and has already provided +// its own definitions. +#undef try +#define try if (true) +#undef catch +#define catch(X) if (false) +#endif // __EXCEPTIONS + #ifndef USE_PROTECTED_ALLOCATIONS #if TARGET_OS_IPHONE #define USE_PROTECTED_ALLOCATIONS 1