[libc-commits] [libc] [libc][darwin] avoid importing macros that conflict with function names in overlay mode (PR #171691)

Schrodinger ZHU Yifan via libc-commits libc-commits at lists.llvm.org
Wed Dec 10 12:27:46 PST 2025


https://github.com/SchrodingerZhu created https://github.com/llvm/llvm-project/pull/171691

None

>From c8048d7088bdc8ff0a886c2df81bbbab5deecafc Mon Sep 17 00:00:00 2001
From: Schrodinger ZHU Yifan <i at zhuyi.fan>
Date: Wed, 10 Dec 2025 15:27:21 -0500
Subject: [PATCH] [libc][darwin] avoid importing macros that conflict with
 function names in overlay mode

---
 libc/hdr/stdio_overlay.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/libc/hdr/stdio_overlay.h b/libc/hdr/stdio_overlay.h
index aef8c448fe49d..aa45f54b19320 100644
--- a/libc/hdr/stdio_overlay.h
+++ b/libc/hdr/stdio_overlay.h
@@ -66,4 +66,18 @@
 #undef LIBC_OLD_USE_EXTERN_INLINES
 #endif
 
+// undefine symbolic macros for Apple platforms in overlay mode
+#ifdef __APPLE__
+#undef getc_unlocked
+#undef putc_unlocked
+#undef getchar_unlocked
+#undef putchar_unlocked
+#undef fropen
+#undef fwopen
+#undef feof_unlocked
+#undef ferror_unlocked
+#undef clearerr_unlocked
+#undef fileno_unlocked
+#endif
+
 #endif // LLVM_LIBC_HDR_STDIO_OVERLAY_H



More information about the libc-commits mailing list