[libc-commits] [libc] [libc] add iswblank entrypoint (PR #185272)
via libc-commits
libc-commits at lists.llvm.org
Mon Mar 9 11:57:57 PDT 2026
https://github.com/alowqie updated https://github.com/llvm/llvm-project/pull/185272
>From e621b37df5bce1ea86bd92ea8c82e437089d5032 Mon Sep 17 00:00:00 2001
From: alowqie <25634711+alowqie at users.noreply.github.com>
Date: Sun, 8 Mar 2026 12:25:25 +0100
Subject: [PATCH 1/2] [libc] add iswblank entrypoint
---
libc/config/baremetal/arm/entrypoints.txt | 1 +
libc/config/baremetal/riscv/entrypoints.txt | 1 +
libc/config/darwin/aarch64/entrypoints.txt | 1 +
libc/config/linux/aarch64/entrypoints.txt | 1 +
libc/config/linux/arm/entrypoints.txt | 1 +
libc/config/linux/riscv/entrypoints.txt | 1 +
libc/config/linux/x86_64/entrypoints.txt | 1 +
libc/config/windows/entrypoints.txt | 1 +
libc/include/wctype.yaml | 6 ++++++
libc/src/wctype/CMakeLists.txt | 10 +++++++++
libc/src/wctype/iswblank.cpp | 21 ++++++++++++++++++
libc/src/wctype/iswblank.h | 21 ++++++++++++++++++
libc/test/src/wctype/CMakeLists.txt | 10 +++++++++
libc/test/src/wctype/iswblank_test.cpp | 24 +++++++++++++++++++++
14 files changed, 100 insertions(+)
create mode 100644 libc/src/wctype/iswblank.cpp
create mode 100644 libc/src/wctype/iswblank.h
create mode 100644 libc/test/src/wctype/iswblank_test.cpp
diff --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt
index 7bc92e84b7fa4..3fb5b8ce63748 100644
--- a/libc/config/baremetal/arm/entrypoints.txt
+++ b/libc/config/baremetal/arm/entrypoints.txt
@@ -299,6 +299,7 @@ set(TARGET_LIBC_ENTRYPOINTS
# wctype.h entrypoints
libc.src.wctype.iswalpha
+ libc.src.wctype.iswblank
# internal entrypoints
libc.startup.baremetal.init
diff --git a/libc/config/baremetal/riscv/entrypoints.txt b/libc/config/baremetal/riscv/entrypoints.txt
index 29be47dfbfd53..4e178a02568bb 100644
--- a/libc/config/baremetal/riscv/entrypoints.txt
+++ b/libc/config/baremetal/riscv/entrypoints.txt
@@ -296,6 +296,7 @@ set(TARGET_LIBC_ENTRYPOINTS
# wctype.h entrypoints
libc.src.wctype.iswalpha
+ libc.src.wctype.iswblank
# internal entrypoints
libc.startup.baremetal.init
diff --git a/libc/config/darwin/aarch64/entrypoints.txt b/libc/config/darwin/aarch64/entrypoints.txt
index b4a1ee70764cb..aad8f91dcefb7 100644
--- a/libc/config/darwin/aarch64/entrypoints.txt
+++ b/libc/config/darwin/aarch64/entrypoints.txt
@@ -102,6 +102,7 @@ set(TARGET_LIBC_ENTRYPOINTS
# wctype.h entrypoints
libc.src.wctype.iswalpha
+ libc.src.wctype.iswblank
)
if(LLVM_LIBC_FULL_BUILD)
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index 960958b7cf90a..044b7117028da 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -369,6 +369,7 @@ set(TARGET_LIBC_ENTRYPOINTS
# wctype.h entrypoints
libc.src.wctype.iswalpha
+ libc.src.wctype.iswblank
# sys/uio.h entrypoints
libc.src.sys.uio.writev
diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt
index e76bf81670ce5..ee74472a3adf4 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -194,6 +194,7 @@ set(TARGET_LIBC_ENTRYPOINTS
# wctype.h entrypoints
libc.src.wctype.iswalpha
+ libc.src.wctype.iswblank
)
if(LLVM_LIBC_FULL_BUILD)
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index a69d1a1b0a642..f22800c457261 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -373,6 +373,7 @@ set(TARGET_LIBC_ENTRYPOINTS
# wctype.h entrypoints
libc.src.wctype.iswalpha
+ libc.src.wctype.iswblank
# sys/uio.h entrypoints
libc.src.sys.uio.writev
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index 4103ee0331a23..8db48e52a3a6f 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -418,6 +418,7 @@ set(TARGET_LIBC_ENTRYPOINTS
# wctype.h entrypoints
libc.src.wctype.iswalpha
+ libc.src.wctype.iswblank
# sys/uio.h entrypoints
libc.src.sys.uio.writev
diff --git a/libc/config/windows/entrypoints.txt b/libc/config/windows/entrypoints.txt
index f777fc6c94bc2..b4eb7e0d97b4e 100644
--- a/libc/config/windows/entrypoints.txt
+++ b/libc/config/windows/entrypoints.txt
@@ -108,6 +108,7 @@ set(TARGET_LIBC_ENTRYPOINTS
# wctype.h entrypoints
libc.src.wctype.iswalpha
+ libc.src.wctype.iswblank
)
set(TARGET_LIBM_ENTRYPOINTS
diff --git a/libc/include/wctype.yaml b/libc/include/wctype.yaml
index fb4f96f7d17e4..1f5c7ba454146 100644
--- a/libc/include/wctype.yaml
+++ b/libc/include/wctype.yaml
@@ -8,3 +8,9 @@ functions:
return_type: int
arguments:
- type: wint_t
+ - name: iswblank
+ standards:
+ - stdc
+ return_type: int
+ arguments:
+ - type: wint_t
diff --git a/libc/src/wctype/CMakeLists.txt b/libc/src/wctype/CMakeLists.txt
index 3ac5eaef8ed8b..a5aa7e924f50d 100644
--- a/libc/src/wctype/CMakeLists.txt
+++ b/libc/src/wctype/CMakeLists.txt
@@ -7,3 +7,13 @@ add_entrypoint_object(
DEPENDS
libc.src.__support.wctype_utils
)
+
+add_entrypoint_object(
+ iswblank
+ SRCS
+ iswblank.cpp
+ HDRS
+ iswblank.h
+ DEPENDS
+ libc.src.__support.wctype_utils
+)
diff --git a/libc/src/wctype/iswblank.cpp b/libc/src/wctype/iswblank.cpp
new file mode 100644
index 0000000000000..2c42218e582b9
--- /dev/null
+++ b/libc/src/wctype/iswblank.cpp
@@ -0,0 +1,21 @@
+//===-- Implementation of iswblank ----------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/wctype/iswblank.h"
+#include "src/__support/common.h"
+#include "src/__support/wctype_utils.h"
+
+#include "hdr/types/wint_t.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(int, iswblank, (wint_t c)) {
+ return internal::isblank(static_cast<wchar_t>(c));
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/wctype/iswblank.h b/libc/src/wctype/iswblank.h
new file mode 100644
index 0000000000000..78e7573f5cea6
--- /dev/null
+++ b/libc/src/wctype/iswblank.h
@@ -0,0 +1,21 @@
+//===-- Implementation header for iswblank ----------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC_WCTYPE_ISWBLANK_H
+#define LLVM_LIBC_SRC_WCTYPE_ISWBLANK_H
+
+#include "hdr/types/wint_t.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+int iswblank(wint_t c);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_WCTYPE_ISWBLANK_H
diff --git a/libc/test/src/wctype/CMakeLists.txt b/libc/test/src/wctype/CMakeLists.txt
index 5459cdb4a9b71..cf1d7ca397ae2 100644
--- a/libc/test/src/wctype/CMakeLists.txt
+++ b/libc/test/src/wctype/CMakeLists.txt
@@ -9,3 +9,13 @@ add_libc_test(
DEPENDS
libc.src.wctype.iswalpha
)
+
+add_libc_test(
+ iswblank_test
+ SUITE
+ libc_wctype_unittests
+ SRCS
+ iswblank_test.cpp
+ DEPENDS
+ libc.src.wctype.iswblank
+)
diff --git a/libc/test/src/wctype/iswblank_test.cpp b/libc/test/src/wctype/iswblank_test.cpp
new file mode 100644
index 0000000000000..137f8c218ee1a
--- /dev/null
+++ b/libc/test/src/wctype/iswblank_test.cpp
@@ -0,0 +1,24 @@
+//===-- Unittests for iswblank --------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/__support/CPP/span.h"
+#include "src/wctype/iswblank.h"
+
+#include "test/UnitTest/Test.h"
+
+TEST(LlvmLibciswblank, SimpleTest) {
+ EXPECT_NE(LIBC_NAMESPACE::iswblank(' '), 0);
+ EXPECT_NE(LIBC_NAMESPACE::iswblank('\t'), 0);
+
+ EXPECT_EQ(LIBC_NAMESPACE::iswblank('a'), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::iswblank('\n'), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::iswblank('3'), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::iswblank('?'), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::iswblank('\0'), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::iswblank(-1), 0);
+}
>From 49eab209f7fbd3ad58a8a91ed7a48d89bc8e2016 Mon Sep 17 00:00:00 2001
From: alowqie <areida at pm.me>
Date: Mon, 9 Mar 2026 19:57:16 +0100
Subject: [PATCH 2/2] add missing dependency, remove include
---
libc/src/wctype/CMakeLists.txt | 3 +-
libc/src/wctype/iswblank.cpp | 42 +++++++++++------------
libc/src/wctype/iswblank.h | 42 +++++++++++------------
libc/test/src/wctype/iswblank_test.cpp | 47 +++++++++++++-------------
4 files changed, 67 insertions(+), 67 deletions(-)
diff --git a/libc/src/wctype/CMakeLists.txt b/libc/src/wctype/CMakeLists.txt
index a5aa7e924f50d..b6a266a24a1f3 100644
--- a/libc/src/wctype/CMakeLists.txt
+++ b/libc/src/wctype/CMakeLists.txt
@@ -15,5 +15,6 @@ add_entrypoint_object(
HDRS
iswblank.h
DEPENDS
- libc.src.__support.wctype_utils
+ libc.src.__support.wctype_utils
+ libc.hdr.types.wint_t
)
diff --git a/libc/src/wctype/iswblank.cpp b/libc/src/wctype/iswblank.cpp
index 2c42218e582b9..f1f35743eecb6 100644
--- a/libc/src/wctype/iswblank.cpp
+++ b/libc/src/wctype/iswblank.cpp
@@ -1,21 +1,21 @@
-//===-- Implementation of iswblank ----------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "src/wctype/iswblank.h"
-#include "src/__support/common.h"
-#include "src/__support/wctype_utils.h"
-
-#include "hdr/types/wint_t.h"
-
-namespace LIBC_NAMESPACE_DECL {
-
-LLVM_LIBC_FUNCTION(int, iswblank, (wint_t c)) {
- return internal::isblank(static_cast<wchar_t>(c));
-}
-
-} // namespace LIBC_NAMESPACE_DECL
+//===-- Implementation of iswblank ----------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/wctype/iswblank.h"
+#include "src/__support/common.h"
+#include "src/__support/wctype_utils.h"
+
+#include "hdr/types/wint_t.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(int, iswblank, (wint_t c)) {
+ return internal::isblank(static_cast<wchar_t>(c));
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/wctype/iswblank.h b/libc/src/wctype/iswblank.h
index 78e7573f5cea6..031568650e700 100644
--- a/libc/src/wctype/iswblank.h
+++ b/libc/src/wctype/iswblank.h
@@ -1,21 +1,21 @@
-//===-- Implementation header for iswblank ----------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_LIBC_SRC_WCTYPE_ISWBLANK_H
-#define LLVM_LIBC_SRC_WCTYPE_ISWBLANK_H
-
-#include "hdr/types/wint_t.h"
-#include "src/__support/common.h"
-
-namespace LIBC_NAMESPACE_DECL {
-
-int iswblank(wint_t c);
-
-} // namespace LIBC_NAMESPACE_DECL
-
-#endif // LLVM_LIBC_SRC_WCTYPE_ISWBLANK_H
+//===-- Implementation header for iswblank ----------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC_WCTYPE_ISWBLANK_H
+#define LLVM_LIBC_SRC_WCTYPE_ISWBLANK_H
+
+#include "hdr/types/wint_t.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+int iswblank(wint_t c);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_WCTYPE_ISWBLANK_H
diff --git a/libc/test/src/wctype/iswblank_test.cpp b/libc/test/src/wctype/iswblank_test.cpp
index 137f8c218ee1a..62df76ed9bb1e 100644
--- a/libc/test/src/wctype/iswblank_test.cpp
+++ b/libc/test/src/wctype/iswblank_test.cpp
@@ -1,24 +1,23 @@
-//===-- Unittests for iswblank --------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "src/__support/CPP/span.h"
-#include "src/wctype/iswblank.h"
-
-#include "test/UnitTest/Test.h"
-
-TEST(LlvmLibciswblank, SimpleTest) {
- EXPECT_NE(LIBC_NAMESPACE::iswblank(' '), 0);
- EXPECT_NE(LIBC_NAMESPACE::iswblank('\t'), 0);
-
- EXPECT_EQ(LIBC_NAMESPACE::iswblank('a'), 0);
- EXPECT_EQ(LIBC_NAMESPACE::iswblank('\n'), 0);
- EXPECT_EQ(LIBC_NAMESPACE::iswblank('3'), 0);
- EXPECT_EQ(LIBC_NAMESPACE::iswblank('?'), 0);
- EXPECT_EQ(LIBC_NAMESPACE::iswblank('\0'), 0);
- EXPECT_EQ(LIBC_NAMESPACE::iswblank(-1), 0);
-}
+//===-- Unittests for iswblank --------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/wctype/iswblank.h"
+
+#include "test/UnitTest/Test.h"
+
+TEST(LlvmLibciswblank, SimpleTest) {
+ EXPECT_NE(LIBC_NAMESPACE::iswblank(' '), 0);
+ EXPECT_NE(LIBC_NAMESPACE::iswblank('\t'), 0);
+
+ EXPECT_EQ(LIBC_NAMESPACE::iswblank('a'), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::iswblank('\n'), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::iswblank('3'), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::iswblank('?'), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::iswblank('\0'), 0);
+ EXPECT_EQ(LIBC_NAMESPACE::iswblank(-1), 0);
+}
More information about the libc-commits
mailing list