PR6878 (-cc1 should default to -fexceptions)

John McCall rjmccall at
Tue Jul 30 17:57:25 PDT 2013

On Jul 30, 2013, at 12:24 PM, Eli Friedman <eli.friedman at> wrote:
> John probably remembers the details here more clearly, but it looks
> correct to me.

No, the protocol between the driver and the frontend needs to change here.

-fobjc-exceptions and -fcxx-exceptions will be the default if those languages
are enabled, so the frontend should stop looking for -fcxx-exceptions and
-fobjc-exceptions and should start looking for -fno-cxx-exceptions and

-fexceptions is complicated because the driver logic is dependent on the
ObjC runtime.  I would say that ObjC should enable -fexceptions by default
if the runtime hasUnwindExceptions(); it doesn’t need to repeat the
Darwin/x86-64 from the driver.

So, basically, the frontend logic should be something like this:
 CXXExceptions = (CPlusPlus && !hasArg(“-fno-cxx-exceptions”));
 ObjCExceptions = (ObjC1 && !hasArg(“-fno-objc-exceptions”));
 Exceptions = (CXXExceptions || (ObjCExceptions && ObjCRuntime.hasUnwindExceptions()) || hasArg(“-fexceptions”)) && !hasArg(“-fno-exceptions”);

And then the driver basically makes the same decision that it does today,
and if that differs from what it knows the frontend will decide, it should
pass the appropriate option.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the cfe-commits mailing list