]> Savannah Git Hosting - gnulib.git/commitdiff
limits-h: port to pcc
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 1 May 2023 15:11:12 +0000 (08:11 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 1 May 2023 15:11:37 +0000 (08:11 -0700)
* doc/posix-headers/limits.texi: Document the issue.
* lib/limits.in.h (MB_LEN_MAX): New macro, if not already defined.
* m4/limits-h.m4 (gl_LIMITS_H): Test for MB_LEN_MAX.
* tests/test-limits-h.c: Check that it’s positive.

ChangeLog
doc/posix-headers/limits.texi
lib/limits.in.h
m4/limits-h.m4
tests/test-limits-h.c

index e25324c3debdc5c4f36a54610825aa7454db8800..8f035572656a27d8205d3694f0695e8794fc9928 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-05-01  Paul Eggert  <eggert@cs.ucla.edu>
+
+       limits-h: port to pcc
+       * doc/posix-headers/limits.texi: Document the issue.
+       * lib/limits.in.h (MB_LEN_MAX): New macro, if not already defined.
+       * m4/limits-h.m4 (gl_LIMITS_H): Test for MB_LEN_MAX.
+       * tests/test-limits-h.c: Check that it’s positive.
+
 2023-04-28  Paul Eggert  <eggert@cs.ucla.edu>
 
        year2038-recommended: new module
index 09440cac8d66d3f8a7d92d93a05fb4c7dd768817..5fdcd14546422989cfc9722d5d43f083179c1670 100644 (file)
@@ -12,6 +12,9 @@ The macros @code{LLONG_MIN}, @code{LLONG_MAX}, @code{ULLONG_MAX} are not
 defined on some platforms:
 older glibc systems (e.g. Fedora 1), AIX 5.1, HP-UX 11, IRIX 6.5, OpenVMS.
 @item
+The macro @code{MB_LEN_MAX} is not defined on some platforms:
+pcc 1.2.0.DEVEL 20220331.
+@item
 The macros @code{WORD_BIT}, @code{LONG_BIT} are not defined on some platforms:
 glibc 2.11 without @code{-D_GNU_SOURCE}, Cygwin, mingw, MSVC 14.
 @item
index a01b4c6a28042c2486dd4bb1f317f2aa16076ea0..45d46fd6897011dae4d61ffcb4dd7671a9f1e4b0 100644 (file)
 # endif
 #endif
 
+/* Assume no multibyte character is longer than 16 bytes.  */
+#ifndef MB_LEN_MAX
+# define MB_LEN_MAX 16
+#endif
+
 /* Macros specified by C23 and by ISO/IEC TS 18661-1:2014.  */
 
 #if (! defined ULLONG_WIDTH                                             \
index 4f8ce41098a96a2eea7c80be38051c3e9c76e5ec..ca0294e5500ec2c8ddab1fd910b0396cb52a6227 100644 (file)
@@ -24,6 +24,7 @@ AC_DEFUN_ONCE([gl_LIMITS_H],
             int ullw = ULLONG_WIDTH;
             int bw = BOOL_WIDTH;
             int bm = BOOL_MAX;
+            int mblm = MB_LEN_MAX;
           ]])],
        [gl_cv_header_limits_width=yes],
        [gl_cv_header_limits_width=no])])
index d8cdac288de7cf0ebe4567e862610fe3850c915c..d7cfba713108c50cbdc9f571860cdc812fa3d825 100644 (file)
@@ -113,6 +113,8 @@ verify_width (ULLONG_WIDTH, 0, ULLONG_MAX);
 int bool_attrs[] = { BOOL_MAX, BOOL_WIDTH };
 static_assert (BOOL_MAX == (((1U << (BOOL_WIDTH - 1)) - 1) * 2) + 1);
 
+static_assert (0 < MB_LEN_MAX);
+
 int
 main (void)
 {