Skip to content

Conversation

@saturn691
Copy link
Contributor

@saturn691 saturn691 commented Jul 10, 2025

  1. WEOF is defined as a wint_t by the C standard. On certain architectures, the test won't compile on -Wall. This fixes it.
  2. If testSubnormalRange fails, it will spit out way too many error messages, which overwhelms my test environment. I reduce this to 1k for now.

This is required for #145349

@llvmbot
Copy link
Member

llvmbot commented Jul 10, 2025

@llvm/pr-subscribers-libc

Author: William Huynh (saturn691)

Changes
  1. WEOF is defined as a wint_t by the C standard. On certain architectures, the test won't compile on -Wall. This fixes it.
  2. If testSubnormalRange fails, it will spit out way too many error messages, which overwhelms my test environment. I reduce this to 1k for now.

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

2 Files Affected:

  • (modified) libc/include/llvm-libc-macros/wchar-macros.h (+1-1)
  • (modified) libc/test/src/math/smoke/RoundToIntegerTest.h (+2-1)
diff --git a/libc/include/llvm-libc-macros/wchar-macros.h b/libc/include/llvm-libc-macros/wchar-macros.h
index 5b211f5276b62..21a3453ce4c2c 100644
--- a/libc/include/llvm-libc-macros/wchar-macros.h
+++ b/libc/include/llvm-libc-macros/wchar-macros.h
@@ -10,7 +10,7 @@
 #define LLVM_LIBC_MACROS_WCHAR_MACROS_H
 
 #ifndef WEOF
-#define WEOF 0xffffffffu
+#define WEOF ((wint_t)(0xffffffffu))
 #endif
 
 #endif // LLVM_LIBC_MACROS_WCHAR_MACROS_H
diff --git a/libc/test/src/math/smoke/RoundToIntegerTest.h b/libc/test/src/math/smoke/RoundToIntegerTest.h
index 745ccbc748ecd..2b460aef6ef32 100644
--- a/libc/test/src/math/smoke/RoundToIntegerTest.h
+++ b/libc/test/src/math/smoke/RoundToIntegerTest.h
@@ -113,7 +113,8 @@ class RoundToIntegerTestTemplate
   }
 
   void testSubnormalRange(RoundToIntegerFunc func) {
-    constexpr int COUNT = 1'000'001;
+    // Arbitrary, trades off completeness with testing time (esp. on failure)
+    constexpr int COUNT = 1'000;
     constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
         static_cast<StorageType>((MAX_SUBNORMAL - MIN_SUBNORMAL) / COUNT),
         StorageType(1));

@saturn691 saturn691 merged commit e908f61 into llvm:main Jul 11, 2025
19 checks passed
@saturn691 saturn691 deleted the libc-bugs branch July 11, 2025 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants