emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/android 59fdd16f900 1/2: Merge remote-tracking branch 'origin/ma


From: Po Lu
Subject: feature/android 59fdd16f900 1/2: Merge remote-tracking branch 'origin/master' into feature/android
Date: Wed, 7 Jun 2023 21:30:01 -0400 (EDT)

branch: feature/android
commit 59fdd16f900ad16e726b46b266e85df0c22748c8
Merge: 49dceb9dd6b a902156068a
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Merge remote-tracking branch 'origin/master' into feature/android
---
 lib/careadlinkat.c             |  8 ++--
 lib/diffseq.h                  | 20 ++++++++-
 lib/file-has-acl.c             | 10 ++++-
 lib/flexmember.h               | 13 +++++-
 lib/limits.in.h                | 12 ++++++
 lib/nstrftime.c                | 10 ++++-
 lib/regex_internal.h           |  3 --
 lisp/progmodes/verilog-mode.el | 53 ++++++++++++++---------
 m4/copy-file-range.m4          | 18 ++------
 m4/gnulib-common.m4            |  4 --
 m4/limits-h.m4                 | 21 +++++++---
 m4/manywarnings.m4             | 95 +++++++++++++++++++-----------------------
 m4/ssize_t.m4                  | 28 +++++++++----
 m4/strtoll.m4                  | 16 ++++---
 m4/warnings.m4                 | 76 ++++++++++++++++++++++++++++-----
 15 files changed, 254 insertions(+), 133 deletions(-)

diff --git a/lib/careadlinkat.c b/lib/careadlinkat.c
index 359d497396c..49c92dcc196 100644
--- a/lib/careadlinkat.c
+++ b/lib/careadlinkat.c
@@ -35,10 +35,6 @@
 # define SIZE_MAX ((size_t) -1)
 #endif
 
-#ifndef SSIZE_MAX
-# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
-#endif
-
 #include "allocator.h"
 
 enum { STACK_BUF_SIZE = 1024 };
@@ -55,7 +51,9 @@ enum { STACK_BUF_SIZE = 1024 };
    When the GCC bug is fixed this workaround should be limited to the
    broken GCC versions.  */
 #if _GL_GNUC_PREREQ (10, 1)
-# if defined GCC_LINT || defined lint
+# if _GL_GNUC_PREREQ (12, 1)
+#  pragma GCC diagnostic ignored "-Wreturn-local-addr"
+# elif defined GCC_LINT || defined lint
 __attribute__ ((__noinline__))
 # elif __OPTIMIZE__ && !__NO_INLINE__
 #  define GCC_BOGUS_WRETURN_LOCAL_ADDR
diff --git a/lib/diffseq.h b/lib/diffseq.h
index dfaf4f295e8..06e1465bf1b 100644
--- a/lib/diffseq.h
+++ b/lib/diffseq.h
@@ -48,6 +48,10 @@
      OFFSET                  A signed integer type sufficient to hold the
                              difference between two indices.  Usually
                              something like ptrdiff_t.
+     OFFSET_MAX              (Optional) The maximum value of OFFSET (e.g.,
+                             PTRDIFF_MAX).  If omitted, it is inferred in a
+                             way portable to the vast majority of C platforms,
+                             as they lack padding bits.
      EXTRA_CONTEXT_FIELDS    Declarations of fields for 'struct context'.
      NOTE_DELETE(ctxt, xoff) Record the removal of the object xvec[xoff].
      NOTE_INSERT(ctxt, yoff) Record the insertion of the object yvec[yoff].
@@ -74,8 +78,10 @@
  */
 
 /* Maximum value of type OFFSET.  */
-#define OFFSET_MAX \
-  ((((OFFSET)1 << (sizeof (OFFSET) * CHAR_BIT - 2)) - 1) * 2 + 1)
+#ifndef OFFSET_MAX
+# define OFFSET_MAX \
+   ((((OFFSET) 1 << (sizeof (OFFSET) * CHAR_BIT - 2)) - 1) * 2 + 1)
+#endif
 
 /* Default to no early abort.  */
 #ifndef EARLY_ABORT
@@ -88,11 +94,17 @@
 
 /* Use this to suppress gcc's "...may be used before initialized" warnings.
    Beware: The Code argument must not contain commas.  */
+#if __GNUC__ + (__GNUC_MINOR__ >= 7) > 4
+# pragma GCC diagnostic push
+#endif
 #ifndef IF_LINT
 # if defined GCC_LINT || defined lint
 #  define IF_LINT(Code) Code
 # else
 #  define IF_LINT(Code) /* empty */
+#  if __GNUC__ + (__GNUC_MINOR__ >= 7) > 4
+#   pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#  endif
 # endif
 #endif
 
@@ -556,6 +568,10 @@ compareseq (OFFSET xoff, OFFSET xlim, OFFSET yoff, OFFSET 
ylim,
   #undef XREF_YREF_EQUAL
 }
 
+#if __GNUC__ + (__GNUC_MINOR__ >= 7) > 4
+# pragma GCC diagnostic pop
+#endif
+
 #undef ELEMENT
 #undef EQUAL
 #undef OFFSET
diff --git a/lib/file-has-acl.c b/lib/file-has-acl.c
index 4cddc80bd13..3eeaf9c57d1 100644
--- a/lib/file-has-acl.c
+++ b/lib/file-has-acl.c
@@ -28,7 +28,7 @@
 #include "acl.h"
 
 #include "acl-internal.h"
-
+#include "attribute.h"
 #include "minmax.h"
 
 #if USE_ACL && HAVE_LINUX_XATTR_H && HAVE_LISTXATTR
@@ -40,6 +40,12 @@
 # ifndef XATTR_NAME_NFSV4_ACL
 #  define XATTR_NAME_NFSV4_ACL "system.nfs4_acl"
 # endif
+# ifndef XATTR_NAME_POSIX_ACL_ACCESS
+#  define XATTR_NAME_POSIX_ACL_ACCESS "system.posix_acl_access"
+# endif
+# ifndef XATTR_NAME_POSIX_ACL_DEFAULT
+#  define XATTR_NAME_POSIX_ACL_DEFAULT "system.posix_acl_default"
+# endif
 
 enum {
   /* ACE4_ACCESS_ALLOWED_ACE_TYPE = 0x00000000, */
@@ -50,7 +56,7 @@ enum {
 /* Return true if ATTR is in the set represented by the NUL-terminated
    strings in LISTBUF, which is of size LISTSIZE.  */
 
-static bool
+ATTRIBUTE_PURE static bool
 have_xattr (char const *attr, char const *listbuf, ssize_t listsize)
 {
   char const *blim = listbuf + listsize;
diff --git a/lib/flexmember.h b/lib/flexmember.h
index 8c5915ecf9c..8df44195392 100644
--- a/lib/flexmember.h
+++ b/lib/flexmember.h
@@ -43,7 +43,7 @@
    followed by N bytes of other data.  The result is suitable as an
    argument to malloc.  For example:
 
-     struct s { int n; char d[FLEXIBLE_ARRAY_MEMBER]; };
+     struct s { int a; char d[FLEXIBLE_ARRAY_MEMBER]; };
      struct s *p = malloc (FLEXSIZEOF (struct s, d, n * sizeof (char)));
 
    FLEXSIZEOF (TYPE, MEMBER, N) is not simply (sizeof (TYPE) + N),
@@ -63,3 +63,14 @@
 #define FLEXSIZEOF(type, member, n) \
    ((offsetof (type, member) + FLEXALIGNOF (type) - 1 + (n)) \
     & ~ (FLEXALIGNOF (type) - 1))
+
+/* Yield a properly aligned upper bound on the size of a struct of
+   type TYPE with a flexible array member named MEMBER that has N
+   elements.  The result is suitable as an argument to malloc.
+   For example:
+
+     struct s { int a; double d[FLEXIBLE_ARRAY_MEMBER]; };
+     struct s *p = malloc (FLEXNSIZEOF (struct s, d, n));
+ */
+#define FLEXNSIZEOF(type, member, n) \
+  FLEXSIZEOF (type, member, (n) * sizeof (((type *) 0)->member[0]))
diff --git a/lib/limits.in.h b/lib/limits.in.h
index 45d46fd6897..1d479c3d192 100644
--- a/lib/limits.in.h
+++ b/lib/limits.in.h
@@ -134,6 +134,18 @@
 # endif
 #endif
 
+/* Macro specified by POSIX.  */
+
+/* The maximal size_t value.  Although it might not be of ssize_t type
+   as it should be, it's too much trouble to fix this minor detail.  */
+#ifndef SSIZE_MAX
+# ifdef _WIN64
+#  define SSIZE_MAX LLONG_MAX
+# else
+#  define SSIZE_MAX LONG_MAX
+# endif
+#endif
+
 #endif /* _@GUARD_PREFIX@_LIMITS_H */
 #endif /* _@GUARD_PREFIX@_LIMITS_H */
 #endif
diff --git a/lib/nstrftime.c b/lib/nstrftime.c
index 2a1dd8d88d7..c4bef575fcd 100644
--- a/lib/nstrftime.c
+++ b/lib/nstrftime.c
@@ -276,6 +276,14 @@ extern char *tzname[];
    more reliable way to accept other sets of digits.  */
 #define ISDIGIT(Ch) ((unsigned int) (Ch) - L_('0') <= 9)
 
+/* Avoid false GCC warning "'memset' specified size 18446744073709551615 
exceeds
+   maximum object size 9223372036854775807", caused by insufficient data flow
+   analysis and value propagation of the 'width_add' expansion when GCC is not
+   optimizing.  Cf. <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88443>.  */
+#if __GNUC__ >= 7 && !__OPTIMIZE__
+# pragma GCC diagnostic ignored "-Wstringop-overflow"
+#endif
+
 #if FPRINTFTIME
 static void
 fwrite_lowcase (FILE *fp, const CHAR_T *src, size_t len)
@@ -1384,7 +1392,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
                 if (len < w)
                   {
                     size_t delta = w - len;
-                    wmemmove (p + delta, p, len);
+                    __wmemmove (p + delta, p, len);
                     wchar_t wc = pad == L_('0') || pad == L_('+') ? L'0' : L' 
';
                     wmemset (p, wc, delta);
                   }
diff --git a/lib/regex_internal.h b/lib/regex_internal.h
index 0270091df70..7e35a112ec2 100644
--- a/lib/regex_internal.h
+++ b/lib/regex_internal.h
@@ -151,9 +151,6 @@
    as some non-GCC platforms lack them, an issue when this code is
    used in Gnulib.  */
 
-#ifndef SSIZE_MAX
-# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
-#endif
 #ifndef ULONG_WIDTH
 # define ULONG_WIDTH REGEX_UINTEGER_WIDTH (ULONG_MAX)
 /* The number of usable bits in an unsigned integer type with maximum
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index 9199119b602..855ba4b50cf 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -9,7 +9,7 @@
 ;; Keywords: languages
 ;; The "Version" is the date followed by the decimal rendition of the Git
 ;;     commit hex.
-;; Version: 2022.12.18.181110314
+;; Version: 2023.06.06.141322628
 
 ;; Yoni Rabkin <yoni@rabkins.net> contacted the maintainer of this
 ;; file on 19/3/2008, and the maintainer agreed that when a bug is
@@ -124,7 +124,7 @@
 ;;
 
 ;; This variable will always hold the version number of the mode
-(defconst verilog-mode-version "2022-12-18-acb862a-vpo-GNU"
+(defconst verilog-mode-version "2023-06-06-86c6984-vpo-GNU"
   "Version of this Verilog mode.")
 (defconst verilog-mode-release-emacs t
   "If non-nil, this version of Verilog mode was released with Emacs itself.")
@@ -5004,21 +5004,31 @@ More specifically, point @ in the line foo : @ begin"
   "Return non-nil if in a generate region.
 More specifically, after a generate and before an endgenerate."
   (interactive)
-  (let ((pos (point))
-        gen-beg-point gen-end-point)
-    (save-match-data
-      (save-excursion
-        (and (verilog-re-search-backward "\\<\\(generate\\)\\>" nil t)
-             (forward-word)
-             (setq gen-beg-point (point))
-             (verilog-forward-sexp)
-             (backward-word)
-             (setq gen-end-point (point)))))
-    (if (and gen-beg-point gen-end-point
-             (>= pos gen-beg-point)
-             (<= pos gen-end-point))
-        t
-      nil)))
+  (let ((nest 1))
+    (save-excursion
+      (catch 'done
+       (while (and
+               (/= nest 0)
+               (verilog-re-search-backward
+                 
"\\<\\(module\\)\\|\\(connectmodule\\)\\|\\(endmodule\\)\\|\\(generate\\)\\|\\(endgenerate\\)\\|\\(if\\)\\|\\(case\\)\\|\\(for\\)\\>"
 nil 'move)
+               (cond
+                ((match-end 1) ; module - we have crawled out
+                 (throw 'done 1))
+                 ((match-end 2) ; connectmodule - we have crawled out
+                  (throw 'done 1))
+                 ((match-end 3) ; endmodule - we were outside of module block
+                  (throw 'done -1))
+                 ((match-end 4) ; generate
+                 (setq nest (1- nest)))
+                 ((match-end 5) ; endgenerate
+                  (setq nest (1+ nest)))
+                 ((match-end 6) ; if
+                  (setq nest (1- nest)))
+                 ((match-end 7) ; case
+                  (setq nest (1- nest)))
+                 ((match-end 8) ; for
+                  (setq nest (1- nest))))))))
+    (= nest 0) )) ; return nest
 
 (defun verilog-in-fork-region-p ()
   "Return non-nil if between a fork and join."
@@ -6737,7 +6747,8 @@ Optional BOUND limits search."
 (defun verilog-pos-at-end-of-statement ()
   "Return point position at the end of current statement."
   (save-excursion
-    (verilog-end-of-statement)))
+    (verilog-end-of-statement)
+    (point)))
 
 (defun verilog-col-at-end-of-statement ()
   "Return current column at the end of current statement."
@@ -8038,7 +8049,8 @@ Region is defined by B and ENDPOS."
   "Return non-nil if current line should ignore indentation."
   (or (and verilog-indent-ignore-multiline-defines
            ;; Line with multiline define, ends with "\" or "\" plus trailing 
whitespace
-           (or (looking-at ".*\\\\\\s-*$")
+           (or (save-excursion
+                 (verilog-re-search-forward ".*\\\\\\s-*$" (line-end-position) 
t))
                (save-excursion  ; Last line after multiline define
                  (verilog-backward-syntactic-ws)
                  (unless (bobp)
@@ -9313,7 +9325,8 @@ Return an array of [outputs inouts inputs wire reg assign 
const gparam intf]."
         ((looking-at "(\\*")
          ;; To advance past either "(*)" or "(* ... *)" don't forward past 
first *
          (forward-char 1)
-         (or (search-forward "*)")
+         (or (looking-at "\\*\\s-*)")  ; (* )
+              (search-forward "*)")  ; end attribute
              (error "%s: Unmatched (* *), at char %d" (verilog-point-text) 
(point))))
         ((eq ?\" (following-char))
           (or (re-search-forward "[^\\]\"" nil t)  ; don't forward-char first, 
since we look for a non backslash first
diff --git a/m4/copy-file-range.m4 b/m4/copy-file-range.m4
index d41f2c48313..fa6ab341091 100644
--- a/m4/copy-file-range.m4
+++ b/m4/copy-file-range.m4
@@ -39,21 +39,9 @@ AC_DEFUN([gl_FUNC_COPY_FILE_RANGE],
 
     case $host_os in
       linux*)
-        AC_CACHE_CHECK([whether copy_file_range is known to work],
-          [gl_cv_copy_file_range_known_to_work],
-          [AC_COMPILE_IFELSE(
-             [AC_LANG_PROGRAM(
-                [[#include <linux/version.h>
-                ]],
-                [[#if LINUX_VERSION_CODE < KERNEL_VERSION (5, 3, 0)
-                   #error "copy_file_range is buggy"
-                  #endif
-                ]])],
-             [gl_cv_copy_file_range_known_to_work=yes],
-             [gl_cv_copy_file_range_known_to_work=no])])
-        if test "$gl_cv_copy_file_range_known_to_work" = no; then
-          REPLACE_COPY_FILE_RANGE=1
-        fi;;
+        # See copy-file-range.c comment re pre-5.3 Linux kernel bugs.
+        # We should be able to remove this hack in 2025.
+        REPLACE_COPY_FILE_RANGE=1;;
     esac
   fi
 ])
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index a2b53d33dca..2426eb63985 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1053,7 +1053,6 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS],
     dnl -Wno-float-conversion                 >= 4.9          >= 3.9
     dnl -Wno-float-equal                      >= 3            >= 3.9
     dnl -Wimplicit-fallthrough                >= 7            >= 3.9
-    dnl -Wno-missing-field-initializers       >= 4.0, < 11
     dnl -Wno-pedantic                         >= 4.8          >= 3.9
     dnl -Wno-sign-compare                     >= 3            >= 3.9
     dnl -Wno-sign-conversion                  >= 4.3          >= 3.9
@@ -1079,9 +1078,6 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS],
       #if __GNUC__ >= 7 || (__clang_major__ + (__clang_minor__ >= 9) > 3)
       -Wimplicit-fallthrough
       #endif
-      #if __GNUC__ >= 4 && __GNUC__ < 11 && !defined __clang__
-      -Wno-missing-field-initializers
-      #endif
       #if __GNUC__ + (__GNUC_MINOR__ >= 8) > 4 || (__clang_major__ + 
(__clang_minor__ >= 9) > 3)
       -Wno-pedantic
       #endif
diff --git a/m4/limits-h.m4 b/m4/limits-h.m4
index ca0294e5500..6a5983ebc25 100644
--- a/m4/limits-h.m4
+++ b/m4/limits-h.m4
@@ -28,11 +28,22 @@ AC_DEFUN_ONCE([gl_LIMITS_H],
           ]])],
        [gl_cv_header_limits_width=yes],
        [gl_cv_header_limits_width=no])])
-  if test "$gl_cv_header_limits_width" = yes; then
-    GL_GENERATE_LIMITS_H=false
-  else
-    GL_GENERATE_LIMITS_H=true
-  fi
+  GL_GENERATE_LIMITS_H=true
+  AS_IF([test "$gl_cv_header_limits_width" = yes],
+    [AC_CACHE_CHECK([whether limits.h has SSIZE_MAX],
+       [gl_cv_header_limits_ssize_max],
+       [AC_COMPILE_IFELSE(
+          [AC_LANG_SOURCE(
+             [[#include <limits.h>
+               #ifndef SSIZE_MAX
+                 #error "SSIZE_MAX is not defined"
+               #endif
+             ]])],
+          [gl_cv_header_limits_ssize_max=yes],
+          [gl_cv_header_limits_ssize_max=no])])
+     if test "$gl_cv_header_limits_ssize_max" = yes; then
+       GL_GENERATE_LIMITS_H=false
+     fi])
 ])
 
 dnl Unconditionally enables the replacement of <limits.h>.
diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4
index 13db996516d..a06f26f672e 100644
--- a/m4/manywarnings.m4
+++ b/m4/manywarnings.m4
@@ -1,4 +1,4 @@
-# manywarnings.m4 serial 23
+# manywarnings.m4 serial 24
 dnl Copyright (C) 2008-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -6,6 +6,8 @@ dnl with or without modifications, as long as this notice is 
preserved.
 
 dnl From Simon Josefsson
 
+AC_PREREQ([2.64])
+
 # gl_MANYWARN_COMPLEMENT(OUTVAR, LISTVAR, REMOVEVAR)
 # --------------------------------------------------
 # Copy LISTVAR to OUTVAR except for the entries in REMOVEVAR.
@@ -21,7 +23,7 @@ AC_DEFUN([gl_MANYWARN_COMPLEMENT],
       *" $gl_warn_item "*)
         ;;
       *)
-        gl_AS_VAR_APPEND([gl_warn_set], [" $gl_warn_item"])
+        AS_VAR_APPEND([gl_warn_set], [" $gl_warn_item"])
         ;;
     esac
   done
@@ -47,40 +49,29 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC(C)],
   dnl gcc warning categories.
   AC_REQUIRE([AC_PROG_CC])
   AS_IF([test -n "$GCC"], [
-    dnl Check if -Wextra -Werror -Wno-missing-field-initializers is supported
-    dnl with the current $CC $CFLAGS $CPPFLAGS.
-    AC_CACHE_CHECK([whether -Wno-missing-field-initializers is supported],
-      [gl_cv_cc_nomfi_supported],
-      [gl_save_CFLAGS="$CFLAGS"
-       CFLAGS="$CFLAGS -Wextra -Werror -Wno-missing-field-initializers"
+    AC_CACHE_CHECK([whether -Wno-missing-field-initializers is needed],
+      [gl_cv_cc_nomfi_needed],
+      [gl_cv_cc_nomfi_needed=no
+       gl_save_CFLAGS="$CFLAGS"
+       CFLAGS="$CFLAGS -Wextra -Werror"
        AC_COMPILE_IFELSE(
-         [AC_LANG_PROGRAM([[]], [[]])],
-         [gl_cv_cc_nomfi_supported=yes],
-         [gl_cv_cc_nomfi_supported=no])
+         [AC_LANG_PROGRAM(
+            [[struct file_data { int desc, name; };
+              struct cmp { struct file_data file[1]; };
+              void f (struct cmp *r)
+              {
+                typedef struct { int a; int b; } s_t;
+                s_t s1 = { 0, };
+                struct cmp cmp = { .file[0].desc = r->file[0].desc + s1.a };
+                *r = cmp;
+              }
+            ]],
+            [[]])],
+         [],
+         [CFLAGS="$CFLAGS -Wno-missing-field-initializers"
+          AC_COMPILE_IFELSE([],
+            [gl_cv_cc_nomfi_needed=yes])])
        CFLAGS="$gl_save_CFLAGS"
-      ])
-
-    AS_IF([test "$gl_cv_cc_nomfi_supported" = yes], [
-      dnl Now check whether -Wno-missing-field-initializers is needed
-      dnl for the { 0, } construct.
-      AC_CACHE_CHECK([whether -Wno-missing-field-initializers is needed],
-        [gl_cv_cc_nomfi_needed],
-        [gl_save_CFLAGS="$CFLAGS"
-         CFLAGS="$CFLAGS -Wextra -Werror"
-         AC_COMPILE_IFELSE(
-           [AC_LANG_PROGRAM(
-              [[int f (void)
-                {
-                  typedef struct { int a; int b; } s_t;
-                  s_t s1 = { 0, };
-                  return s1.b;
-                }
-              ]],
-              [[]])],
-           [gl_cv_cc_nomfi_needed=no],
-           [gl_cv_cc_nomfi_needed=yes])
-         CFLAGS="$gl_save_CFLAGS"
-        ])
     ])
 
     dnl Next, check if -Werror -Wuninitialized is useful with the
@@ -159,51 +150,51 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC(C)],
     -Wwrite-strings \
     \
     ; do
-    gl_AS_VAR_APPEND([$1], [" $gl_manywarn_item"])
+    AS_VAR_APPEND([$1], [" $gl_manywarn_item"])
   done
 
   # gcc --help=warnings outputs an unusual form for these options; list
   # them here so that the above 'comm' command doesn't report a false match.
-  gl_AS_VAR_APPEND([$1], [' -Warray-bounds=2'])
-  gl_AS_VAR_APPEND([$1], [' -Wattribute-alias=2'])
-  gl_AS_VAR_APPEND([$1], [' -Wbidi-chars=any,ucn'])
-  gl_AS_VAR_APPEND([$1], [' -Wformat-overflow=2'])
-  gl_AS_VAR_APPEND([$1], [' -Wformat=2'])
-  gl_AS_VAR_APPEND([$1], [' -Wformat-truncation=2'])
-  gl_AS_VAR_APPEND([$1], [' -Wimplicit-fallthrough=5'])
-  gl_AS_VAR_APPEND([$1], [' -Wshift-overflow=2'])
-  gl_AS_VAR_APPEND([$1], [' -Wuse-after-free=3'])
-  gl_AS_VAR_APPEND([$1], [' -Wunused-const-variable=2'])
-  gl_AS_VAR_APPEND([$1], [' -Wvla-larger-than=4031'])
+  AS_VAR_APPEND([$1], [' -Warray-bounds=2'])
+  AS_VAR_APPEND([$1], [' -Wattribute-alias=2'])
+  AS_VAR_APPEND([$1], [' -Wbidi-chars=any,ucn'])
+  AS_VAR_APPEND([$1], [' -Wformat-overflow=2'])
+  AS_VAR_APPEND([$1], [' -Wformat=2'])
+  AS_VAR_APPEND([$1], [' -Wformat-truncation=2'])
+  AS_VAR_APPEND([$1], [' -Wimplicit-fallthrough=5'])
+  AS_VAR_APPEND([$1], [' -Wshift-overflow=2'])
+  AS_VAR_APPEND([$1], [' -Wuse-after-free=3'])
+  AS_VAR_APPEND([$1], [' -Wunused-const-variable=2'])
+  AS_VAR_APPEND([$1], [' -Wvla-larger-than=4031'])
 
   # These are needed for older GCC versions.
   if test -n "$GCC" && gl_gcc_version=`($CC --version) 2>/dev/null`; then
     case $gl_gcc_version in
       'gcc (GCC) '[[0-3]].* | \
       'gcc (GCC) '4.[[0-7]].*)
-        gl_AS_VAR_APPEND([$1], [' -fdiagnostics-show-option'])
-        gl_AS_VAR_APPEND([$1], [' -funit-at-a-time'])
+        AS_VAR_APPEND([$1], [' -fdiagnostics-show-option'])
+        AS_VAR_APPEND([$1], [' -funit-at-a-time'])
           ;;
     esac
     case $gl_gcc_version in
       'gcc (GCC) '[[0-9]].*)
-        gl_AS_VAR_APPEND([$1], [' -fno-common'])
+        AS_VAR_APPEND([$1], [' -fno-common'])
           ;;
     esac
   fi
 
   # Disable specific options as needed.
   if test "$gl_cv_cc_nomfi_needed" = yes; then
-    gl_AS_VAR_APPEND([$1], [' -Wno-missing-field-initializers'])
+    AS_VAR_APPEND([$1], [' -Wno-missing-field-initializers'])
   fi
 
   if test "$gl_cv_cc_uninitialized_supported" = no; then
-    gl_AS_VAR_APPEND([$1], [' -Wno-uninitialized'])
+    AS_VAR_APPEND([$1], [' -Wno-uninitialized'])
   fi
 
   # This warning have too many false alarms in GCC 11.2.1.
   # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101713
-  gl_AS_VAR_APPEND([$1], [' -Wno-analyzer-malloc-leak'])
+  AS_VAR_APPEND([$1], [' -Wno-analyzer-malloc-leak'])
 
   AC_LANG_POP([C])
 ])
diff --git a/m4/ssize_t.m4 b/m4/ssize_t.m4
index 1c12c33ea09..52bd77d2aeb 100644
--- a/m4/ssize_t.m4
+++ b/m4/ssize_t.m4
@@ -1,23 +1,37 @@
-# ssize_t.m4 serial 5 (gettext-0.18.2)
+# ssize_t.m4 serial 6
 dnl Copyright (C) 2001-2003, 2006, 2010-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
 dnl From Bruno Haible.
-dnl Test whether ssize_t is defined.
+dnl Define ssize_t if it does not already exist.
 
 AC_DEFUN([gt_TYPE_SSIZE_T],
 [
-  AC_CACHE_CHECK([for ssize_t], [gt_cv_ssize_t],
+  AC_CACHE_CHECK([for ssize_t], [gl_cv_ssize_t],
     [AC_COMPILE_IFELSE(
        [AC_LANG_PROGRAM(
           [[#include <sys/types.h>]],
           [[int x = sizeof (ssize_t *) + sizeof (ssize_t);
             return !x;]])],
-       [gt_cv_ssize_t=yes], [gt_cv_ssize_t=no])])
-  if test $gt_cv_ssize_t = no; then
-    AC_DEFINE([ssize_t], [int],
-              [Define as a signed type of the same size as size_t.])
+       [gl_cv_ssize_t=yes], [gl_cv_ssize_t=no])])
+  if test $gl_cv_ssize_t = no; then
+    dnl On 64-bit native Windows, ssize_t needs to be defined as 'long long',
+    dnl for consistency with the 64-bit size_t.
+    AC_CACHE_CHECK([whether size_t is wider than 'long'], [gl_cv_size_t_large],
+      [AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[#include <sys/types.h>
+              typedef int array [2 * (sizeof (size_t) > sizeof (long)) - 1];
+            ]])],
+         [gl_cv_size_t_large=yes], [gl_cv_size_t_large=no])])
+    if test $gl_cv_size_t_large = yes; then
+      gl_def_ssize_t='long long'
+    else
+      gl_def_ssize_t='long'
+    fi
+    AC_DEFINE_UNQUOTED([ssize_t], [$gl_def_ssize_t],
+                       [Define as a signed type of the same size as size_t.])
   fi
 ])
diff --git a/m4/strtoll.m4 b/m4/strtoll.m4
index ec09609cd42..a0cbc805bc9 100644
--- a/m4/strtoll.m4
+++ b/m4/strtoll.m4
@@ -1,4 +1,4 @@
-# strtoll.m4 serial 10
+# strtoll.m4 serial 11
 dnl Copyright (C) 2002, 2004, 2006, 2008-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -19,10 +19,16 @@ AC_DEFUN([gl_FUNC_STRTOLL],
               char *term;
               /* This test fails on Minix and native Windows.  */
               {
-                const char input[] = "0x";
-                (void) strtoll (input, &term, 16);
-                if (term != input + 1)
-                  result |= 1;
+                static char const input[2][3] = {"0x", "0b"};
+                static int const base[] = {0, 2, 10};
+                int i, j;
+                for (i = 0; i < 2; i++)
+                  for (j = 0; j < 3; j++)
+                    {
+                      (void) strtoll (input[i], &term, base[j]);
+                      if (term != input[i] + 1)
+                        result |= 1;
+                    }
               }
               /* This test fails on pre-C23 platforms.  */
               {
diff --git a/m4/warnings.m4 b/m4/warnings.m4
index 063bc5ca64a..1a3107f846d 100644
--- a/m4/warnings.m4
+++ b/m4/warnings.m4
@@ -1,4 +1,4 @@
-# warnings.m4 serial 16
+# warnings.m4 serial 18
 dnl Copyright (C) 2008-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -6,14 +6,7 @@ dnl with or without modifications, as long as this notice is 
preserved.
 
 dnl From Simon Josefsson
 
-# gl_AS_VAR_APPEND(VAR, VALUE)
-# ----------------------------
-# Provide the functionality of AS_VAR_APPEND if Autoconf does not have it.
-m4_ifdef([AS_VAR_APPEND],
-[m4_copy([AS_VAR_APPEND], [gl_AS_VAR_APPEND])],
-[m4_define([gl_AS_VAR_APPEND],
-[AS_VAR_SET([$1], [AS_VAR_GET([$1])$2])])])
-
+AC_PREREQ([2.64])
 
 # gl_COMPILER_OPTION_IF(OPTION, [IF-SUPPORTED], [IF-NOT-SUPPORTED],
 #                       [PROGRAM = AC_LANG_PROGRAM()])
@@ -34,7 +27,7 @@ esac
 m4_pushdef([gl_Positive], [$gl_positive])])dnl
 AC_CACHE_CHECK([whether _AC_LANG compiler handles $1], [gl_Warn], [
   gl_save_compiler_FLAGS="$gl_Flags"
-  gl_AS_VAR_APPEND(m4_defn([gl_Flags]),
+  AS_VAR_APPEND(m4_defn([gl_Flags]),
     [" $gl_unknown_warnings_are_errors ]m4_defn([gl_Positive])["])
   AC_LINK_IFELSE([m4_default([$4], [AC_LANG_PROGRAM([[]])])],
                  [AS_VAR_SET([gl_Warn], [yes])],
@@ -97,7 +90,7 @@ AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS_IMPL],
 AC_DEFUN([gl_WARN_ADD],
 [AC_REQUIRE([gl_UNKNOWN_WARNINGS_ARE_ERRORS(]_AC_LANG[)])
 gl_COMPILER_OPTION_IF([$1],
-  [gl_AS_VAR_APPEND(m4_if([$2], [], [[WARN_]_AC_LANG_PREFIX[FLAGS]], [[$2]]), 
[" $1"])],
+  [AS_VAR_APPEND(m4_if([$2], [], [[WARN_]_AC_LANG_PREFIX[FLAGS]], [[$2]]), [" 
$1"])],
   [],
   [$3])
 m4_ifval([$2],
@@ -105,6 +98,67 @@ m4_ifval([$2],
          [AC_SUBST([WARN_]_AC_LANG_PREFIX[FLAGS])])dnl
 ])
 
+
+# gl_CC_INHIBIT_WARNINGS
+# sets and substitutes a variable GL_CFLAG_INHIBIT_WARNINGS, to a $(CC) option
+# that reverts all preceding -W* options, if available.
+# This is expected to be '-w' at least on gcc, clang, AIX xlc, xlclang, Sun cc,
+# "compile cl" (MSVC), "compile clang-cl" (MSVC-compatible clang). Or it can be
+# empty.
+AC_DEFUN([gl_CC_INHIBIT_WARNINGS],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_CACHE_CHECK([for C compiler option to inhibit all warnings],
+    [gl_cv_cc_winhibit],
+    [rm -f conftest*
+     echo 'int dummy;' > conftest.c
+     AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 
2>conftest1.err]) >/dev/null
+     AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -w -c conftest.c 
2>conftest2.err]) >/dev/null
+     if test $? = 0 && test `wc -l < conftest1.err` = `wc -l < conftest2.err`; 
then
+       gl_cv_cc_winhibit='-w'
+     else
+       gl_cv_cc_winhibit=none
+     fi
+     rm -f conftest*
+    ])
+  case "$gl_cv_cc_winhibit" in
+    none) GL_CFLAG_INHIBIT_WARNINGS='' ;;
+    *)    GL_CFLAG_INHIBIT_WARNINGS="$gl_cv_cc_winhibit" ;;
+  esac
+  AC_SUBST([GL_CFLAG_INHIBIT_WARNINGS])
+])
+
+# gl_CXX_INHIBIT_WARNINGS
+# sets and substitutes a variable GL_CXXFLAG_INHIBIT_WARNINGS, to a $(CC) 
option
+# that reverts all preceding -W* options, if available.
+AC_DEFUN([gl_CXX_INHIBIT_WARNINGS],
+[
+  dnl Requires AC_PROG_CXX or gl_PROG_ANSI_CXX.
+  if test -n "$CXX" && test "$CXX" != no; then
+    AC_CACHE_CHECK([for C++ compiler option to inhibit all warnings],
+      [gl_cv_cxx_winhibit],
+      [rm -f conftest*
+       echo 'int dummy;' > conftest.cc
+       AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 
2>conftest1.err]) >/dev/null
+       AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -w -c conftest.cc 
2>conftest2.err]) >/dev/null
+       if test $? = 0 && test `wc -l < conftest1.err` = `wc -l < 
conftest2.err`; then
+         gl_cv_cxx_winhibit='-w'
+       else
+         gl_cv_cxx_winhibit=none
+       fi
+       rm -f conftest*
+      ])
+    case "$gl_cv_cxx_winhibit" in
+      none) GL_CXXFLAG_INHIBIT_WARNINGS='' ;;
+      *)    GL_CXXFLAG_INHIBIT_WARNINGS="$gl_cv_cxx_winhibit" ;;
+    esac
+  else
+    GL_CXXFLAG_INHIBIT_WARNINGS=''
+  fi
+  AC_SUBST([GL_CXXFLAG_INHIBIT_WARNINGS])
+])
+
+
 # Local Variables:
 # mode: autoconf
 # End:



reply via email to

[Prev in Thread] Current Thread [Next in Thread]