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

Philip Reames listmail at philipreames.com
Mon Apr 28 10:54:39 PDT 2014


On 04/28/2014 10:44 AM, Chandler Carruth wrote:
> Setting aside the reasonable concerns over naming...
>
> On Mon, Apr 28, 2014 at 6:06 AM, Dario Domizioli 
> <dario.domizioli at gmail.com <mailto:dario.domizioli at gmail.com>> wrote:
>
>     Proposals like this one have not received much attention in the
>     past, but we are still keen to work with the community on this.
>
>
> This doesn't seem accurate.
>
> When the optnone stuff was first discussed, the use of a pragma *was* 
> discussed, and there were arguments against it because the semantics 
> are highly confusing: it only has effect on the function definitions 
> which are started after the pragma. This is confusing as you might 
> start the pragma *inside* a function definition. Such a pragma might 
> even have semantic impact by disabling optimizations within the body 
> of lambda, but *not* within any surrounding expressions.
>
> Personally, I find the semantics of such a pragma extremely confusing. 
> I would never advocate the use of such a pragma, instead I would 
> strongly advocate *against* its use in literally all circumstances. It 
> is hard to support including it in Clang given that.
>
> On the flip side, we have a function attribute which has a reasonable 
> semantic model and addresses the use case originally posited.
>
> So I don't think that this is something which has been left 
> unattended. I think it was attended, and in the discussion that led to 
> optnone, the approach was not pursued and instead a different one was.
> -Chandler
Chandler, while I actually agree with you in principal, I think you're 
ignoring an important factor.  The pragma approach is already widely 
deployed.  If we don't support pragma usage, there's no real migration 
path for these applications.

Adding support for this usage does not have to imply an endorsement of 
the style.  In fact, our documentation could explicitly suggest 
migration to per-function attributes.  (In my view, it should.)

Philip

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140428/3e92ca78/attachment.html>


More information about the cfe-dev mailing list