This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Check for command line option in my header file
On 18 July 2016 at 03:09, greg7mdp wrote:
> Thanks. However that's exactly what it appears to do, i.e. when I compile
> with the option -mpopcnt, the macro __POPCNT__ is defined, but is not
> defined when the option is not given.
The instruction can be enabled without the -mpopcnt option, e.g.
-march=nehalem or -march=skylake etc. should enable it. So testing for
an explicit command-line option is the wrong thing to do. Testing for
the instruction being enabled (however it got enabled) is the right
thing to do, and that's what the macro does.