[libc-commits] [libc] [libc] fix woa64 fenv implementation (PR #119155)

Schrodinger ZHU Yifan via libc-commits libc-commits at lists.llvm.org
Sun Dec 8 16:48:50 PST 2024


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

Use `push_macro/pop_macro` to avoid `UNDERFLOW` `OVERFLOW` conflict with `core_crt` headers. fix #119154.

>From 7c53723fb46e197459fb7f81c87ad2994675f08d Mon Sep 17 00:00:00 2001
From: schrodingerzhu <i at zhuyi.fan>
Date: Sun, 8 Dec 2024 19:44:35 -0500
Subject: [PATCH] [libc] fix woa64 fenv implementation

---
 libc/src/__support/FPUtil/aarch64/FEnvImpl.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libc/src/__support/FPUtil/aarch64/FEnvImpl.h b/libc/src/__support/FPUtil/aarch64/FEnvImpl.h
index 3cea9772154fc6..ff3485de4a007d 100644
--- a/libc/src/__support/FPUtil/aarch64/FEnvImpl.h
+++ b/libc/src/__support/FPUtil/aarch64/FEnvImpl.h
@@ -26,7 +26,10 @@
 
 namespace LIBC_NAMESPACE_DECL {
 namespace fputil {
-
+#pragma push_macro("OVERFLOW")
+#undef OVERFLOW
+#pragma push_macro("UNDERFLOW")
+#undef UNDERFLOW
 struct FEnv {
   struct FPState {
     uint32_t ControlWord;
@@ -279,6 +282,8 @@ LIBC_INLINE int set_env(const fenv_t *envp) {
   return 0;
 }
 
+#pragma pop_macro("UNDERFLOW")
+#pragma pop_macro("OVERFLOW")
 } // namespace fputil
 } // namespace LIBC_NAMESPACE_DECL
 



More information about the libc-commits mailing list