[libc-commits] [libc] e908f61 - [libc] Fix WEOF and fix 1'000'000 error messages on test failure (#147928)

via libc-commits libc-commits at lists.llvm.org
Fri Jul 11 01:35:08 PDT 2025


Author: William Huynh
Date: 2025-07-11T09:35:04+01:00
New Revision: e908f6131e70394023fd6c5fab7fb10c16c184ed

URL: https://github.com/llvm/llvm-project/commit/e908f6131e70394023fd6c5fab7fb10c16c184ed
DIFF: https://github.com/llvm/llvm-project/commit/e908f6131e70394023fd6c5fab7fb10c16c184ed.diff

LOG: [libc] Fix WEOF and fix 1'000'000 error messages on test failure (#147928)

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

Added: 
    

Modified: 
    libc/include/llvm-libc-macros/wchar-macros.h
    libc/test/src/math/smoke/RoundToIntegerTest.h

Removed: 
    


################################################################################
diff  --git a/libc/include/llvm-libc-macros/wchar-macros.h b/libc/include/llvm-libc-macros/wchar-macros.h
index 5b211f5276b62..2a0cabd6133a4 100644
--- a/libc/include/llvm-libc-macros/wchar-macros.h
+++ b/libc/include/llvm-libc-macros/wchar-macros.h
@@ -9,8 +9,10 @@
 #ifndef LLVM_LIBC_MACROS_WCHAR_MACROS_H
 #define LLVM_LIBC_MACROS_WCHAR_MACROS_H
 
+#include "../llvm-libc-types/wint_t.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));


        


More information about the libc-commits mailing list