[cfe-dev] [RFC] A proposal for #pragma optnone

Renato Golin renato.golin at linaro.org
Tue Apr 29 05:19:25 PDT 2014


On 29 April 2014 13:00, Dario Domizioli <dario.domizioli at gmail.com> wrote:
> My concern is that we still have to make clear to the user that the full
> feature is not supported, but we could do it in the documentation and/or
> with diagnostics about unsupported parts of the feature. So I would be OK
> with using GCC's or MSVC's syntax, and implementing the "disable
> optimizations" case by adding 'optnone' to the function definitions in the
> range covered by the pragma.

Yes. Docs are ok. A warning that is only enabled on -Wall (and could
be disabled individually) is also ok. Both would be better.


> So from our point of view, the MSVC syntax is slightly easier to implement,
> but we have no strong opinion. How does the community feel about the GCC
> syntax vs. the MSVC syntax?

I'd argue that the GCC syntax is always preferred over MSVC in any
general case, just because GCC's reach is orders of magnitude higher
than anything else, and also because LLVM has historically followed
GCC's trail with regards to supporting legacy code. Only recently MSVC
support has been added.

But realistically, it depends on which kind of users will use this
apart from your toolchain. If this is more used around MSVC users,
than do the MSVC style first. I don't have a strong opinion on that.

But whatever you do, it should be very easy to connect the other style
with your low-level implementation (function attributes).


> As a final note, I would reiterate that the use case for this feature is not
> as rare as people might think.

I understand the importance and this is why we want this to happen,
but we have to be extremely careful on what we add. I'm sure you know
very well how long bad decisions tend to stay in public APIs...  ;)

cheers,
--renato



More information about the cfe-dev mailing list