[cfe-dev] clang-cl, _HAS_EXCEPTIONS, and Microsoft

Reid Kleckner rnk at google.com
Wed Jan 8 08:04:14 PST 2014

I agree, _HAS_EXCEPTIONS=0 is undocumented and unsupported, but it's useful
to us for the moment.  Things are probably going to progress in the
following way:

1. Finish getting clang to self-host with clang-cl with and without
optimizations with _HAS_EXCEPTIONS=0.  This is blocked by pass-by-value of
non-trivial types.
2. Parse exceptions, but drop them on the floor with a warning like you get
from cl /EHs-c-.  This should make that confusing error about RTTI mangling
go away and have the effect of turning off exceptions.
3. Make RTTI work, because we need it for exceptions, and it's fairly
4 .Make exceptions work.

Programs that rely on exceptions (any user of concrt.h) won't work until we
get to 4, obviously, but I expect there's a large amount of code that only
uses exceptions in STL headers that would work with 2.

On Wed, Jan 8, 2014 at 7:36 AM, Edward Diener <
eldlistmailingz at tropicsoft.com> wrote:

> Here is the latest response from Microsoft to my bug report regarding
> _HAS_EXCEPTIONS being set to 0 when compiling with VC++ (
> http://connect.microsoft.com/VisualStudio/feedback/details/
> 811347/compiling-vc-12-0-with-has-exceptions-0-and-
> including-concrt-h-causes-a-compiler-error):
> "Hello,
> Thank you for reporting.
> Macro _HAS_EXCEPTIONS=0 is undocumented and unsupported by Microsoft.
> It may work with some parts of the STL library for legacy reasons, but it
> won't be compatible with ConcRT library (concrt.h) since ConcRT depends on
> exceptions for cancellation."
> The same bug also occurs when compiling with clang-cl. In other words the
> clang-cl need to have exception handling and give up on the idea that
> clang-cl can be implemented successfully with _HAS_EXCEPTIONS being set to
> 0. BTW the concrt.h is being included in Microsoft headers automatically no
> matter whether _HAS_EXCEPTIONS is set to 0 or not, but I think this is a
> non-issue from Microsoft's statement above that _HAS_EXCEPTIONS is
> undocumented and unsupported.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140108/7abb7e80/attachment.html>

More information about the cfe-dev mailing list