[cfe-dev] Feature testing optimize push/off

Reid Kleckner rnk at google.com
Mon Dec 22 11:44:40 PST 2014


I don't think we have feature-detection for pragmas because we generally
prefer attributes. However, you can use __attribute__((optnone)), and test
for it with `#if __has_attribute(optnone)`.

On Sat, Dec 20, 2014 at 3:14 AM, Michael Savage <mikejsavage at gmail.com>
wrote:

> Hi,
>
> I am writing a library[1] which relies on being able to disable
> optimisations for blocks of code. I'm struggling with how to detect when
> `optimize push "-O0"` and `optimize off` are available.
>
> [1]: https://github.com/mikejsavage/safebfuns
>
> At the moment I use version numbers, but it doesn't seem to be
> reliable as I couldn't find anywhere documenting when it got
> added/deprecated, and OSX users apparently get Clang v600.
>
> How can I do this properly?
>
> Thanks,
> Mike
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20141222/840163b8/attachment.html>


More information about the cfe-dev mailing list