This is an archive of the discontinued LLVM Phabricator instance.

Do not predefine __EXCEPTIONS in clang-cl
ClosedPublic

Authored by ehsan on Jun 8 2014, 4:18 PM.

Details

Summary

This makes clang-cl able to build code which uses the gcc-defined __EXCEPTIONS macro for detecting whether -fno-exceptions has been passed to clang. cl.exe does not provide a similar way of disabling C++ exceptions, and never prefedines this variable.

Diff Detail

Repository
rL LLVM

Event Timeline

ehsan updated this revision to Diff 10223.Jun 8 2014, 4:18 PM
ehsan retitled this revision from to Do not predefine __EXCEPTIONS in clang-cl.
ehsan updated this object.
ehsan edited the test plan for this revision. (Show Details)
hans accepted this revision.Jun 10 2014, 1:37 PM
hans edited edge metadata.

This looks good to me. As long as we don't have exceptions support, we shouldn't define this macro.

This revision is now accepted and ready to land.Jun 10 2014, 1:37 PM
rnk accepted this revision.Jun 10 2014, 1:47 PM
rnk edited edge metadata.
rnk added inline comments.
test/Frontend/exceptions.c
1 ↗(On Diff #10223)

I think '-x cl' says this file is OpenCL code. The test line should probably be:

// RUN: %clang_cc1 -verify -fms-compatibility -fcxx-exceptions -fexceptions %s
hans added inline comments.Jun 10 2014, 1:53 PM
test/Frontend/exceptions.c
1 ↗(On Diff #10223)

Sorry, I should have caught that when reviewing.

I did notice it when preparing to land Ehsan's patch though, so fixing it now.

hans closed this revision.Jun 10 2014, 1:54 PM
hans updated this revision to Diff 10302.

Closed by commit rL210582 (authored by @hans).