Skip to content

Commit b209eda

Browse files
authored
[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 #79358
1 parent fc66eaa commit b209eda

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

libc/include/llvm-libc-macros/limits-macros.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,10 @@
1919
#endif // __CHAR_BIT__
2020
#endif // CHAR_BIT
2121

22-
// TODO: https://github.com/llvm/llvm-project/issues/79358
23-
// Define MB_LEN_MAX if missing.
24-
// clang: MB_LEN_MAX = 1 -
25-
// https://github.com/llvm/llvm-project/blob/main/clang/lib/Headers/limits.h#L64
26-
// glibc: MB_LEN_MAX = 16 -
27-
// https://github.com/bminor/glibc/blob/master/include/limits.h#L32
22+
#ifndef MB_LEN_MAX
23+
// Represents a single UTF-32 wide character in the default locale.
24+
#define MB_LEN_MAX 4
25+
#endif // MB_LEN_MAX
2826

2927
// *_WIDTH macros
3028

0 commit comments

Comments
 (0)