[libc-commits] [libc] 1f2818c - libc: Prefix Rounding Control Error enum to avoid conflict in windows build (#172562)
via libc-commits
libc-commits at lists.llvm.org
Wed Dec 17 08:45:24 PST 2025
Author: Jinsong Ji
Date: 2025-12-17T11:45:19-05:00
New Revision: 1f2818cea3f675d4ae85f2fc680c7f4f9ff9a111
URL: https://github.com/llvm/llvm-project/commit/1f2818cea3f675d4ae85f2fc680c7f4f9ff9a111
DIFF: https://github.com/llvm/llvm-project/commit/1f2818cea3f675d4ae85f2fc680c7f4f9ff9a111.diff
LOG: libc: Prefix Rounding Control Error enum to avoid conflict in windows build (#172562)
Similar to e85a9f5540f5
Somehow conflict with define in wingdi.h.
Fix build failures:
...FPUtil\x86_64\fenv_x86_common.h(78,29): error: expected member name
or
';' after declaration specifiers
78 | static constexpr uint16_t ERROR = 0xFFFF;
| ~~~~~~~~~~~~~~~~~~~~~~~~~ ^
c:\Program files (x86)\Windows
Kits\10\include\10.0.22000.0\um\wingdi.h(118,29):
note: expanded from macro 'ERROR'
118 | #define ERROR 0
|
Added:
Modified:
libc/src/__support/FPUtil/x86_64/FEnvImpl.h
libc/src/__support/FPUtil/x86_64/fenv_x86_common.h
libc/src/__support/FPUtil/x86_64/fenv_x87_only.h
Removed:
################################################################################
diff --git a/libc/src/__support/FPUtil/x86_64/FEnvImpl.h b/libc/src/__support/FPUtil/x86_64/FEnvImpl.h
index 7ff1972e9c31d..703c305293dfd 100644
--- a/libc/src/__support/FPUtil/x86_64/FEnvImpl.h
+++ b/libc/src/__support/FPUtil/x86_64/FEnvImpl.h
@@ -120,7 +120,7 @@ LIBC_INLINE static int get_round() {
LIBC_INLINE static int set_round(int rounding_mode) {
uint16_t rounding = internal::get_rounding_control_from_macro(rounding_mode);
- if (LIBC_UNLIKELY(rounding == internal::RoundingControl::ERROR))
+ if (LIBC_UNLIKELY(rounding == internal::RoundingControl::RC_ERROR))
return -1;
sse::set_round(rounding);
diff --git a/libc/src/__support/FPUtil/x86_64/fenv_x86_common.h b/libc/src/__support/FPUtil/x86_64/fenv_x86_common.h
index 0d4f625d344cd..e27c62a99dba9 100644
--- a/libc/src/__support/FPUtil/x86_64/fenv_x86_common.h
+++ b/libc/src/__support/FPUtil/x86_64/fenv_x86_common.h
@@ -75,7 +75,7 @@ struct RoundingControl {
<< X87_BIT_POSITION;
static constexpr uint16_t MXCSR_ROUNDING_MASK = ROUNDING_MASK
<< MXCSR_BIT_POSITION;
- static constexpr uint16_t ERROR = 0xFFFF;
+ static constexpr uint16_t RC_ERROR = 0xFFFF;
};
// Exception flags are individual bits in the corresponding registers.
@@ -127,7 +127,7 @@ LIBC_INLINE static uint16_t get_rounding_control_from_macro(int rounding) {
case FE_TOWARDZERO:
return RoundingControl::TOWARD_ZERO;
default:
- return RoundingControl::ERROR;
+ return RoundingControl::RC_ERROR;
}
}
diff --git a/libc/src/__support/FPUtil/x86_64/fenv_x87_only.h b/libc/src/__support/FPUtil/x86_64/fenv_x87_only.h
index f78e4ecfaf619..256e619e36ca6 100644
--- a/libc/src/__support/FPUtil/x86_64/fenv_x87_only.h
+++ b/libc/src/__support/FPUtil/x86_64/fenv_x87_only.h
@@ -76,7 +76,7 @@ LIBC_INLINE static int get_round() {
LIBC_INLINE static int set_round(int rounding_mode) {
uint16_t rounding = internal::get_rounding_control_from_macro(rounding_mode);
- if (LIBC_UNLIKELY(rounding == internal::RoundingControl::ERROR))
+ if (LIBC_UNLIKELY(rounding == internal::RoundingControl::RC_ERROR))
return -1;
x87::set_round(rounding);
return 0;
More information about the libc-commits
mailing list