[libc-commits] [libc] b209eda - [libc] Define `MB_LEN_MAX` in `limits.h` (#102246)
via libc-commits
libc-commits at lists.llvm.org
Wed Aug 7 05:59:48 PDT 2024
Author: Joseph Huber
Date: 2024-08-07T07:59:44-05:00
New Revision: b209eda621bc53e58509d05fa392cb724fa6bd6e
URL: https://github.com/llvm/llvm-project/commit/b209eda621bc53e58509d05fa392cb724fa6bd6e
DIFF: https://github.com/llvm/llvm-project/commit/b209eda621bc53e58509d05fa392cb724fa6bd6e.diff
LOG: [libc] Define `MB_LEN_MAX` in `limits.h` (#102246)
Summary:
This is supposed to define the maximum bytes required to store a char in
any locale. There's some question about what this should be set to. I
believe because the proposed solution for `locale.h` is to only support
the default locale, we should do what `musl` does and set it to `4`
which covers up to UTF-32.
Fixes https://github.com/llvm/llvm-project/issues/79358
Added:
Modified:
libc/include/llvm-libc-macros/limits-macros.h
Removed:
################################################################################
diff --git a/libc/include/llvm-libc-macros/limits-macros.h b/libc/include/llvm-libc-macros/limits-macros.h
index 456487e603b254..d4aa7ae539e8aa 100644
--- a/libc/include/llvm-libc-macros/limits-macros.h
+++ b/libc/include/llvm-libc-macros/limits-macros.h
@@ -19,12 +19,10 @@
#endif // __CHAR_BIT__
#endif // CHAR_BIT
-// TODO: https://github.com/llvm/llvm-project/issues/79358
-// Define MB_LEN_MAX if missing.
-// clang: MB_LEN_MAX = 1 -
-// https://github.com/llvm/llvm-project/blob/main/clang/lib/Headers/limits.h#L64
-// glibc: MB_LEN_MAX = 16 -
-// https://github.com/bminor/glibc/blob/master/include/limits.h#L32
+#ifndef MB_LEN_MAX
+// Represents a single UTF-32 wide character in the default locale.
+#define MB_LEN_MAX 4
+#endif // MB_LEN_MAX
// *_WIDTH macros
More information about the libc-commits
mailing list