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

Robinson, Paul Paul_Robinson at playstation.sony.com
Tue Apr 29 14:53:38 PDT 2014


> > I think reducing the proliferation of pragmas is a good thing, so
> > let's implement the GCC syntax. We can add support for the MSVC
> > syntax later. We probably want to defer that because the primary use
> > case for it is working around MSVC miscompiles.
> >
> >
> > Why doesn't this logic apply to both? I don't *really* care how it is
> > spelled (I agree with Renato that we can discourage it regardless)
> > I'm just not sure that the concern of existing usage primarily
> > working around compiler-specific miscompiles is MSVC specific.
> >
> > Usually these workarounds have a version check around them that we
> > miss, like _MSC_VER < 1700. I wonder if the same is true for
> > __GNUC__ usage.
> >
> >
> > It also occurs to me that if we add this pragma, users might use it
> > to work around "miscompiles" of invalid user code. On the other
> > hand, it's not like Clang is bug-free either.
> > Yea, I'm just curious why we don't want a clang-specific spelling so
> > that we don't pick up any of these. :: shrug :: Note that we emulate
> > a GCC version that is not useful for reasoning about live miscompile
> > bugs.
> 
> +1 -- We specifically don't want to pick up any of these from other
> compilers.
> 
>  -Hal
> 
> >
> >
> > I would still try to spell it the same as GCCs if convenient:
> > "#pragma clang optimize 0" or whatever.

Um.  Spell it like GCC's but put it in the clang namespace so that
it isn't spelled like GCC's?  <Tries to envision a rationale>

So that way it looks kinda familiar to GCC users, but if there are
any actual GCC directives in the source, we don't actually implement
them, assuming they're there to avoid GCC miscompiles but clang isn't
GCC and so won't have the same miscompile issues...  (Am I at all close?)

--paulr






More information about the cfe-dev mailing list