[clang] Ensure proper NULL macro definition for system include files. (PR #149176)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 21 09:10:24 PDT 2025
================
@@ -0,0 +1,24 @@
+/*===---- dbm.h - BSD header for database management ----------------------===*\
+ *
+ * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+ * See https://llvm.org/LICENSE.txt for license information.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ *
+\*===----------------------------------------------------------------------===*/
+
+#if !defined(_AIX)
+
+#include_next <dbm.h>
+
+#else
+
+#define __need_NULL
+#include <stddef.h>
+
+#include_next <dbm.h>
+
+/* Ensure that the definition of NULL is as expected. */
+#define __need_NULL
+#include <stddef.h>
----------------
AaronBallman wrote:
Why is the pattern to define `NULL`, include_next the header the user asked for, and then define `NULL` again? Are the include_next headers defining `NULL` to something different? And if so, what are we potentially breaking by redefining it out from under them?
https://github.com/llvm/llvm-project/pull/149176
More information about the cfe-commits
mailing list