Check for command line option in my header file
Mon Jul 18 08:51:00 GMT 2016
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.
More information about the Gcc-help