aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert2025-12-25 09:52:44 -0800
committerPaul Eggert2025-12-25 09:53:17 -0800
commit7be4fe89fc6f0fdd8f79dd8e506efc8db0cd8b5b (patch)
treeaa68f28e8a72a383972e1d13da421a59584e81ad /lib
parent0a6daa141220a99bae591ae5935a43b7710254bd (diff)
downloademacs-7be4fe89fc6f0fdd8f79dd8e506efc8db0cd8b5b.tar.gz
emacs-7be4fe89fc6f0fdd8f79dd8e506efc8db0cd8b5b.zip
Update from Gnulib by running admin/merge-gnulib
Diffstat (limited to 'lib')
-rw-r--r--lib/attribute.h104
-rw-r--r--lib/file-has-acl.c11
-rw-r--r--lib/timespec.h8
3 files changed, 71 insertions, 52 deletions
diff --git a/lib/attribute.h b/lib/attribute.h
index f24f5b18f1e..e71c9f50aea 100644
--- a/lib/attribute.h
+++ b/lib/attribute.h
@@ -89,7 +89,7 @@
89 _GL_ATTRIBUTE_NONNULL_IF_NONZERO, _GL_ATTRIBUTE_NONSTRING, 89 _GL_ATTRIBUTE_NONNULL_IF_NONZERO, _GL_ATTRIBUTE_NONSTRING,
90 _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PACKED, _GL_ATTRIBUTE_PURE, 90 _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PACKED, _GL_ATTRIBUTE_PURE,
91 _GL_ATTRIBUTE_REPRODUCIBLE, _GL_ATTRIBUTE_RETURNS_NONNULL, 91 _GL_ATTRIBUTE_REPRODUCIBLE, _GL_ATTRIBUTE_RETURNS_NONNULL,
92 _GL_ATTRIBUTE_SENTINEL, _GL_ATTRIBUTE_UNSEQUENCED. */ 92 _GL_ATTRIBUTE_SENTINEL, _GL_ATTRIBUTE_UNSEQUENCED, _GL_UNNAMED. */
93#if !_GL_CONFIG_H_INCLUDED 93#if !_GL_CONFIG_H_INCLUDED
94 #error "Please include config.h first." 94 #error "Please include config.h first."
95#endif 95#endif
@@ -240,62 +240,68 @@
240/* Applies to: functions. */ 240/* Applies to: functions. */
241#define ATTRIBUTE_ALWAYS_INLINE _GL_ATTRIBUTE_ALWAYS_INLINE 241#define ATTRIBUTE_ALWAYS_INLINE _GL_ATTRIBUTE_ALWAYS_INLINE
242 242
243/* It is OK for a compiler to move calls to the function and to omit 243/* It is OK for a compiler to move a call, or omit a duplicate call
244 calls to the function if another call has the same arguments or the 244 and reuse a cached return value, even if the state changes between calls.
245 result is not used. 245 It is also OK to omit a call if the result is not used.
246 This attribute is safe for a function that neither depends on 246 This attribute is safe if the function does not change observable state,
247 nor affects state, and always returns exactly once - 247 returns a value determined solely by its arguments' values
248 without examining state, and always returns exactly once -
248 e.g., does not raise an exception, call longjmp, or loop forever. 249 e.g., does not raise an exception, call longjmp, or loop forever.
249 (This attribute is stricter than ATTRIBUTE_PURE because the 250 (This attribute is stricter than _GL_ATTRIBUTE_PURE because the
250 function cannot observe state. It is stricter than UNSEQUENCED 251 function cannot observe state. Unlike _GL_ATTRIBUTE_UNSEQUENCED
251 because the function must return exactly once and cannot depend on 252 the function must return exactly once and cannot access state
252 state addressed by its arguments.) */ 253 addressed by its pointer arguments or that happens to have the same
254 value for all calls to the function, but the function is allowed to
255 return a pointer to storage that can be modified later. */
253/* Applies to: functions. */ 256/* Applies to: functions. */
254#define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST 257#define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST
255 258
256/* It is OK for a compiler to move calls to the function and to omit duplicate 259/* It is OK for a compiler to move a call, or omit a duplicate call
257 calls to the function with the same arguments, so long as the state 260 and reuse a cached value returned either directly or indirectly via
258 addressed by its arguments is the same. 261 a pointer, if the state addressed by its pointer arguments is the same;
262 however, pointer arguments cannot alias.
259 This attribute is safe for a function that is effectless, idempotent, 263 This attribute is safe for a function that is effectless, idempotent,
260 stateless, and independent; see ISO C 23 § 6.7.13.8 for a definition of 264 stateless, and independent; see ISO C 23 § 6.7.13.8 for a definition of
261 these terms. 265 these terms.
262 (This attribute is stricter than REPRODUCIBLE because the function 266 (This attribute is stricter than _GL_ATTRIBUTE_REPRODUCIBLE because
263 must be stateless and independent. It is looser than ATTRIBUTE_CONST 267 the function must be stateless and independent. Unlike
264 because the function need not return exactly once and can depend 268 _GL_ATTRIBUTE_CONST the function need not return exactly once, and
265 on state addressed by its arguments.) 269 can depend on state accessed via its pointer arguments or that
270 happens to have the same value for all calls to the function, but
271 the function cannot return a pointer to storage whose contents
272 change later.)
266 See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and 273 See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and
267 <https://stackoverflow.com/questions/76847905/>. 274 <https://stackoverflow.com/questions/76847905/>. */
268 ATTENTION! Efforts are underway to change the meaning of this attribute.
269 See <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3494.htm>. */
270/* Applies to: functions, pointer to functions, function type. */ 275/* Applies to: functions, pointer to functions, function type. */
271#define UNSEQUENCED _GL_ATTRIBUTE_UNSEQUENCED 276#define UNSEQUENCED _GL_ATTRIBUTE_UNSEQUENCED
272 277
273/* It is OK for a compiler to move calls to the function and to omit 278/* It is OK for a compiler to move a call, or omit a duplicate call
274 calls to the function if another call has the same arguments or the 279 and reuse a cached return value, if observable state is the same.
275 result is not used, and if observable state is the same. 280 It is also OK to omit a call if the return value is not used.
276 This attribute is safe for a function that does not affect observable state 281 This attribute is safe if the function does not change observable state,
277 and always returns exactly once. 282 returns a value determined solely by its arguments's values
278 (This attribute is looser than ATTRIBUTE_CONST because the function 283 together with observable state, and always returns exactly once.
279 can depend on observable state. It is stricter than REPRODUCIBLE 284 (This attribute is looser than _GL_ATTRIBUTE_CONST because the function
280 because the function must return exactly once and cannot affect 285 can depend on observable state.
281 state addressed by its arguments.) */ 286 Unlike _GL_ATTRIBUTE_REPRODUCIBLE the function must return exactly
287 once and cannot change state addressed by its arguments, but the
288 function can return a pointer to storage whose contents change later.) */
282/* Applies to: functions. */ 289/* Applies to: functions. */
283#define ATTRIBUTE_PURE _GL_ATTRIBUTE_PURE 290#define ATTRIBUTE_PURE _GL_ATTRIBUTE_PURE
284 291
285/* It is OK for a compiler to move calls to the function and to omit duplicate 292/* It is OK for a compiler to move a call, or omit a duplicate call
286 calls to the function with the same arguments, so long as the state 293 and reuse a cached value returned either directly or indirectly via
287 addressed by its arguments is the same and is updated in time for 294 a pointer, if other observable state is the same;
288 the rest of the program. 295 however, pointer arguments cannot alias.
289 This attribute is safe for a function that is effectless and idempotent; see 296 This attribute is safe for a function that is effectless and idempotent;
290 ISO C 23 § 6.7.13.8 for a definition of these terms. 297 see ISO C 23 § 6.7.13.8 for a definition of these terms.
291 (This attribute is looser than UNSEQUENCED because the function need 298 (This attribute is looser than _GL_ATTRIBUTE_UNSEQUENCED because
292 not be stateless and idempotent. It is looser than ATTRIBUTE_PURE 299 the function need not be stateless or independent.
293 because the function need not return exactly once and can affect 300 Unlike _GL_ATTRIBUTE_PURE the function need not return exactly once
294 state addressed by its arguments.) 301 and can change state addressed by its pointer arguments, but the
302 function cannot return a pointer to storage whose contents change later.)
295 See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and 303 See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and
296 <https://stackoverflow.com/questions/76847905/>. 304 <https://stackoverflow.com/questions/76847905/>. */
297 ATTENTION! Efforts are underway to change the meaning of this attribute.
298 See <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3494.htm>. */
299/* Applies to: functions, pointer to functions, function type. */ 305/* Applies to: functions, pointer to functions, function type. */
300#define REPRODUCIBLE _GL_ATTRIBUTE_REPRODUCIBLE 306#define REPRODUCIBLE _GL_ATTRIBUTE_REPRODUCIBLE
301 307
@@ -328,4 +334,18 @@
328#define ATTRIBUTE_MAY_ALIAS _GL_ATTRIBUTE_MAY_ALIAS 334#define ATTRIBUTE_MAY_ALIAS _GL_ATTRIBUTE_MAY_ALIAS
329 335
330 336
337/* ==================== Unnamed function parameters ======================== */
338
339/* Although UNNAMED is not an attribute, it is related to MAYBE_UNUSED
340 and so is defined here for convenience. */
341
342/* UNNAMED (ID) is the "name" of an unnamed function parameter.
343 Each of the function's unnamed parameters should have a unique "name".
344 The "name" cannot be used. This ports both to C17 and earlier, which
345 lack unnamed parameters, and to C++ and later C, which have them. */
346/* Applies to:
347 - function parameters. */
348#define UNNAMED(id) _GL_UNNAMED (id)
349
350
331#endif /* _GL_ATTRIBUTE_H */ 351#endif /* _GL_ATTRIBUTE_H */
diff --git a/lib/file-has-acl.c b/lib/file-has-acl.c
index d5a52b5b2f8..8d20504f8b9 100644
--- a/lib/file-has-acl.c
+++ b/lib/file-has-acl.c
@@ -79,16 +79,15 @@ smack_smackfs_path (void)
79 return NULL; 79 return NULL;
80} 80}
81static ssize_t 81static ssize_t
82smack_new_label_from_path (MAYBE_UNUSED const char *path, 82smack_new_label_from_path (const char *UNNAMED (path),
83 MAYBE_UNUSED const char *xattr, 83 const char *UNNAMED (xattr),
84 MAYBE_UNUSED int follow, MAYBE_UNUSED char **label) 84 int UNNAMED (follow), char **UNNAMED (label))
85{ 85{
86 return -1; 86 return -1;
87} 87}
88static ssize_t 88static ssize_t
89smack_new_label_from_file (MAYBE_UNUSED int fd, 89smack_new_label_from_file (int UNNAMED (fd), const char *UNNAMED (xattr),
90 MAYBE_UNUSED const char *xattr, 90 char **UNNAMED (label))
91 MAYBE_UNUSED char **label)
92{ 91{
93 return -1; 92 return -1;
94} 93}
diff --git a/lib/timespec.h b/lib/timespec.h
index 138467eca6a..ecddaef8633 100644
--- a/lib/timespec.h
+++ b/lib/timespec.h
@@ -20,7 +20,7 @@
20#define TIMESPEC_H 20#define TIMESPEC_H
21 21
22/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, _GL_ATTRIBUTE_CONST, 22/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, _GL_ATTRIBUTE_CONST,
23 _GL_ATTRIBUTE_PURE, _GL_CMP. */ 23 _GL_CMP. */
24#if !_GL_CONFIG_H_INCLUDED 24#if !_GL_CONFIG_H_INCLUDED
25 #error "Please include config.h first." 25 #error "Please include config.h first."
26#endif 26#endif
@@ -60,7 +60,7 @@ make_timespec (time_t s, long int ns)
60 60
61/* Return negative, zero, positive if A < B, A == B, A > B, respectively. */ 61/* Return negative, zero, positive if A < B, A == B, A > B, respectively. */
62 62
63_GL_TIMESPEC_INLINE int _GL_ATTRIBUTE_PURE 63_GL_TIMESPEC_INLINE int _GL_ATTRIBUTE_CONST
64timespec_cmp (struct timespec a, struct timespec b) 64timespec_cmp (struct timespec a, struct timespec b)
65{ 65{
66 return 2 * _GL_CMP (a.tv_sec, b.tv_sec) + _GL_CMP (a.tv_nsec, b.tv_nsec); 66 return 2 * _GL_CMP (a.tv_sec, b.tv_sec) + _GL_CMP (a.tv_nsec, b.tv_nsec);
@@ -68,10 +68,10 @@ timespec_cmp (struct timespec a, struct timespec b)
68 68
69/* Return -1, 0, 1, depending on the sign of A. A.tv_nsec must be 69/* Return -1, 0, 1, depending on the sign of A. A.tv_nsec must be
70 nonnegative. */ 70 nonnegative. */
71_GL_TIMESPEC_INLINE int _GL_ATTRIBUTE_PURE 71_GL_TIMESPEC_INLINE int _GL_ATTRIBUTE_CONST
72timespec_sign (struct timespec a) 72timespec_sign (struct timespec a)
73{ 73{
74 return _GL_CMP (a.tv_sec, 0) + (!a.tv_sec & !!a.tv_nsec); 74 return _GL_CMP (a.tv_sec | a.tv_nsec, 0);
75} 75}
76 76
77struct timespec timespec_add (struct timespec, struct timespec) 77struct timespec timespec_add (struct timespec, struct timespec)