[cfe-dev] of -fno-exceptions, ObjC++, __EXCEPTIONS, Mac vs. Linux ... and Qt

Reid Kleckner via cfe-dev cfe-dev at lists.llvm.org
Fri May 26 09:27:21 PDT 2017


So far as I can tell, __EXCEPTIONS behaves as documented: it is defined if
Clang will emit exceptional destructor cleanups. How it is defined on
Darwin vs. Linux vs. Obj-C++ is all based on crazy different platform
defaults that I can't untangle. It sounds like Obj-C++ on Mac enables Obj-C
exceptions by default, which means we keep around C++ destructor cleanups,
so __EXCEPTIONS is defined.

In all cases, the __has_feature(cxx_exceptions) test will indicate if 'try'
and 'throw' are available.

On Fri, May 26, 2017 at 3:30 AM, René J. V. Bertin via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> David Chisnall via cfe-dev wrote:
>
>
> > but it is not defined for Objective-C++ or C++ when exceptions are
> > enabled by default.
>
> That seems like yet something else, but how can this be an Apple bug (it
> happens
> with Ubuntu builds from llvm.org too when targetting Darwin)? What's
> more, how
> can it be a bug if it's documented and explained?
>
> I can imagine why __EXCEPTIONS would be set if any kind of exceptions are
> enabled; it's only for history reasons one might expect that token to be
> C++-
> specific (cf. the -fcxx-exceptions argument; I haven't yet checked if -
> fexceptions actually controls both C++ and ObjC exceptions).
>
> > This bug is also present in clang 4.0, but only with a
> > macos target (e.g. x86_64-apple-macos), but not with an ios target.
>
> The lack of consistency certainly seems to be a bug.
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170526/1f9ec539/attachment.html>


More information about the cfe-dev mailing list