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

via libc-commits libc-commits at lists.llvm.org
Sun Dec 8 16:49:24 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Schrodinger ZHU Yifan (SchrodingerZhu)

<details>
<summary>Changes</summary>

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

---
Full diff: https://github.com/llvm/llvm-project/pull/119155.diff


1 Files Affected:

- (modified) libc/src/__support/FPUtil/aarch64/FEnvImpl.h (+6-1) 


``````````diff
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
 

``````````

</details>


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


More information about the libc-commits mailing list