summaryrefslogtreecommitdiff
path: root/gnulib-m4/gnulib-common.m4
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2026-03-08 17:28:50 +0100
committerJörg Frings-Fürst <debian@jff.email>2026-03-08 17:28:50 +0100
commitff33e1d252f46bec1a33e28700da3282fc24047a (patch)
tree5c15bc695be820b393a8496c5807ecafbbdeb89b /gnulib-m4/gnulib-common.m4
parentb2ac982cc8b5290699eb5f52fb043d3d15e2624b (diff)
parent5f59a34ab747dde8ede7357f3431bf06bd6002fe (diff)
Update upstream source from tag 'upstream/1.4.2'
Update to upstream version '1.4.2' with Debian dir 493e96bcd865e4f9990e20bee26408c96231d727
Diffstat (limited to 'gnulib-m4/gnulib-common.m4')
-rw-r--r--gnulib-m4/gnulib-common.m4113
1 files changed, 68 insertions, 45 deletions
diff --git a/gnulib-m4/gnulib-common.m4 b/gnulib-m4/gnulib-common.m4
index 134bfba2..26eef771 100644
--- a/gnulib-m4/gnulib-common.m4
+++ b/gnulib-m4/gnulib-common.m4
@@ -1,6 +1,6 @@
# gnulib-common.m4
-# serial 113
-dnl Copyright (C) 2007-2025 Free Software Foundation, Inc.
+# serial 115
+dnl Copyright (C) 2007-2026 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.
@@ -414,22 +414,25 @@ AC_DEFUN([gl_COMMON_BODY], [
#endif
/* _GL_ATTRIBUTE_CONST declares:
- It is OK for a compiler to move calls to the function and to omit
- calls to the function if another call has the same arguments or the
- result is not used.
- This attribute is safe for a function that neither depends on
- nor affects state, and always returns exactly once -
+ It is OK for a compiler to move a call, or omit a duplicate call
+ and reuse a cached return value, even if the state changes between calls.
+ It is also OK to omit a call if the result is not used.
+ This attribute is safe if the function does not change observable state,
+ returns a value determined solely by its arguments' values
+ without examining state, and always returns exactly once -
e.g., does not raise an exception, call longjmp, or loop forever.
(This attribute is stricter than _GL_ATTRIBUTE_PURE because the
- function cannot observe state. It is stricter than
- _GL_ATTRIBUTE_UNSEQUENCED because the function must return exactly
- once and cannot depend on state addressed by its arguments.) */
+ function cannot observe state. Unlike _GL_ATTRIBUTE_UNSEQUENCED
+ the function must return exactly once and cannot access state
+ addressed by its pointer arguments or that happens to have the same
+ value for all calls to the function, but the function is allowed to
+ return a pointer to storage that can be modified later. */
/* Applies to: functions. */
#ifndef _GL_ATTRIBUTE_CONST
# if _GL_HAS_ATTRIBUTE (const)
# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
# else
-# define _GL_ATTRIBUTE_CONST _GL_ATTRIBUTE_UNSEQUENCED
+# define _GL_ATTRIBUTE_CONST
# endif
#endif
@@ -590,7 +593,9 @@ AC_DEFUN([gl_COMMON_BODY], [
/* _GL_ATTRIBUTE_MAYBE_UNUSED declares that it is not a programming mistake if
the entity is not used. The compiler should not warn if the entity is not
- used. */
+ used. However, 'int _GL_UNNAMED (i)' is preferable to
+ '_GL_ATTRIBUTE_MAYBE_UNUSED int i' when parameter I is unused
+ regardless of preprocessor macro settings. */
/* Applies to:
- function, variable,
- struct, union, struct/union member,
@@ -744,39 +749,40 @@ AC_DEFUN([gl_COMMON_BODY], [
#endif
/* _GL_ATTRIBUTE_PURE declares:
- It is OK for a compiler to move calls to the function and to omit
- calls to the function if another call has the same arguments or the
- result is not used, and if observable state is the same.
- This attribute is safe for a function that does not affect observable state
- and always returns exactly once.
+ It is OK for a compiler to move a call, or omit a duplicate call
+ and reuse a cached return value, if observable state is the same.
+ It is also OK to omit a call if the return value is not used.
+ This attribute is safe if the function does not change observable state,
+ returns a value determined solely by its arguments's values
+ together with observable state, and always returns exactly once.
(This attribute is looser than _GL_ATTRIBUTE_CONST because the function
- can depend on observable state. It is stricter than
- _GL_ATTRIBUTE_REPRODUCIBLE because the function must return exactly
- once and cannot affect state addressed by its arguments.) */
+ can depend on observable state.
+ Unlike _GL_ATTRIBUTE_REPRODUCIBLE the function must return exactly
+ once and cannot change state addressed by its arguments, but the
+ function can return a pointer to storage whose contents change later.) */
/* Applies to: functions. */
#ifndef _GL_ATTRIBUTE_PURE
# if _GL_HAS_ATTRIBUTE (pure)
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
# else
-# define _GL_ATTRIBUTE_PURE _GL_ATTRIBUTE_REPRODUCIBLE
+# define _GL_ATTRIBUTE_PURE
# endif
#endif
/* _GL_ATTRIBUTE_REPRODUCIBLE declares:
- It is OK for a compiler to move calls to the function and to omit duplicate
- calls to the function with the same arguments, so long as the state
- addressed by its arguments is the same and is updated in time for
- the rest of the program.
- This attribute is safe for a function that is effectless and idempotent; see
- ISO C 23 § 6.7.12.7 for a definition of these terms.
+ It is OK for a compiler to move a call, or omit a duplicate call
+ and reuse a cached value returned either directly or indirectly via
+ a pointer, if other observable state is the same;
+ however, pointer arguments cannot alias.
+ This attribute is safe for a function that is effectless and idempotent;
+ see ISO C 23 § 6.7.13.8 for a definition of these terms.
(This attribute is looser than _GL_ATTRIBUTE_UNSEQUENCED because
- the function need not be stateless and idempotent. It is looser
- than _GL_ATTRIBUTE_PURE because the function need not return
- exactly once and can affect state addressed by its arguments.)
+ the function need not be stateless or independent.
+ Unlike _GL_ATTRIBUTE_PURE the function need not return exactly once
+ and can change state addressed by its pointer arguments, but the
+ function cannot return a pointer to storage whose contents change later.)
See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and
- <https://stackoverflow.com/questions/76847905/>.
- ATTENTION! Efforts are underway to change the meaning of this attribute.
- See <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3424.htm>. */
+ <https://stackoverflow.com/questions/76847905/>. */
/* Applies to: functions, pointer to functions, function types. */
#ifndef _GL_ATTRIBUTE_REPRODUCIBLE
/* This may be revisited when gcc and clang support [[reproducible]] or possibly
@@ -816,20 +822,22 @@ AC_DEFUN([gl_COMMON_BODY], [
#endif
/* _GL_ATTRIBUTE_UNSEQUENCED declares:
- It is OK for a compiler to move calls to the function and to omit duplicate
- calls to the function with the same arguments, so long as the state
- addressed by its arguments is the same.
+ It is OK for a compiler to move a call, or omit a duplicate call
+ and reuse a cached value returned either directly or indirectly via
+ a pointer, if the state addressed by its pointer arguments is the same;
+ however, pointer arguments cannot alias.
This attribute is safe for a function that is effectless, idempotent,
- stateless, and independent; see ISO C 23 § 6.7.12.7 for a definition of
+ stateless, and independent; see ISO C 23 § 6.7.13.8 for a definition of
these terms.
(This attribute is stricter than _GL_ATTRIBUTE_REPRODUCIBLE because
- the function must be stateless and independent. It is looser than
- _GL_ATTRIBUTE_CONST because the function need not return exactly
- once and can depend on state addressed by its arguments.)
+ the function must be stateless and independent. Unlike
+ _GL_ATTRIBUTE_CONST the function need not return exactly once, and
+ can depend on state accessed via its pointer arguments or that
+ happens to have the same value for all calls to the function, but
+ the function cannot return a pointer to storage whose contents
+ change later.)
See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and
- <https://stackoverflow.com/questions/76847905/>.
- ATTENTION! Efforts are underway to change the meaning of this attribute.
- See <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3424.htm>. */
+ <https://stackoverflow.com/questions/76847905/>. */
/* Applies to: functions, pointer to functions, function types. */
#ifndef _GL_ATTRIBUTE_UNSEQUENCED
/* This may be revisited when gcc and clang support [[unsequenced]] or possibly
@@ -869,6 +877,21 @@ AC_DEFUN([gl_COMMON_BODY], [
# endif
#endif
+/* _GL_UNNAMED (ID) is the "name" of an unnamed function parameter.
+ Each of the function's unnamed parameters should have a unique "name".
+ The "name" cannot be used. This ports both to C17 and earlier, which
+ lack unnamed parameters, and to C++ and later C, which have them. */
+/* Applies to:
+ - function parameters. */
+#ifndef _GL_UNNAMED
+# if ((defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 202311 \
+ && !defined __cplusplus)
+# define _GL_UNNAMED(id) unnamed_##id _GL_ATTRIBUTE_UNUSED
+# else
+# define _GL_UNNAMED(id)
+# endif
+#endif
+
/* The following attributes enable detection of multithread-safety problems
and resource leaks at compile-time, by clang ≥ 15, when the warning option
-Wthread-safety is enabled. For usage, see
@@ -1406,7 +1429,7 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS],
dnl -Wno-type-limits >= 4.3 >= 3.9
dnl -Wno-undef >= 3 >= 3.9
dnl -Wno-unsuffixed-float-constants >= 4.5
- dnl -Wno-unused-const-variable >= 4.4 >= 3.9
+ dnl -Wno-unused-const-variable >= 6.1 >= 3.9
dnl -Wno-unused-function >= 3 >= 3.9
dnl -Wno-unused-parameter >= 3 >= 3.9
dnl
@@ -1436,7 +1459,7 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS],
-Wno-sign-conversion
-Wno-type-limits
#endif
- #if (__GNUC__ + (__GNUC_MINOR__ >= 4) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
+ #if (__GNUC__ + (__GNUC_MINOR__ >= 1) > 6 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
-Wno-unused-const-variable
#endif
#if (__GNUC__ + (__GNUC_MINOR__ >= 5) > 4 && !defined __clang__)