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
This commit is contained in:
parent
10baadae40
commit
bbbe29de11
2 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue