[clang] [clang][modules] giving the __stddef_ headers their own modules can cause redeclaration errors with -fbuiltin-headers-in-system-modules (PR #84127)
Ian Anderson via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 5 23:20:39 PST 2024
================
@@ -7,7 +7,7 @@
*===-----------------------------------------------------------------------===
*/
-#if !defined(NULL) || !__has_feature(modules)
+#if !defined(NULL) || !__building_module(_Builtin_stddef)
----------------
ian-twilightcoder wrote:
```
#if !defined(NULL) || !__has_feature(modules) || (__has_feature(modules) && !__building_module(_Builtin_stddef))
```
If `!__has_feature(modules)` then `__building_module(anything)` is `0`. So you can make these substitutions without changing the logic.
```
!__has_feature(modules)
!__has_feature(modules) && !__building_module(_Builtin_stddef)
!__has_feature(modules) || (__has_feature(modules) && !__building_module(_Builtin_stddef))
(!__has_feature(modules) && !__building_module(_Builtin_stddef)) || (__has_feature(modules) && !__building_module(_Builtin_stddef))
(!a && b) || (a && b)
b
(!__has_feature(modules) && !__building_module(_Builtin_stddef)) || (__has_feature(modules) && !__building_module(_Builtin_stddef))
!__building_module(_Builtin_stddef)
```
https://github.com/llvm/llvm-project/pull/84127
More information about the cfe-commits
mailing list