-
Type:
Bug
-
Resolution: Works as Designed
-
Priority:
Minor - P4
-
None
-
Affects Version/s: 1.20.0
-
Component/s: None
-
None
-
None
-
C Drivers
-
None
-
None
-
None
-
None
-
None
-
None
Summary
The meaning of the BSON_IF_GNU_LIKE macro changes depending on the set of included headers, leading to hidden problems in other modules.
At the time this undef was introduced, change 3a1b04a82905aab0b3300ee901c165ebdf8bd5d0, the BSON_IF_GNU_LIKE macro defined by bson-compat had its only consumer in the bson-atomic module. The aforementioned compatibility fix for atomics took advantage of this one-to-one relationship by changing the meaning of bson-compat's macro within the bson-atomic header.
Now there is at least one additional user of the BSON_IF_GNU_LIKE macro, in bson-dsl.h. It may also have 3rd party users, as it's in a publicly available header. Those callers will find that BSON_IF_GNU_LIKE unexpectedly has an empty definition, if bson-atomic is included by a header they include.
Environment
The redefinition would only actually take place if the BSON_USE_LEGACY_GCC_ATOMICS definition (gcc 4.x) is active.
How to Reproduce
No expected symptoms on known production code; the incorrect macro definition will occur on gcc 4.x compile hosts, and the affected code would be in the support for enabling/disabling warnings in the experimental bson-dsl module.
Additional Background
The whole of bson-atomic is being deprecated now and removed in 2.0