[libc-commits] [libc] [libc] Implement swprintf. (PR #235008)

Michael Jones via libc-commits libc-commits at lists.llvm.org
Wed Nov 4 16:04:22 PST 2026


================
@@ -14,15 +14,3147 @@
 #include "hdr/errno_macros.h"
 #include "hdr/types/size_t.h"
 #include "hdr/types/wchar_t.h"
+#include "hdr/types/wint_t.h"
+#include "hdr/wchar_macros.h"
+#include "src/__support/CPP/limits.h"
+#include "src/__support/FPUtil/FPBits.h"
+#include "src/__support/macros/config.h"
+#include "src/__support/printf_core/printf_config.h"
 #include "src/wchar/swprintf.h"
 #include "test/UnitTest/ErrnoCheckingTest.h"
+#include "test/UnitTest/ErrnoSetterMatcher.h"
+#include "test/UnitTest/RoundingModeUtils.h"
 #include "test/UnitTest/Test.h"
 
+#include <inttypes.h>
+
+using LIBC_NAMESPACE::fputil::testing::ForceRoundingMode;
+using LIBC_NAMESPACE::fputil::testing::RoundingMode;
+
 using LlvmLibcSwprintfTest = LIBC_NAMESPACE::testing::ErrnoCheckingTest;
 
-TEST_F(LlvmLibcSwprintfTest, StubReturnsMinusOne) {
-  wchar_t buf[10];
-  int result = LIBC_NAMESPACE::swprintf(buf, 10, L"test");
-  ASSERT_EQ(result, -1);
-  ASSERT_ERRNO_EQ(ENOSYS);
+#define ASSERT_STREQ_LEN(actual_written, actual_str, expected_str)             \
----------------
michaelrj-google wrote:

nit: I realize this was copied from `sprintf_test.cpp` so it's not your fault, it's mine. This macro is two `EXPECT`s so it should be named `EXPECT_STREQ_LEN` not `ASSERT`.

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


More information about the libc-commits mailing list