summaryrefslogtreecommitdiffstats
path: root/gl/m4/gnulib-common.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/gnulib-common.m4')
-rw-r--r--gl/m4/gnulib-common.m4480
1 files changed, 419 insertions, 61 deletions
diff --git a/gl/m4/gnulib-common.m4 b/gl/m4/gnulib-common.m4
index cb730449..26eef771 100644
--- a/gl/m4/gnulib-common.m4
+++ b/gl/m4/gnulib-common.m4
@@ -1,9 +1,10 @@
1# gnulib-common.m4 1# gnulib-common.m4
2# serial 93 2# serial 115
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_PREREQ([2.62]) 9AC_PREREQ([2.62])
9 10
@@ -20,43 +21,61 @@ AC_DEFUN([gl_COMMON_BODY], [
20[/* Witness that <config.h> has been included. */ 21[/* Witness that <config.h> has been included. */
21#define _GL_CONFIG_H_INCLUDED 1 22#define _GL_CONFIG_H_INCLUDED 1
22]) 23])
24 dnl Avoid warnings from gcc -Wtrailing-whitespace.
25 dnl This is a temporary workaround until Autoconf fixes it.
26 dnl Test case:
27 dnl empty1=; empty2=; AC_DEFINE_UNQUOTED([FOO], [$empty1$empty2], [...])
28 dnl should produce "#define FOO /**/", not "#define FOO ".
29 AH_TOP([#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__
30# pragma GCC diagnostic push
31# pragma GCC diagnostic ignored "-Wtrailing-whitespace"
32#endif
33])
34 AH_BOTTOM([#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__
35# pragma GCC diagnostic pop
36#endif
37])
23 AH_VERBATIM([_GL_GNUC_PREREQ], 38 AH_VERBATIM([_GL_GNUC_PREREQ],
24[/* True if the compiler says it groks GNU C version MAJOR.MINOR. */ 39[/* True if the compiler says it groks GNU C version MAJOR.MINOR.
25#if defined __GNUC__ && defined __GNUC_MINOR__ 40 Except that
41 - clang groks GNU C 4.2, even on Windows, where it does not define
42 __GNUC__.
43 - The OpenMandriva-modified clang compiler pretends that it groks
44 GNU C version 13.1, but it doesn't: It does not support
45 __attribute__ ((__malloc__ (f, i))), nor does it support
46 __attribute__ ((__warning__ (message))) on a function redeclaration.
47 - Users can make clang lie as well, through the -fgnuc-version option. */
48#if defined __GNUC__ && defined __GNUC_MINOR__ && !defined __clang__
26# define _GL_GNUC_PREREQ(major, minor) \ 49# define _GL_GNUC_PREREQ(major, minor) \
27 ((major) < __GNUC__ + ((minor) <= __GNUC_MINOR__)) 50 ((major) < __GNUC__ + ((minor) <= __GNUC_MINOR__))
51#elif defined __clang__
52 /* clang really only groks GNU C 4.2. */
53# define _GL_GNUC_PREREQ(major, minor) \
54 ((major) < 4 + ((minor) <= 2))
28#else 55#else
29# define _GL_GNUC_PREREQ(major, minor) 0 56# define _GL_GNUC_PREREQ(major, minor) 0
30#endif 57#endif
31]) 58])
32 AH_VERBATIM([_Noreturn], 59 AH_VERBATIM([_Noreturn],
33[/* The _Noreturn keyword of C11. */ 60[/* The _Noreturn keyword of C11.
61 Do not use [[noreturn]], because with it the syntax
62 extern _Noreturn void func (...);
63 would not be valid; such a declaration would be valid only with 'extern'
64 and '_Noreturn' swapped, or without the 'extern' keyword. However, some
65 AIX system header files and several gnulib header files use precisely
66 this syntax with 'extern'. So even though C23 deprecates _Noreturn,
67 it is currently more portable to prefer it to [[noreturn]].
68
69 Also, do not try to work around LLVM bug 59792 (clang 15 or earlier).
70 This rare bug can be worked around by compiling with 'clang -D_Noreturn=',
71 though the workaround may generate many false-alarm warnings. */
34#ifndef _Noreturn 72#ifndef _Noreturn
35# if (defined __cplusplus \ 73# if ((!defined __cplusplus || defined __clang__) \
36 && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \ 74 && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0)))
37 || (defined _MSC_VER && 1900 <= _MSC_VER)) \
38 && 0)
39 /* [[noreturn]] is not practically usable, because with it the syntax
40 extern _Noreturn void func (...);
41 would not be valid; such a declaration would only be valid with 'extern'
42 and '_Noreturn' swapped, or without the 'extern' keyword. However, some
43 AIX system header files and several gnulib header files use precisely
44 this syntax with 'extern'. */
45# define _Noreturn [[noreturn]]
46# elif (defined __clang__ && __clang_major__ < 16 \
47 && defined _GL_WORK_AROUND_LLVM_BUG_59792)
48 /* Compile with -D_GL_WORK_AROUND_LLVM_BUG_59792 to work around
49 that rare LLVM bug, though you may get many false-alarm warnings. */
50# define _Noreturn
51# elif ((!defined __cplusplus || defined __clang__) \
52 && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
53 || (!defined __STRICT_ANSI__ \
54 && (_GL_GNUC_PREREQ (4, 7) \
55 || (defined __apple_build_version__ \
56 ? 6000000 <= __apple_build_version__ \
57 : 3 < __clang_major__ + (5 <= __clang_minor__))))))
58 /* _Noreturn works as-is. */ 75 /* _Noreturn works as-is. */
59# elif _GL_GNUC_PREREQ (2, 8) || defined __clang__ || 0x5110 <= __SUNPRO_C 76# elif _GL_GNUC_PREREQ (2, 8) || defined __clang__ || 0x5110 <= __SUNPRO_C
77 /* Prefer __attribute__ ((__noreturn__)) to plain _Noreturn even if the
78 latter works, as 'gcc -std=gnu99 -Wpedantic' warns about _Noreturn. */
60# define _Noreturn __attribute__ ((__noreturn__)) 79# define _Noreturn __attribute__ ((__noreturn__))
61# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) 80# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0)
62# define _Noreturn __declspec (noreturn) 81# define _Noreturn __declspec (noreturn)
@@ -90,6 +109,9 @@ AC_DEFUN([gl_COMMON_BODY], [
90# define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__) 109# define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__)
91# else 110# else
92# define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr 111# define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr
112/* The following lines list the first GCC version that supports the attribute.
113 Although the lines are not used in GCC 5 and later (as GCC 5 introduced
114 __has_attribute support), list GCC versions 5+ anyway for completeness. */
93# define _GL_ATTR_alloc_size _GL_GNUC_PREREQ (4, 3) 115# define _GL_ATTR_alloc_size _GL_GNUC_PREREQ (4, 3)
94# define _GL_ATTR_always_inline _GL_GNUC_PREREQ (3, 2) 116# define _GL_ATTR_always_inline _GL_GNUC_PREREQ (3, 2)
95# define _GL_ATTR_artificial _GL_GNUC_PREREQ (4, 3) 117# define _GL_ATTR_artificial _GL_GNUC_PREREQ (4, 3)
@@ -110,12 +132,15 @@ AC_DEFUN([gl_COMMON_BODY], [
110# endif 132# endif
111# define _GL_ATTR_noinline _GL_GNUC_PREREQ (3, 1) 133# define _GL_ATTR_noinline _GL_GNUC_PREREQ (3, 1)
112# define _GL_ATTR_nonnull _GL_GNUC_PREREQ (3, 3) 134# define _GL_ATTR_nonnull _GL_GNUC_PREREQ (3, 3)
135# define _GL_ATTR_nonnull_if_nonzero _GL_GNUC_PREREQ (15, 1)
113# define _GL_ATTR_nonstring _GL_GNUC_PREREQ (8, 0) 136# define _GL_ATTR_nonstring _GL_GNUC_PREREQ (8, 0)
114# define _GL_ATTR_nothrow _GL_GNUC_PREREQ (3, 3) 137# define _GL_ATTR_nothrow _GL_GNUC_PREREQ (3, 3)
115# define _GL_ATTR_packed _GL_GNUC_PREREQ (2, 7) 138# define _GL_ATTR_packed _GL_GNUC_PREREQ (2, 7)
116# define _GL_ATTR_pure _GL_GNUC_PREREQ (2, 96) 139# define _GL_ATTR_pure _GL_GNUC_PREREQ (2, 96)
140# define _GL_ATTR_reproducible _GL_GNUC_PREREQ (15, 1)
117# define _GL_ATTR_returns_nonnull _GL_GNUC_PREREQ (4, 9) 141# define _GL_ATTR_returns_nonnull _GL_GNUC_PREREQ (4, 9)
118# define _GL_ATTR_sentinel _GL_GNUC_PREREQ (4, 0) 142# define _GL_ATTR_sentinel _GL_GNUC_PREREQ (4, 0)
143# define _GL_ATTR_unsequenced _GL_GNUC_PREREQ (15, 1)
119# define _GL_ATTR_unused _GL_GNUC_PREREQ (2, 7) 144# define _GL_ATTR_unused _GL_GNUC_PREREQ (2, 7)
120# define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4) 145# define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4)
121# endif 146# endif
@@ -131,6 +156,23 @@ AC_DEFUN([gl_COMMON_BODY], [
131# define _GL_HAVE___HAS_C_ATTRIBUTE 0 156# define _GL_HAVE___HAS_C_ATTRIBUTE 0
132#endif 157#endif
133 158
159/* Attributes in bracket syntax [[...]] vs. attributes in __attribute__((...))
160 syntax, in function declarations. There are two problems here.
161 (Last tested with gcc/g++ 14 and clang/clang++ 18.)
162
163 1) We want that the _GL_ATTRIBUTE_* can be cumulated on the same declaration
164 in any order.
165 =========================== foo.c = foo.cc ===========================
166 __attribute__ ((__deprecated__)) [[__nodiscard__]] int bar1 (int);
167 [[__nodiscard__]] __attribute__ ((__deprecated__)) int bar2 (int);
168 ======================================================================
169 This gives a syntax error
170 - in C mode with gcc
171 <https://gcc.gnu.org/PR108796>, and
172 - in C++ mode with clang++ version < 16, and
173 - in C++ mode, inside extern "C" {}, still in newer clang++ versions
174 <https://github.com/llvm/llvm-project/issues/101990>.
175 */
134/* Define if, in a function declaration, the attributes in bracket syntax 176/* Define if, in a function declaration, the attributes in bracket syntax
135 [[...]] must come before the attributes in __attribute__((...)) syntax. 177 [[...]] must come before the attributes in __attribute__((...)) syntax.
136 If this is defined, it is best to avoid the bracket syntax, so that the 178 If this is defined, it is best to avoid the bracket syntax, so that the
@@ -145,6 +187,176 @@ AC_DEFUN([gl_COMMON_BODY], [
145# define _GL_BRACKET_BEFORE_ATTRIBUTE 1 187# define _GL_BRACKET_BEFORE_ATTRIBUTE 1
146# endif 188# endif
147#endif 189#endif
190/*
191 2) We want that the _GL_ATTRIBUTE_* can be placed in a declaration
192 - without 'extern', in C as well as in C++,
193 - with 'extern', in C,
194 - with 'extern "C"', in C++
195 in the same position. That is, we don't want to be forced to use a
196 macro which arranges for the attribute to come before 'extern' in
197 one case and after 'extern' in the other case, because such a macro
198 would make the source code of .h files pretty ugly.
199 =========================== foo.c = foo.cc ===========================
200 #ifdef __cplusplus
201 # define CC "C"
202 #else
203 # define CC
204 #endif
205
206 #define ND [[__nodiscard__]]
207 #define WUR __attribute__((__warn_unused_result__))
208
209 #ifdef __cplusplus
210 extern "C" {
211 #endif
212 // gcc clang g++ clang++
213
214 ND int foo (int);
215 int ND foo (int); // warn error warn error
216 int foo ND (int);
217 int foo (int) ND; // warn error warn error
218
219 WUR int foo (int);
220 int WUR foo (int);
221 int fo1 WUR (int); // error error error error
222 int foo (int) WUR;
223
224 #ifdef __cplusplus
225 }
226 #endif
227
228 // gcc clang g++ clang++
229
230 ND extern CC int foo (int); // error error
231 extern CC ND int foo (int); // error error
232 extern CC int ND foo (int); // warn error warn error
233 extern CC int foo ND (int);
234 extern CC int foo (int) ND; // warn error warn error
235
236 WUR extern CC int foo (int); // warn
237 extern CC WUR int foo (int);
238 extern CC int WUR foo (int);
239 extern CC int foo WUR (int); // error error error error
240 extern CC int foo (int) WUR;
241
242 ND EXTERN_C_FUNC int foo (int); // error error
243 EXTERN_C_FUNC ND int foo (int);
244 EXTERN_C_FUNC int ND foo (int); // warn error warn error
245 EXTERN_C_FUNC int foo ND (int);
246 EXTERN_C_FUNC int foo (int) ND; // warn error warn error
247
248 WUR EXTERN_C_FUNC int foo (int); // warn
249 EXTERN_C_FUNC WUR int foo (int);
250 EXTERN_C_FUNC int WUR foo (int);
251 EXTERN_C_FUNC int fo2 WUR (int); // error error error error
252 EXTERN_C_FUNC int foo (int) WUR;
253 ======================================================================
254 So, if we insist on using the 'extern' keyword ('extern CC' idiom):
255 * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]]
256 in both C and C++, there is one available position:
257 - between the function name and the parameter list.
258 * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax
259 in both C and C++, there are several available positions:
260 - before the return type,
261 - between return type and function name,
262 - at the end of the declaration.
263 * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]] in C and to
264 __attribute__((...)) syntax in C++, there is no available position:
265 it would need to come before 'extern' in C but after 'extern "C"'
266 in C++.
267 * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax in C and
268 to bracket syntax [[...]] in C++, there is one available position:
269 - before the return type.
270 Whereas, if we use the 'EXTERN_C_FUNC' idiom, which conditionally
271 omits the 'extern' keyword:
272 * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]]
273 in both C and C++, there are two available positions:
274 - before the return type,
275 - between the function name and the parameter list.
276 * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax
277 in both C and C++, there are several available positions:
278 - before the return type,
279 - between return type and function name,
280 - at the end of the declaration.
281 * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]] in C and to
282 __attribute__((...)) syntax in C++, there is one available position:
283 - before the return type.
284 * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax in C and
285 to bracket syntax [[...]] in C++, there is one available position:
286 - before the return type.
287 The best choice is therefore to use the 'EXTERN_C_FUNC' idiom and
288 put the attributes before the return type. This works regardless
289 to what the _GL_ATTRIBUTE_* macros expand.
290 */
291
292/* Attributes in bracket syntax [[...]] vs. attributes in __attribute__((...))
293 syntax, in static/inline function definitions.
294
295 There are similar constraints as for function declarations. However, here,
296 we cannot omit the storage-class specifier. Therefore, the following rule
297 applies:
298 * The macros
299 _GL_ATTRIBUTE_CONST
300 _GL_ATTRIBUTE_DEPRECATED
301 _GL_ATTRIBUTE_MAYBE_UNUSED
302 _GL_ATTRIBUTE_NODISCARD
303 _GL_ATTRIBUTE_PURE
304 _GL_ATTRIBUTE_REPRODUCIBLE
305 _GL_ATTRIBUTE_UNSEQUENCED
306 which may expand to bracket syntax [[...]], must come first, before the
307 storage-class specifier.
308 * Other _GL_ATTRIBUTE_* macros, that expand to __attribute__((...)) syntax,
309 are better placed between the storage-class specifier and the return
310 type.
311 */
312
313/* Attributes in bracket syntax [[...]] vs. attributes in __attribute__((...))
314 syntax, in variable declarations.
315
316 At which position can they be placed?
317 (Last tested with gcc/g++ 14 and clang/clang++ 18.)
318
319 =========================== foo.c = foo.cc ===========================
320 #ifdef __cplusplus
321 # define CC "C"
322 #else
323 # define CC
324 #endif
325
326 #define BD [[__deprecated__]]
327 #define AD __attribute__ ((__deprecated__))
328
329 // gcc clang g++ clang++
330
331 BD extern CC int var; // error error
332 extern CC BD int var; // error error
333 extern CC int BD var; // warn error warn error
334 extern CC int var BD;
335
336 AD extern CC int var; // warn
337 extern CC AD int var;
338 extern CC int AD var;
339 extern CC int var AD;
340
341 BD extern CC int z[]; // error error
342 extern CC BD int z[]; // error error
343 extern CC int BD z[]; // warn error warn error
344 extern CC int z1 BD [];
345 extern CC int z[] BD; // warn error error
346
347 AD extern CC int z[]; // warn
348 extern CC AD int z[];
349 extern CC int AD z[];
350 extern CC int z2 AD []; // error error error error
351 extern CC int z[] AD;
352 ======================================================================
353
354 * For non-array variables, the only good position is after the variable name,
355 that is, at the end of the declaration.
356 * For array variables, you will need to distinguish C and C++:
357 - In C, before the 'extern' keyword.
358 - In C++, between the 'extern "C"' and the variable's type.
359 */
148]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's alignas instead. 360]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's alignas instead.
149[ 361[
150/* _GL_ATTRIBUTE_ALLOC_SIZE ((N)) declares that the Nth argument of the function 362/* _GL_ATTRIBUTE_ALLOC_SIZE ((N)) declares that the Nth argument of the function
@@ -152,7 +364,7 @@ AC_DEFUN([gl_COMMON_BODY], [
152 _GL_ATTRIBUTE_ALLOC_SIZE ((M, N)) declares that the Mth argument multiplied 364 _GL_ATTRIBUTE_ALLOC_SIZE ((M, N)) declares that the Mth argument multiplied
153 by the Nth argument of the function is the size of the returned memory block. 365 by the Nth argument of the function is the size of the returned memory block.
154 */ 366 */
155/* Applies to: function, pointer to function, function types. */ 367/* Applies to: functions, pointer to functions, function types. */
156#ifndef _GL_ATTRIBUTE_ALLOC_SIZE 368#ifndef _GL_ATTRIBUTE_ALLOC_SIZE
157# if _GL_HAS_ATTRIBUTE (alloc_size) 369# if _GL_HAS_ATTRIBUTE (alloc_size)
158# define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args)) 370# define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args))
@@ -163,7 +375,7 @@ AC_DEFUN([gl_COMMON_BODY], [
163 375
164/* _GL_ATTRIBUTE_ALWAYS_INLINE tells that the compiler should always inline the 376/* _GL_ATTRIBUTE_ALWAYS_INLINE tells that the compiler should always inline the
165 function and report an error if it cannot do so. */ 377 function and report an error if it cannot do so. */
166/* Applies to: function. */ 378/* Applies to: functions. */
167#ifndef _GL_ATTRIBUTE_ALWAYS_INLINE 379#ifndef _GL_ATTRIBUTE_ALWAYS_INLINE
168# if _GL_HAS_ATTRIBUTE (always_inline) 380# if _GL_HAS_ATTRIBUTE (always_inline)
169# define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__)) 381# define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__))
@@ -175,7 +387,7 @@ AC_DEFUN([gl_COMMON_BODY], [
175/* _GL_ATTRIBUTE_ARTIFICIAL declares that the function is not important to show 387/* _GL_ATTRIBUTE_ARTIFICIAL declares that the function is not important to show
176 in stack traces when debugging. The compiler should omit the function from 388 in stack traces when debugging. The compiler should omit the function from
177 stack traces. */ 389 stack traces. */
178/* Applies to: function. */ 390/* Applies to: functions. */
179#ifndef _GL_ATTRIBUTE_ARTIFICIAL 391#ifndef _GL_ATTRIBUTE_ARTIFICIAL
180# if _GL_HAS_ATTRIBUTE (artificial) 392# if _GL_HAS_ATTRIBUTE (artificial)
181# define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__)) 393# define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__))
@@ -201,12 +413,20 @@ AC_DEFUN([gl_COMMON_BODY], [
201# endif 413# endif
202#endif 414#endif
203 415
204/* _GL_ATTRIBUTE_CONST declares that it is OK for a compiler to omit duplicate 416/* _GL_ATTRIBUTE_CONST declares:
205 calls to the function with the same arguments. 417 It is OK for a compiler to move a call, or omit a duplicate call
206 This attribute is safe for a function that neither depends on nor affects 418 and reuse a cached return value, even if the state changes between calls.
207 observable state, and always returns exactly once - e.g., does not loop 419 It is also OK to omit a call if the result is not used.
208 forever, and does not call longjmp. 420 This attribute is safe if the function does not change observable state,
209 (This attribute is stricter than _GL_ATTRIBUTE_PURE.) */ 421 returns a value determined solely by its arguments' values
422 without examining state, and always returns exactly once -
423 e.g., does not raise an exception, call longjmp, or loop forever.
424 (This attribute is stricter than _GL_ATTRIBUTE_PURE because the
425 function cannot observe state. Unlike _GL_ATTRIBUTE_UNSEQUENCED
426 the function must return exactly once and cannot access state
427 addressed by its pointer arguments or that happens to have the same
428 value for all calls to the function, but the function is allowed to
429 return a pointer to storage that can be modified later. */
210/* Applies to: functions. */ 430/* Applies to: functions. */
211#ifndef _GL_ATTRIBUTE_CONST 431#ifndef _GL_ATTRIBUTE_CONST
212# if _GL_HAS_ATTRIBUTE (const) 432# if _GL_HAS_ATTRIBUTE (const)
@@ -234,7 +454,7 @@ AC_DEFUN([gl_COMMON_BODY], [
234 yet. */ 454 yet. */
235#ifndef _GL_ATTRIBUTE_DEALLOC_FREE 455#ifndef _GL_ATTRIBUTE_DEALLOC_FREE
236# if defined __cplusplus && defined __GNUC__ && !defined __clang__ 456# if defined __cplusplus && defined __GNUC__ && !defined __clang__
237/* Work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108231> */ 457/* Work around GCC bug <https://gcc.gnu.org/PR108231> */
238# define _GL_ATTRIBUTE_DEALLOC_FREE \ 458# define _GL_ATTRIBUTE_DEALLOC_FREE \
239 _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1) 459 _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1)
240# else 460# else
@@ -373,7 +593,9 @@ AC_DEFUN([gl_COMMON_BODY], [
373 593
374/* _GL_ATTRIBUTE_MAYBE_UNUSED declares that it is not a programming mistake if 594/* _GL_ATTRIBUTE_MAYBE_UNUSED declares that it is not a programming mistake if
375 the entity is not used. The compiler should not warn if the entity is not 595 the entity is not used. The compiler should not warn if the entity is not
376 used. */ 596 used. However, 'int _GL_UNNAMED (i)' is preferable to
597 '_GL_ATTRIBUTE_MAYBE_UNUSED int i' when parameter I is unused
598 regardless of preprocessor macro settings. */
377/* Applies to: 599/* Applies to:
378 - function, variable, 600 - function, variable,
379 - struct, union, struct/union member, 601 - struct, union, struct/union member,
@@ -460,6 +682,17 @@ AC_DEFUN([gl_COMMON_BODY], [
460# endif 682# endif
461#endif 683#endif
462 684
685/* _GL_ATTRIBUTE_NONNULL_IF_NONZERO (NP, NI) declares that the argument NP
686 (a pointer) must not be NULL if the argument NI (an integer) is != 0. */
687/* Applies to: functions. */
688#ifndef _GL_ATTRIBUTE_NONNULL_IF_NONZERO
689# if _GL_HAS_ATTRIBUTE (nonnull_if_nonzero)
690# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) __attribute__ ((__nonnull_if_nonzero__ (np, ni)))
691# else
692# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni)
693# endif
694#endif
695
463/* _GL_ATTRIBUTE_NONSTRING declares that the contents of a character array is 696/* _GL_ATTRIBUTE_NONSTRING declares that the contents of a character array is
464 not meant to be NUL-terminated. */ 697 not meant to be NUL-terminated. */
465/* Applies to: struct/union members and variables that are arrays of element 698/* Applies to: struct/union members and variables that are arrays of element
@@ -481,7 +714,7 @@ AC_DEFUN([gl_COMMON_BODY], [
481 other attributes. */ 714 other attributes. */
482#ifndef _GL_ATTRIBUTE_NOTHROW 715#ifndef _GL_ATTRIBUTE_NOTHROW
483# if defined __cplusplus 716# if defined __cplusplus
484# if _GL_GNUC_PREREQ (2, 8) || __clang_major >= 4 717# if _GL_GNUC_PREREQ (2, 8) || __clang_major__ >= 4
485# if __cplusplus >= 201103L 718# if __cplusplus >= 201103L
486# define _GL_ATTRIBUTE_NOTHROW noexcept (true) 719# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
487# else 720# else
@@ -505,9 +738,9 @@ AC_DEFUN([gl_COMMON_BODY], [
505 minimizing the memory required. */ 738 minimizing the memory required. */
506/* Applies to: struct members, struct, union, 739/* Applies to: struct members, struct, union,
507 in C++ also: class. */ 740 in C++ also: class. */
741#ifndef _GL_ATTRIBUTE_PACKED
508/* Oracle Studio 12.6 miscompiles code with __attribute__ ((__packed__)) despite 742/* Oracle Studio 12.6 miscompiles code with __attribute__ ((__packed__)) despite
509 __has_attribute OK. */ 743 __has_attribute OK. */
510#ifndef _GL_ATTRIBUTE_PACKED
511# if _GL_HAS_ATTRIBUTE (packed) && !defined __SUNPRO_C 744# if _GL_HAS_ATTRIBUTE (packed) && !defined __SUNPRO_C
512# define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__)) 745# define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__))
513# else 746# else
@@ -515,12 +748,18 @@ AC_DEFUN([gl_COMMON_BODY], [
515# endif 748# endif
516#endif 749#endif
517 750
518/* _GL_ATTRIBUTE_PURE declares that It is OK for a compiler to omit duplicate 751/* _GL_ATTRIBUTE_PURE declares:
519 calls to the function with the same arguments if observable state is not 752 It is OK for a compiler to move a call, or omit a duplicate call
520 changed between calls. 753 and reuse a cached return value, if observable state is the same.
521 This attribute is safe for a function that does not affect 754 It is also OK to omit a call if the return value is not used.
522 observable state, and always returns exactly once. 755 This attribute is safe if the function does not change observable state,
523 (This attribute is looser than _GL_ATTRIBUTE_CONST.) */ 756 returns a value determined solely by its arguments's values
757 together with observable state, and always returns exactly once.
758 (This attribute is looser than _GL_ATTRIBUTE_CONST because the function
759 can depend on observable state.
760 Unlike _GL_ATTRIBUTE_REPRODUCIBLE the function must return exactly
761 once and cannot change state addressed by its arguments, but the
762 function can return a pointer to storage whose contents change later.) */
524/* Applies to: functions. */ 763/* Applies to: functions. */
525#ifndef _GL_ATTRIBUTE_PURE 764#ifndef _GL_ATTRIBUTE_PURE
526# if _GL_HAS_ATTRIBUTE (pure) 765# if _GL_HAS_ATTRIBUTE (pure)
@@ -530,6 +769,34 @@ AC_DEFUN([gl_COMMON_BODY], [
530# endif 769# endif
531#endif 770#endif
532 771
772/* _GL_ATTRIBUTE_REPRODUCIBLE declares:
773 It is OK for a compiler to move a call, or omit a duplicate call
774 and reuse a cached value returned either directly or indirectly via
775 a pointer, if other observable state is the same;
776 however, pointer arguments cannot alias.
777 This attribute is safe for a function that is effectless and idempotent;
778 see ISO C 23 § 6.7.13.8 for a definition of these terms.
779 (This attribute is looser than _GL_ATTRIBUTE_UNSEQUENCED because
780 the function need not be stateless or independent.
781 Unlike _GL_ATTRIBUTE_PURE the function need not return exactly once
782 and can change state addressed by its pointer arguments, but the
783 function cannot return a pointer to storage whose contents change later.)
784 See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and
785 <https://stackoverflow.com/questions/76847905/>. */
786/* Applies to: functions, pointer to functions, function types. */
787#ifndef _GL_ATTRIBUTE_REPRODUCIBLE
788/* This may be revisited when gcc and clang support [[reproducible]] or possibly
789 __attribute__ ((__reproducible__)). */
790# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE
791# if _GL_HAS_ATTRIBUTE (reproducible)
792# define _GL_ATTRIBUTE_REPRODUCIBLE [[reproducible]]
793# endif
794# endif
795# ifndef _GL_ATTRIBUTE_REPRODUCIBLE
796# define _GL_ATTRIBUTE_REPRODUCIBLE
797# endif
798#endif
799
533/* _GL_ATTRIBUTE_RETURNS_NONNULL declares that the function's return value is 800/* _GL_ATTRIBUTE_RETURNS_NONNULL declares that the function's return value is
534 a non-NULL pointer. */ 801 a non-NULL pointer. */
535/* Applies to: functions. */ 802/* Applies to: functions. */
@@ -554,6 +821,37 @@ AC_DEFUN([gl_COMMON_BODY], [
554# endif 821# endif
555#endif 822#endif
556 823
824/* _GL_ATTRIBUTE_UNSEQUENCED declares:
825 It is OK for a compiler to move a call, or omit a duplicate call
826 and reuse a cached value returned either directly or indirectly via
827 a pointer, if the state addressed by its pointer arguments is the same;
828 however, pointer arguments cannot alias.
829 This attribute is safe for a function that is effectless, idempotent,
830 stateless, and independent; see ISO C 23 § 6.7.13.8 for a definition of
831 these terms.
832 (This attribute is stricter than _GL_ATTRIBUTE_REPRODUCIBLE because
833 the function must be stateless and independent. Unlike
834 _GL_ATTRIBUTE_CONST the function need not return exactly once, and
835 can depend on state accessed via its pointer arguments or that
836 happens to have the same value for all calls to the function, but
837 the function cannot return a pointer to storage whose contents
838 change later.)
839 See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and
840 <https://stackoverflow.com/questions/76847905/>. */
841/* Applies to: functions, pointer to functions, function types. */
842#ifndef _GL_ATTRIBUTE_UNSEQUENCED
843/* This may be revisited when gcc and clang support [[unsequenced]] or possibly
844 __attribute__ ((__unsequenced__)). */
845# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE
846# if _GL_HAS_ATTRIBUTE (unsequenced)
847# define _GL_ATTRIBUTE_UNSEQUENCED [[unsequenced]]
848# endif
849# endif
850# ifndef _GL_ATTRIBUTE_UNSEQUENCED
851# define _GL_ATTRIBUTE_UNSEQUENCED
852# endif
853#endif
854
557/* A helper macro. Don't use it directly. */ 855/* A helper macro. Don't use it directly. */
558#ifndef _GL_ATTRIBUTE_UNUSED 856#ifndef _GL_ATTRIBUTE_UNUSED
559# if _GL_HAS_ATTRIBUTE (unused) 857# if _GL_HAS_ATTRIBUTE (unused)
@@ -578,6 +876,50 @@ AC_DEFUN([gl_COMMON_BODY], [
578# define _GL_UNUSED_LABEL 876# define _GL_UNUSED_LABEL
579# endif 877# endif
580#endif 878#endif
879
880/* _GL_UNNAMED (ID) is the "name" of an unnamed function parameter.
881 Each of the function's unnamed parameters should have a unique "name".
882 The "name" cannot be used. This ports both to C17 and earlier, which
883 lack unnamed parameters, and to C++ and later C, which have them. */
884/* Applies to:
885 - function parameters. */
886#ifndef _GL_UNNAMED
887# if ((defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 202311 \
888 && !defined __cplusplus)
889# define _GL_UNNAMED(id) unnamed_##id _GL_ATTRIBUTE_UNUSED
890# else
891# define _GL_UNNAMED(id)
892# endif
893#endif
894
895/* The following attributes enable detection of multithread-safety problems
896 and resource leaks at compile-time, by clang ≥ 15, when the warning option
897 -Wthread-safety is enabled. For usage, see
898 <https://clang.llvm.org/docs/ThreadSafetyAnalysis.html>. */
899#ifndef _GL_ATTRIBUTE_CAPABILITY_TYPE
900# if __clang_major__ >= 15
901# define _GL_ATTRIBUTE_CAPABILITY_TYPE(concept) \
902 __attribute__ ((__capability__ (concept)))
903# else
904# define _GL_ATTRIBUTE_CAPABILITY_TYPE(concept)
905# endif
906#endif
907#ifndef _GL_ATTRIBUTE_ACQUIRE_CAPABILITY
908# if __clang_major__ >= 15
909# define _GL_ATTRIBUTE_ACQUIRE_CAPABILITY(resource) \
910 __attribute__ ((__acquire_capability__ (resource)))
911# else
912# define _GL_ATTRIBUTE_ACQUIRE_CAPABILITY(resource)
913# endif
914#endif
915#ifndef _GL_ATTRIBUTE_RELEASE_CAPABILITY
916# if __clang_major__ >= 15
917# define _GL_ATTRIBUTE_RELEASE_CAPABILITY(resource) \
918 __attribute__ ((__release_capability__ (resource)))
919# else
920# define _GL_ATTRIBUTE_RELEASE_CAPABILITY(resource)
921# endif
922#endif
581]) 923])
582 AH_VERBATIM([c_linkage], 924 AH_VERBATIM([c_linkage],
583[/* In C++, there is the concept of "language linkage", that encompasses 925[/* In C++, there is the concept of "language linkage", that encompasses
@@ -628,8 +970,8 @@ AC_DEFUN([gl_COMMON_BODY], [
628 -1 if n1 < n2 970 -1 if n1 < n2
629 The naïve code (n1 > n2 ? 1 : n1 < n2 ? -1 : 0) produces a conditional 971 The naïve code (n1 > n2 ? 1 : n1 < n2 ? -1 : 0) produces a conditional
630 jump with nearly all GCC versions up to GCC 10. 972 jump with nearly all GCC versions up to GCC 10.
631 This variant (n1 < n2 ? -1 : n1 > n2) produces a conditional with many 973 This variant (n1 < n2 ? -1 : n1 > n2) produces a conditional jump with
632 GCC versions up to GCC 9. 974 many GCC versions up to GCC 9.
633 The better code (n1 > n2) - (n1 < n2) from Hacker's Delight § 2-9 975 The better code (n1 > n2) - (n1 < n2) from Hacker's Delight § 2-9
634 avoids conditional jumps in all GCC versions >= 3.4. */ 976 avoids conditional jumps in all GCC versions >= 3.4. */
635#define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2))) 977#define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2)))
@@ -1006,7 +1348,7 @@ AC_DEFUN([gl_CC_ALLOW_WARNINGS],
1006 AC_REQUIRE([AC_PROG_CC]) 1348 AC_REQUIRE([AC_PROG_CC])
1007 AC_CACHE_CHECK([for C compiler option to allow warnings], 1349 AC_CACHE_CHECK([for C compiler option to allow warnings],
1008 [gl_cv_cc_wallow], 1350 [gl_cv_cc_wallow],
1009 [rm -f conftest* 1351 [rm -fr conftest*
1010 echo 'int dummy;' > conftest.c 1352 echo 'int dummy;' > conftest.c
1011 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null 1353 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null
1012 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Wno-error -c conftest.c 2>conftest2.err]) >/dev/null 1354 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Wno-error -c conftest.c 2>conftest2.err]) >/dev/null
@@ -1019,7 +1361,7 @@ AC_DEFUN([gl_CC_ALLOW_WARNINGS],
1019 else 1361 else
1020 gl_cv_cc_wallow=none 1362 gl_cv_cc_wallow=none
1021 fi 1363 fi
1022 rm -f conftest* 1364 rm -fr conftest*
1023 ]) 1365 ])
1024 case "$gl_cv_cc_wallow" in 1366 case "$gl_cv_cc_wallow" in
1025 none) GL_CFLAG_ALLOW_WARNINGS='' ;; 1367 none) GL_CFLAG_ALLOW_WARNINGS='' ;;
@@ -1037,7 +1379,7 @@ AC_DEFUN([gl_CXX_ALLOW_WARNINGS],
1037 if test -n "$CXX" && test "$CXX" != no; then 1379 if test -n "$CXX" && test "$CXX" != no; then
1038 AC_CACHE_CHECK([for C++ compiler option to allow warnings], 1380 AC_CACHE_CHECK([for C++ compiler option to allow warnings],
1039 [gl_cv_cxx_wallow], 1381 [gl_cv_cxx_wallow],
1040 [rm -f conftest* 1382 [rm -fr conftest*
1041 echo 'int dummy;' > conftest.cc 1383 echo 'int dummy;' > conftest.cc
1042 AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null 1384 AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null
1043 AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -Wno-error -c conftest.cc 2>conftest2.err]) >/dev/null 1385 AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -Wno-error -c conftest.cc 2>conftest2.err]) >/dev/null
@@ -1050,7 +1392,7 @@ AC_DEFUN([gl_CXX_ALLOW_WARNINGS],
1050 else 1392 else
1051 gl_cv_cxx_wallow=none 1393 gl_cv_cxx_wallow=none
1052 fi 1394 fi
1053 rm -f conftest* 1395 rm -fr conftest*
1054 ]) 1396 ])
1055 case "$gl_cv_cxx_wallow" in 1397 case "$gl_cv_cxx_wallow" in
1056 none) GL_CXXFLAG_ALLOW_WARNINGS='' ;; 1398 none) GL_CXXFLAG_ALLOW_WARNINGS='' ;;
@@ -1087,11 +1429,12 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS],
1087 dnl -Wno-type-limits >= 4.3 >= 3.9 1429 dnl -Wno-type-limits >= 4.3 >= 3.9
1088 dnl -Wno-undef >= 3 >= 3.9 1430 dnl -Wno-undef >= 3 >= 3.9
1089 dnl -Wno-unsuffixed-float-constants >= 4.5 1431 dnl -Wno-unsuffixed-float-constants >= 4.5
1432 dnl -Wno-unused-const-variable >= 6.1 >= 3.9
1090 dnl -Wno-unused-function >= 3 >= 3.9 1433 dnl -Wno-unused-function >= 3 >= 3.9
1091 dnl -Wno-unused-parameter >= 3 >= 3.9 1434 dnl -Wno-unused-parameter >= 3 >= 3.9
1092 dnl 1435 dnl
1093 cat > conftest.c <<\EOF 1436 cat > conftest.c <<\EOF
1094 #if __GNUC__ >= 3 || (__clang_major__ + (__clang_minor__ >= 9) > 3) 1437 #if (__GNUC__ >= 3 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
1095 -Wno-cast-qual 1438 -Wno-cast-qual
1096 -Wno-conversion 1439 -Wno-conversion
1097 -Wno-float-equal 1440 -Wno-float-equal
@@ -1100,23 +1443,26 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS],
1100 -Wno-unused-function 1443 -Wno-unused-function
1101 -Wno-unused-parameter 1444 -Wno-unused-parameter
1102 #endif 1445 #endif
1103 #if __GNUC__ + (__GNUC_MINOR__ >= 9) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) 1446 #if (__GNUC__ + (__GNUC_MINOR__ >= 9) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
1104 -Wno-float-conversion 1447 -Wno-float-conversion
1105 #endif 1448 #endif
1106 #if __GNUC__ >= 7 || (__clang_major__ + (__clang_minor__ >= 9) > 3) 1449 #if (__GNUC__ >= 7 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
1107 -Wimplicit-fallthrough 1450 -Wimplicit-fallthrough
1108 #endif 1451 #endif
1109 #if __GNUC__ + (__GNUC_MINOR__ >= 8) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) 1452 #if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
1110 -Wno-pedantic 1453 -Wno-pedantic
1111 #endif 1454 #endif
1112 #if 3 < __clang_major__ + (9 <= __clang_minor__) 1455 #if 3 < __clang_major__ + (9 <= __clang_minor__)
1113 -Wno-tautological-constant-out-of-range-compare 1456 -Wno-tautological-constant-out-of-range-compare
1114 #endif 1457 #endif
1115 #if __GNUC__ + (__GNUC_MINOR__ >= 3) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) 1458 #if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
1116 -Wno-sign-conversion 1459 -Wno-sign-conversion
1117 -Wno-type-limits 1460 -Wno-type-limits
1118 #endif 1461 #endif
1119 #if __GNUC__ + (__GNUC_MINOR__ >= 5) > 4 1462 #if (__GNUC__ + (__GNUC_MINOR__ >= 1) > 6 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
1463 -Wno-unused-const-variable
1464 #endif
1465 #if (__GNUC__ + (__GNUC_MINOR__ >= 5) > 4 && !defined __clang__)
1120 -Wno-unsuffixed-float-constants 1466 -Wno-unsuffixed-float-constants
1121 #endif 1467 #endif
1122EOF 1468EOF
@@ -1240,13 +1586,25 @@ AC_DEFUN([gl_CHECK_FUNCS_CASE_FOR_MACOS],
1240 if test $[ac_cv_func_][$1] = yes; then 1586 if test $[ac_cv_func_][$1] = yes; then
1241 [gl_cv_onwards_func_][$1]=yes 1587 [gl_cv_onwards_func_][$1]=yes
1242 else 1588 else
1589 dnl This is a bit complicated, because here we need the behaviour
1590 dnl of AC_CHECK_DECL before the
1591 dnl commit e1bbc9b93cdff61d70719c224b37970e065008bb (2025-05-26).
1592 [ac_cv_have_decl_][$1][_saved]="$[ac_cv_have_decl_][$1]"
1243 unset [ac_cv_have_decl_][$1] 1593 unset [ac_cv_have_decl_][$1]
1594 ac_c_future_darwin_options_saved="$ac_c_future_darwin_options"
1595 ac_cxx_future_darwin_options_saved="$ac_cxx_future_darwin_options"
1596 ac_c_future_darwin_options=
1597 ac_cxx_future_darwin_options=
1244 AC_CHECK_DECL([$1], , , [$2]) 1598 AC_CHECK_DECL([$1], , , [$2])
1599 ac_c_future_darwin_options="$ac_c_future_darwin_options_saved"
1600 ac_cxx_future_darwin_options="$ac_cxx_future_darwin_options_saved"
1245 if test $[ac_cv_have_decl_][$1] = yes; then 1601 if test $[ac_cv_have_decl_][$1] = yes; then
1246 [gl_cv_onwards_func_][$1]='future OS version' 1602 [gl_cv_onwards_func_][$1]='future OS version'
1247 else 1603 else
1248 [gl_cv_onwards_func_][$1]=no 1604 [gl_cv_onwards_func_][$1]=no
1249 fi 1605 fi
1606 [ac_cv_have_decl_][$1]="$[ac_cv_have_decl_][$1][_saved]"
1607 unset [ac_cv_have_decl_][$1][_saved]
1250 fi 1608 fi
1251 else 1609 else
1252 AC_CHECK_FUNC([$1]) 1610 AC_CHECK_FUNC([$1])
@@ -1299,7 +1657,7 @@ dnl
1299dnl This macro sets two variables: 1657dnl This macro sets two variables:
1300dnl - gl_cv_onwards_func_<func> to yes / no / "future OS version" 1658dnl - gl_cv_onwards_func_<func> to yes / no / "future OS version"
1301dnl - ac_cv_func_<func> to yes / no / no 1659dnl - ac_cv_func_<func> to yes / no / no
1302dnl The first variable allows to distinguish all three cases. 1660dnl The first variable allows distinguishing all three cases.
1303dnl The second variable is set, so that an invocation 1661dnl The second variable is set, so that an invocation
1304dnl gl_CHECK_FUNCS_ANDROID([func], [[#include <foo.h>]]) 1662dnl gl_CHECK_FUNCS_ANDROID([func], [[#include <foo.h>]])
1305dnl can be used as a drop-in replacement for 1663dnl can be used as a drop-in replacement for
@@ -1352,7 +1710,7 @@ dnl
1352dnl This macro sets two variables: 1710dnl This macro sets two variables:
1353dnl - gl_cv_onwards_func_<func> to yes / no / "future OS version" 1711dnl - gl_cv_onwards_func_<func> to yes / no / "future OS version"
1354dnl - ac_cv_func_<func> to yes / no / no 1712dnl - ac_cv_func_<func> to yes / no / no
1355dnl The first variable allows to distinguish all three cases. 1713dnl The first variable allows distinguishing all three cases.
1356dnl The second variable is set, so that an invocation 1714dnl The second variable is set, so that an invocation
1357dnl gl_CHECK_FUNCS_MACOS([func], [[#include <foo.h>]]) 1715dnl gl_CHECK_FUNCS_MACOS([func], [[#include <foo.h>]])
1358dnl can be used as a drop-in replacement for 1716dnl can be used as a drop-in replacement for