r220714 - Frontend: Define __EXCEPTIONS if -fexceptions is passed

Richard Smith richard at metafoo.co.uk
Thu Dec 4 17:00:14 PST 2014


This looks like a driver bug; a complete reproducer needs a Darwin triple,
in order to get exceptions enabled for Obj-C by default:

$ ./build/bin/clang -fno-exceptions -x objective-c++  -target
x86_64-apple-darwin11 -v /dev/null
[...]clang-3.6" -cc1 [...] -fexceptions [...]

The issue is that -fno-exceptions has no effect in Objective-C (look at the
exceptionSettings function in Driver/Tools.cpp and note that an explicit
-fno-exceptions does *not* turn off ShouldUseExceptionTables; look at
addExceptionArgs and note that it overrides that flag anyway if we're on
Darwin).

It seems pretty clear that passing -fno-exceptions to the driver should
never result in a -cc1 invocation with -fexceptions enabled...

On Thu, Dec 4, 2014 at 4:14 PM, Hans Wennborg <hans at chromium.org> wrote:

> On Mon, Oct 27, 2014 at 1:02 PM, David Majnemer
> <david.majnemer at gmail.com> wrote:
> > Author: majnemer
> > Date: Mon Oct 27 15:02:19 2014
> > New Revision: 220714
>
>
> This broke Chromium:
>
> http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/11730/steps/compile%20%28with%20patch%29/logs/stdio
>
> > --- cfe/trunk/test/Preprocessor/predefined-exceptions.m (original)
> > +++ cfe/trunk/test/Preprocessor/predefined-exceptions.m Mon Oct 27
> 15:02:19 2014
> > @@ -1,6 +1,6 @@
> >  // RUN: %clang_cc1 -x objective-c -fobjc-exceptions -fexceptions -E -dM
> %s | FileCheck -check-prefix=CHECK-OBJC-NOCXX %s
> >  // CHECK-OBJC-NOCXX: #define OBJC_ZEROCOST_EXCEPTIONS 1
> > -// CHECK-OBJC-NOCXX-NOT: #define __EXCEPTIONS 1
> > +// CHECK-OBJC-NOCXX: #define __EXCEPTIONS 1
>
> It seems this reverses the test, and does the opposite of what at
> least the code I was trying to compile with -fno-exceptions expects:
>
> https://code.google.com/p/chromium/codesearch#chromium/src/breakpad/src/client/mac/Framework/Breakpad.mm&l=51
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141204/bce52f3f/attachment.html>


More information about the cfe-commits mailing list