Feature testing optimize push/off

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]: GitHub - mikejsavage/safebfuns: Implementations of explicit_bzero, timingsafe_bcmp and timingsafe_memcmp for GCC and Clang

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

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).