[clang] [clang][modules] giving the __stddef_ headers their own modules can cause redeclaration errors with -fbuiltin-headers-in-system-modules (PR #84127)

Volodymyr Sapsai via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 11 19:10:09 PDT 2024


================
@@ -7,6 +7,11 @@
  *===-----------------------------------------------------------------------===
  */
 
-#ifndef offsetof
+/*
+ * When -fbuiltin-headers-in-system-modules is set this is a non-modular header
+ * and needs to behave as if it was textual.
+ */
+#if !defined(offsetof) ||                                                      \
+    (__has_feature(modules) && !__building_module(_Builtin_stddef))
----------------
vsapsai wrote:

What should happen when `offsetof` is defined and we are building non-`_Builtin_stddef` module?

https://github.com/llvm/llvm-project/pull/84127


More information about the cfe-commits mailing list