aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPo Lu2023-06-08 08:46:19 +0800
committerPo Lu2023-06-08 08:46:19 +0800
commit59fdd16f900ad16e726b46b266e85df0c22748c8 (patch)
tree2502bba3f4a1a9ec8a1ba9b8a6218d61c37b4089 /lib
parent49dceb9dd6b3c2567a4a405e4a480aa79ebdc005 (diff)
parenta902156068ab071f93cc9bbd34cd320919b74064 (diff)
downloademacs-59fdd16f900ad16e726b46b266e85df0c22748c8.tar.gz
emacs-59fdd16f900ad16e726b46b266e85df0c22748c8.zip
Merge remote-tracking branch 'origin/master' into feature/android
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 @@
35# define SIZE_MAX ((size_t) -1) 35# define SIZE_MAX ((size_t) -1)
36#endif 36#endif
37 37
38#ifndef SSIZE_MAX
39# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
40#endif
41
42#include "allocator.h" 38#include "allocator.h"
43 39
44enum { STACK_BUF_SIZE = 1024 }; 40enum { STACK_BUF_SIZE = 1024 };
@@ -55,7 +51,9 @@ enum { STACK_BUF_SIZE = 1024 };
55 When the GCC bug is fixed this workaround should be limited to the 51 When the GCC bug is fixed this workaround should be limited to the
56 broken GCC versions. */ 52 broken GCC versions. */
57#if _GL_GNUC_PREREQ (10, 1) 53#if _GL_GNUC_PREREQ (10, 1)
58# if defined GCC_LINT || defined lint 54# if _GL_GNUC_PREREQ (12, 1)
55# pragma GCC diagnostic ignored "-Wreturn-local-addr"
56# elif defined GCC_LINT || defined lint
59__attribute__ ((__noinline__)) 57__attribute__ ((__noinline__))
60# elif __OPTIMIZE__ && !__NO_INLINE__ 58# elif __OPTIMIZE__ && !__NO_INLINE__
61# define GCC_BOGUS_WRETURN_LOCAL_ADDR 59# 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 @@
48 OFFSET A signed integer type sufficient to hold the 48 OFFSET A signed integer type sufficient to hold the
49 difference between two indices. Usually 49 difference between two indices. Usually
50 something like ptrdiff_t. 50 something like ptrdiff_t.
51 OFFSET_MAX (Optional) The maximum value of OFFSET (e.g.,
52 PTRDIFF_MAX). If omitted, it is inferred in a
53 way portable to the vast majority of C platforms,
54 as they lack padding bits.
51 EXTRA_CONTEXT_FIELDS Declarations of fields for 'struct context'. 55 EXTRA_CONTEXT_FIELDS Declarations of fields for 'struct context'.
52 NOTE_DELETE(ctxt, xoff) Record the removal of the object xvec[xoff]. 56 NOTE_DELETE(ctxt, xoff) Record the removal of the object xvec[xoff].
53 NOTE_INSERT(ctxt, yoff) Record the insertion of the object yvec[yoff]. 57 NOTE_INSERT(ctxt, yoff) Record the insertion of the object yvec[yoff].
@@ -74,8 +78,10 @@
74 */ 78 */
75 79
76/* Maximum value of type OFFSET. */ 80/* Maximum value of type OFFSET. */
77#define OFFSET_MAX \ 81#ifndef OFFSET_MAX
78 ((((OFFSET)1 << (sizeof (OFFSET) * CHAR_BIT - 2)) - 1) * 2 + 1) 82# define OFFSET_MAX \
83 ((((OFFSET) 1 << (sizeof (OFFSET) * CHAR_BIT - 2)) - 1) * 2 + 1)
84#endif
79 85
80/* Default to no early abort. */ 86/* Default to no early abort. */
81#ifndef EARLY_ABORT 87#ifndef EARLY_ABORT
@@ -88,11 +94,17 @@
88 94
89/* Use this to suppress gcc's "...may be used before initialized" warnings. 95/* Use this to suppress gcc's "...may be used before initialized" warnings.
90 Beware: The Code argument must not contain commas. */ 96 Beware: The Code argument must not contain commas. */
97#if __GNUC__ + (__GNUC_MINOR__ >= 7) > 4
98# pragma GCC diagnostic push
99#endif
91#ifndef IF_LINT 100#ifndef IF_LINT
92# if defined GCC_LINT || defined lint 101# if defined GCC_LINT || defined lint
93# define IF_LINT(Code) Code 102# define IF_LINT(Code) Code
94# else 103# else
95# define IF_LINT(Code) /* empty */ 104# define IF_LINT(Code) /* empty */
105# if __GNUC__ + (__GNUC_MINOR__ >= 7) > 4
106# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
107# endif
96# endif 108# endif
97#endif 109#endif
98 110
@@ -556,6 +568,10 @@ compareseq (OFFSET xoff, OFFSET xlim, OFFSET yoff, OFFSET ylim,
556 #undef XREF_YREF_EQUAL 568 #undef XREF_YREF_EQUAL
557} 569}
558 570
571#if __GNUC__ + (__GNUC_MINOR__ >= 7) > 4
572# pragma GCC diagnostic pop
573#endif
574
559#undef ELEMENT 575#undef ELEMENT
560#undef EQUAL 576#undef EQUAL
561#undef OFFSET 577#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 @@
28#include "acl.h" 28#include "acl.h"
29 29
30#include "acl-internal.h" 30#include "acl-internal.h"
31 31#include "attribute.h"
32#include "minmax.h" 32#include "minmax.h"
33 33
34#if USE_ACL && HAVE_LINUX_XATTR_H && HAVE_LISTXATTR 34#if USE_ACL && HAVE_LINUX_XATTR_H && HAVE_LISTXATTR
@@ -40,6 +40,12 @@
40# ifndef XATTR_NAME_NFSV4_ACL 40# ifndef XATTR_NAME_NFSV4_ACL
41# define XATTR_NAME_NFSV4_ACL "system.nfs4_acl" 41# define XATTR_NAME_NFSV4_ACL "system.nfs4_acl"
42# endif 42# endif
43# ifndef XATTR_NAME_POSIX_ACL_ACCESS
44# define XATTR_NAME_POSIX_ACL_ACCESS "system.posix_acl_access"
45# endif
46# ifndef XATTR_NAME_POSIX_ACL_DEFAULT
47# define XATTR_NAME_POSIX_ACL_DEFAULT "system.posix_acl_default"
48# endif
43 49
44enum { 50enum {
45 /* ACE4_ACCESS_ALLOWED_ACE_TYPE = 0x00000000, */ 51 /* ACE4_ACCESS_ALLOWED_ACE_TYPE = 0x00000000, */
@@ -50,7 +56,7 @@ enum {
50/* Return true if ATTR is in the set represented by the NUL-terminated 56/* Return true if ATTR is in the set represented by the NUL-terminated
51 strings in LISTBUF, which is of size LISTSIZE. */ 57 strings in LISTBUF, which is of size LISTSIZE. */
52 58
53static bool 59ATTRIBUTE_PURE static bool
54have_xattr (char const *attr, char const *listbuf, ssize_t listsize) 60have_xattr (char const *attr, char const *listbuf, ssize_t listsize)
55{ 61{
56 char const *blim = listbuf + listsize; 62 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 @@
43 followed by N bytes of other data. The result is suitable as an 43 followed by N bytes of other data. The result is suitable as an
44 argument to malloc. For example: 44 argument to malloc. For example:
45 45
46 struct s { int n; char d[FLEXIBLE_ARRAY_MEMBER]; }; 46 struct s { int a; char d[FLEXIBLE_ARRAY_MEMBER]; };
47 struct s *p = malloc (FLEXSIZEOF (struct s, d, n * sizeof (char))); 47 struct s *p = malloc (FLEXSIZEOF (struct s, d, n * sizeof (char)));
48 48
49 FLEXSIZEOF (TYPE, MEMBER, N) is not simply (sizeof (TYPE) + N), 49 FLEXSIZEOF (TYPE, MEMBER, N) is not simply (sizeof (TYPE) + N),
@@ -63,3 +63,14 @@
63#define FLEXSIZEOF(type, member, n) \ 63#define FLEXSIZEOF(type, member, n) \
64 ((offsetof (type, member) + FLEXALIGNOF (type) - 1 + (n)) \ 64 ((offsetof (type, member) + FLEXALIGNOF (type) - 1 + (n)) \
65 & ~ (FLEXALIGNOF (type) - 1)) 65 & ~ (FLEXALIGNOF (type) - 1))
66
67/* Yield a properly aligned upper bound on the size of a struct of
68 type TYPE with a flexible array member named MEMBER that has N
69 elements. The result is suitable as an argument to malloc.
70 For example:
71
72 struct s { int a; double d[FLEXIBLE_ARRAY_MEMBER]; };
73 struct s *p = malloc (FLEXNSIZEOF (struct s, d, n));
74 */
75#define FLEXNSIZEOF(type, member, n) \
76 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 @@
134# endif 134# endif
135#endif 135#endif
136 136
137/* Macro specified by POSIX. */
138
139/* The maximal size_t value. Although it might not be of ssize_t type
140 as it should be, it's too much trouble to fix this minor detail. */
141#ifndef SSIZE_MAX
142# ifdef _WIN64
143# define SSIZE_MAX LLONG_MAX
144# else
145# define SSIZE_MAX LONG_MAX
146# endif
147#endif
148
137#endif /* _@GUARD_PREFIX@_LIMITS_H */ 149#endif /* _@GUARD_PREFIX@_LIMITS_H */
138#endif /* _@GUARD_PREFIX@_LIMITS_H */ 150#endif /* _@GUARD_PREFIX@_LIMITS_H */
139#endif 151#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[];
276 more reliable way to accept other sets of digits. */ 276 more reliable way to accept other sets of digits. */
277#define ISDIGIT(Ch) ((unsigned int) (Ch) - L_('0') <= 9) 277#define ISDIGIT(Ch) ((unsigned int) (Ch) - L_('0') <= 9)
278 278
279/* Avoid false GCC warning "'memset' specified size 18446744073709551615 exceeds
280 maximum object size 9223372036854775807", caused by insufficient data flow
281 analysis and value propagation of the 'width_add' expansion when GCC is not
282 optimizing. Cf. <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88443>. */
283#if __GNUC__ >= 7 && !__OPTIMIZE__
284# pragma GCC diagnostic ignored "-Wstringop-overflow"
285#endif
286
279#if FPRINTFTIME 287#if FPRINTFTIME
280static void 288static void
281fwrite_lowcase (FILE *fp, const CHAR_T *src, size_t len) 289fwrite_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)
1384 if (len < w) 1392 if (len < w)
1385 { 1393 {
1386 size_t delta = w - len; 1394 size_t delta = w - len;
1387 wmemmove (p + delta, p, len); 1395 __wmemmove (p + delta, p, len);
1388 wchar_t wc = pad == L_('0') || pad == L_('+') ? L'0' : L' '; 1396 wchar_t wc = pad == L_('0') || pad == L_('+') ? L'0' : L' ';
1389 wmemset (p, wc, delta); 1397 wmemset (p, wc, delta);
1390 } 1398 }
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 @@
151 as some non-GCC platforms lack them, an issue when this code is 151 as some non-GCC platforms lack them, an issue when this code is
152 used in Gnulib. */ 152 used in Gnulib. */
153 153
154#ifndef SSIZE_MAX
155# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
156#endif
157#ifndef ULONG_WIDTH 154#ifndef ULONG_WIDTH
158# define ULONG_WIDTH REGEX_UINTEGER_WIDTH (ULONG_MAX) 155# define ULONG_WIDTH REGEX_UINTEGER_WIDTH (ULONG_MAX)
159/* The number of usable bits in an unsigned integer type with maximum 156/* The number of usable bits in an unsigned integer type with maximum