Specify -fno-exceptions in source file
Jonathan Wakely
jwakely.gcc@gmail.com
Thu Apr 16 21:29:00 GMT 2015
On 16 April 2015 at 19:51, William S Fulton wrote:
> On 16 April 2015 at 10:23, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>> On 16 April 2015 at 07:13, William S Fulton wrote:
>>> Is it possible to specify -fno-exceptions for one translation unit?
>>
>> Yes.
>>
>>> I'd like to use -fno-exceptions for just one particular test file
>>> without having to modify an entire build system. My attempts to use
>>> '#pragma GCC diagnostic' didn't get anywhere.
>>
>> That's for controlling compiler diagnostics (errors and warnings), but
>> -fno-exceptions is not a diagnostic option.
>
> Sorry, I wasn't clear enough in my original question. I wanted to
> control this for one translation unit, but specifying it within the
> source code and not via a command line argument to gcc.
Hmm, I'm not sure if that's possible then.
You could try #GCC pragma optimize "no-exceptions" but I don't think
that flag works with the optimize pragma either (I haven't tried it
though).
More information about the Gcc-help
mailing list