summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2023-06-07 12:00:15 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2023-06-07 12:04:00 -0700
commita902156068ab071f93cc9bbd34cd320919b74064 (patch)
treea5330a33e9f3f363e3021e3ecf91cb98806f7584 /lib
parentf68d962ede0cc3d7758d3304e7411a10694acce8 (diff)
downloademacs-a902156068ab071f93cc9bbd34cd320919b74064.tar.gz
Update from Gnulib by running admin/merge-gnulib
Diffstat (limited to 'lib')
-rw-r--r--lib/careadlinkat.c8
-rw-r--r--lib/diffseq.h20
-rw-r--r--lib/file-has-acl.c10
-rw-r--r--lib/flexmember.h13
-rw-r--r--lib/limits.in.h12
-rw-r--r--lib/nstrftime.c10
-rw-r--r--lib/regex_internal.h3
7 files changed, 62 insertions, 14 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