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

David Chisnall via cfe-dev cfe-dev at lists.llvm.org
Fri May 26 01:46:22 PDT 2017


On 25 May 2017, at 23:32, René J.V. Bertin via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> 
> Hello,
> 
> I have a bit of a debate going on with a Qt dev, about whether or not it is sufficient under all conditions to test __EXCEPTIONS to know whether C++ exceptions are enabled: https://bugreports.qt.io/browse/QTBUG-61034
> 
> 
> I think the summary at http://releases.llvm.org/3.6.0/tools/clang/docs/ReleaseNotes.html#the-exceptions-macro should be followed, but Thiago's opinion is that Apple introduced a bug in Xcode 8 (= way after clang 3.6).
> 
> His argument: clang on Linux does not define __EXCEPTIONS when -fno-exceptions is given (unless you target MachO).
> 
> I'm more inclined to consider that inconsistency a bug in clang.
> 
> Where is the truth in this matter?

It sounds like it’s an Apple bug: __EXCEPTIONS is enabled for all language dialects if -fexceptions is passed (and not defined if -fno-exceptions is passed), but it is not defined for Objective-C++ or C++ when exceptions are enabled by default.  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.

David




More information about the cfe-dev mailing list