Prior to GCC 4.4, __sync_fetch_and_nand was implemented as:
{ tmp = *ptr; *ptr = ~tmp & value; return tmp; }
but this was changed in GCC 4.4 to be:
{ tmp = *ptr; *ptr = ~(tmp & value); return tmp; }
in response to this change, support for sync_fetch_and_nand (and sync_nand_and_fetch) was removed in r99522 in order to avoid miscompiling code depending on the old semantics. However, at this point:
- Many years have passed, and the amount of code relying on the old semantics is likely smaller
- Through the work of many contributors, all LLVM backends have been updated such that "atomicrmw nand" provides the newer GCC 4.4+ semantics (this process was complete July of 2014 (added to the release notes in r212635).
- The lack of this intrinsic is now a needless impediment to porting codes from GCC to Clang (I've now seen several examples of this).
It is true, however, that we still set GNUC_MINOR to 2 (corresponding to GCC 4.2). To compensate for this, and to address the original concern regarding code relying on the old semantics, I've added a warning in this patch that specifically details the fact that the semantics have changed and that we provide the newer semantics.
Fixes PR8842.
Please review and thanks again!
I think you should pick a warning flag name that is specific to this particular change. We'd never want to put two different semantic changes in the same warning group, because we would want users to be able to turn off one of them without turning off the other.