diff options
author | mark@chromium.org <mark@chromium.org> | 2014-12-10 16:08:09 +0000 |
---|---|---|
committer | mark@chromium.org <mark@chromium.org> | 2014-12-10 16:08:09 +0000 |
commit | bbbe29de119843d6fd409c43f11b365f7de3b45c (patch) | |
tree | add3b97f4a15e94755166377d558a6ace342cc4a /src/client | |
parent | dump_syms: Fix handling of DW_FORM_ref_addr to work with DWARF 4 (diff) | |
download | breakpad-bbbe29de119843d6fd409c43f11b365f7de3b45c.tar.xz |
Breakpad: Fix build with new clang versions.
gcc has a single exception setting for all languages. Saying -fno-exceptions
in gcc disables exceptions and cleanups for cc files, but has no effect for mm
files.
In clang, -fno-exceptions only disables c++ exceptions, but keeps objective-c
exceptions and cleanups enabled.
http://llvm.org/viewvc/llvm-project?view=revision&revision=220714 changed
__EXCEPTIONS to be defined for clang when cleanups are enabled, independent of
if c++ exceptions are enabled. (This was necessary to have clang work with
glibc which looks at __EXCEPTIONS to decide if cleanups are enabled.)
Breakpad tried to use __EXCEPTIONS to figure out if c++ exceptions are enabled.
In cc files, this works: -fno-exceptions will disable c++ exceptions and
cleanups. But in mm files, -fno-exceptions will disable c++ exceptions and
objective-c exceptions will still be enabled, and so cleanups must run and hence
__EXCEPTIONS is defined.
To make things work with both old and new compilers, do the try/catch hack in
mm files either if __EXCEPTIONS is not defined (for old compilers) or if the
compiler is clang and __has_feature(cxx_exceptions) isn't set (which will work
for new clangs too, and which cleanly maps to if c++ exceptions are enabled).
Patch by Nico Weber <thakis@chromium.org>
Review URL: https://breakpad.appspot.com/1774002/
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1409 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/ios/Breakpad.mm | 2 | ||||
-rw-r--r-- | src/client/mac/Framework/Breakpad.mm | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/client/ios/Breakpad.mm b/src/client/ios/Breakpad.mm index ca856f8f..c56a6401 100644 --- a/src/client/ios/Breakpad.mm +++ b/src/client/ios/Breakpad.mm @@ -45,7 +45,7 @@ #import "client/mac/handler/protected_memory_allocator.h" #import "common/simple_string_dictionary.h" -#ifndef __EXCEPTIONS +#if !defined(__EXCEPTIONS) || (__clang__ && !__has_feature(cxx_exceptions)) // This file uses C++ try/catch (but shouldn't). Duplicate the macros from // <c++/4.2.1/exception_defines.h> allowing this file to work properly with // exceptions disabled even when other C++ libraries are used. #undef the try diff --git a/src/client/mac/Framework/Breakpad.mm b/src/client/mac/Framework/Breakpad.mm index 3b4b6674..1d2e519b 100644 --- a/src/client/mac/Framework/Breakpad.mm +++ b/src/client/mac/Framework/Breakpad.mm @@ -48,7 +48,7 @@ #import "common/mac/MachIPC.h" #import "common/simple_string_dictionary.h" -#ifndef __EXCEPTIONS +#if !defined(__EXCEPTIONS) || (__clang__ && !__has_feature(cxx_exceptions)) // This file uses C++ try/catch (but shouldn't). Duplicate the macros from // <c++/4.2.1/exception_defines.h> allowing this file to work properly with // exceptions disabled even when other C++ libraries are used. #undef the try |