[PATCH] newlib/libc/ctype: Bypass _jp2uc/_uc2jp if _MB_CAPABLE is not set

[email protected] Mon, 19 Jan 2026 12:03:20 -0500
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
From: Andrew Oates <[email protected]>

Currently, if an application uses towctrans or towctrans_l with a newlib
compiled without _MB_CAPABLE, it will fail to link due to _jp2uc/_uc2jp
being undefined.  This extends the cygwin behavior to all
non-_MB_CAPABLE builds.
---
 newlib/libc/ctype/local.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/newlib/libc/ctype/local.h b/newlib/libc/ctype/local.h
index 5c293c83d..1acdfd277 100644
--- a/newlib/libc/ctype/local.h
+++ b/newlib/libc/ctype/local.h
@@ -32,7 +32,7 @@
    * for towupper and towlower, the result must be back-transformed
      into the respective locale encoding; currently NOT IMPLEMENTED
 */
-#ifdef __CYGWIN__
+#if defined(__CYGWIN__) || !defined(_MB_CAPABLE)
 /* Under Cygwin, wchar_t (or its extension wint_t) is Unicode */
 #define _jp2uc(c) (c)
 #define _jp2uc_l(c, l) (c)
-- 
2.52.0