[libc-commits] [libc] [libc][wctype] Add cmake flag for configuring wctype implementation used (PR #170531)

Marcell Leleszi via libc-commits libc-commits at lists.llvm.org
Wed Dec 3 10:40:37 PST 2025


https://github.com/mleleszi created https://github.com/llvm/llvm-project/pull/170531

#170525 

Based on our [RFC](https://discourse.llvm.org/t/rfc-libc-wctype-header-implementation/88941/10), we are starting the implementation of the wctype header with C.UTF8 support. This implementation will increase the binary size by approximately ~70KB, so this PR introduces a flag so that this is configurable, allowing the user to choose between a simple ASCII implementation or the full Unicode one.

>From 2554204b615001d14af9125d9953e02fe7a0a262 Mon Sep 17 00:00:00 2001
From: Marcell Leleszi <mleleszi at google.com>
Date: Wed, 3 Dec 2025 18:24:45 +0000
Subject: [PATCH] Add cmake flag for configuring wctype implementation used

---
 libc/config/config.json | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libc/config/config.json b/libc/config/config.json
index cfbe9a43948ea..a7844e4fe2dd1 100644
--- a/libc/config/config.json
+++ b/libc/config/config.json
@@ -130,5 +130,11 @@
       "value": true,
       "doc": "Add nullptr checks in the library's implementations to some functions for which passing nullptr is undefined behavior."
     }
+  },
+  "wctype": {
+    "LIBC_CONF_WCTYPE_MODE": {
+      "value": "LIBC_WCTYPE_MODE_ASCII",
+      "doc": "The implementation used for wctype, acceptable values are LIBC_WCTYPE_MODE_ASCII and LIBC_WCTYPE_MODE_UTF8."
+    }
   }
 }



More information about the libc-commits mailing list