[cfe-commits] [patch] Fix -fno-exceptions for c++
Chris Lattner
clattner at apple.com
Tue Sep 29 11:01:00 PDT 2009
On Sep 29, 2009, at 8:27 AM, Douglas Gregor wrote:
>
> On Sep 28, 2009, at 4:31 PM, Rafael Espindola wrote:
>
>> Currently __EXCEPTIONS=1 is always defined when compiling c++. The
>> attached patch fixes it:
>>
>> clang -E -fno-exceptions test.c disabled
>> clang -E -fexceptions test.c enabled
>> clang -E test.c disabled
>> clang -E -fno-exceptions test.cc disabled
>> clang -E -fexceptions test.cc enabled
>> clang -E test.cc enabled
>>
>> But it looks silly :-)
>>
>> Is there a way in clang-cc to test that an option was not given (as
>> opposed to having the default value)?
>
> I think the getPosition() member function will return > 0 when an
> option was given, 0 when it was not given.
>
> The -fexceptions/-fno-exceptions option and the current language
> dialect should be used to set the Exceptions field of LangOptions. We
> shouldn't do this:
This sort of thing is best handled in the driver. clang-cc should
just have a single "exceptions is enabled" flag, and the driver should
munge the combination of flag settings, default language stuff, etc
into a single bool that it passes off to clang-cc.
-Chris
More information about the cfe-commits
mailing list