1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-16 19:00:55 -08:00

Update from gnulib

* cross/lib/stdalign.in.h (_GL_STDALIGN_H):
(_):
(__alignof_is_defined):
* cross/lib/vasnprintf.c:
* lib/gnulib.mk.in (ANDROID_MIN_SDK):
(HAVE_SPAWN_H):
(LIBGCCJIT_LIBS):
(NATIVE_COMPILATION_AOT):
(NEXT_AS_FIRST_DIRECTIVE_LIMITS_H):
(NEXT_LIMITS_H):
(SIZEOF_LONG):
(stdalign.h):
* ../../../../dev/null:
* lib/stdalign.in.h (_GL_STDALIGN_H):
(_):
(__alignof_is_defined):
* lib/vasnprintf.c:
* m4/gnulib-common.m4 (gl_COMMON_BODY):
* m4/stdalign.m4 (gl_ALIGNASOF):
* m4/stddef_h.m4: Update from gnulib.
This commit is contained in:
Po Lu 2023-01-28 14:33:58 +08:00
parent 8732a5bd78
commit 6f2a518f27
9 changed files with 285 additions and 3404 deletions

View file

@ -20,8 +20,22 @@
/* Define two obsolescent C11 macros, assuming alignas and alignof are
either keywords or alignasof-defined macros. */
#ifndef _GL_STDALIGN_H
#define _GL_STDALIGN_H
#ifndef _@GUARD_PREFIX@_STDALIGN_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
@PRAGMA_COLUMNS@
/* We need to include the system's <stdalign.h> when it exists, because it might
define 'alignof' as a macro when it's not a keyword or compiler built-in. */
#if @HAVE_STDALIGN_H@
/* The include_next requires a split double-inclusion guard. */
# @INCLUDE_NEXT@ @NEXT_STDALIGN_H@
#endif
#ifndef _@GUARD_PREFIX@_STDALIGN_H
#define _@GUARD_PREFIX@_STDALIGN_H
#if (defined alignas \
|| (defined __STDC_VERSION__ && 202311 <= __STDC_VERSION__) \
@ -31,4 +45,5 @@
#define __alignof_is_defined 1
#endif /* _GL_STDALIGN_H */
#endif /* _@GUARD_PREFIX@_STDALIGN_H */
#endif /* _@GUARD_PREFIX@_STDALIGN_H */

View file

@ -83,10 +83,10 @@
#include <stdio.h> /* snprintf(), sprintf() */
#include <stdlib.h> /* abort(), malloc(), realloc(), free() */
#include <string.h> /* memcpy(), strlen() */
#include <wchar.h> /* mbstate_t, mbrtowc(), mbrlen(), wcrtomb() */
#include <errno.h> /* errno */
#include <limits.h> /* CHAR_BIT */
#include <float.h> /* DBL_MAX_EXP, LDBL_MAX_EXP */
#include <wchar.h>
#if HAVE_NL_LANGINFO
# include <langinfo.h>
#endif

View file

@ -191,6 +191,7 @@ ANDROID_LIBS = @ANDROID_LIBS@
ANDROID_MIN_SDK = @ANDROID_MIN_SDK@
ANDROID_OBJ = @ANDROID_OBJ@
ANDROID_SDK_18_OR_EARLIER = @ANDROID_SDK_18_OR_EARLIER@
APKSIGNER = @APKSIGNER@
APPLE_UNIVERSAL_BUILD = @APPLE_UNIVERSAL_BUILD@
AR = @AR@
ARFLAGS = @ARFLAGS@
@ -1048,6 +1049,7 @@ HAVE_SLEEP = @HAVE_SLEEP@
HAVE_SPAWN_H = @HAVE_SPAWN_H@
HAVE_SQRTF = @HAVE_SQRTF@
HAVE_SQRTL = @HAVE_SQRTL@
HAVE_STDALIGN_H = @HAVE_STDALIGN_H@
HAVE_STDINT_H = @HAVE_STDINT_H@
HAVE_STPCPY = @HAVE_STPCPY@
HAVE_STPNCPY = @HAVE_STPNCPY@
@ -1132,6 +1134,7 @@ LIBGCCJIT_CFLAGS = @LIBGCCJIT_CFLAGS@
LIBGCCJIT_LIBS = @LIBGCCJIT_LIBS@
LIBGIF = @LIBGIF@
LIBGMP = @LIBGMP@
LIBGMP_CFLAGS = @LIBGMP_CFLAGS@
LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@
@ -1198,10 +1201,13 @@ NANOSLEEP_LIB = @NANOSLEEP_LIB@
NATIVE_COMPILATION_AOT = @NATIVE_COMPILATION_AOT@
NDK_BUILD_ABI = @NDK_BUILD_ABI@
NDK_BUILD_ANDROID_MK = @NDK_BUILD_ANDROID_MK@
NDK_BUILD_ANY_CXX_MODULE = @NDK_BUILD_ANY_CXX_MODULE@
NDK_BUILD_AR = @NDK_BUILD_AR@
NDK_BUILD_ARCH = @NDK_BUILD_ARCH@
NDK_BUILD_CC = @NDK_BUILD_CC@
NDK_BUILD_CXX_SHARED = @NDK_BUILD_CXX_SHARED@
NDK_BUILD_MODULES = @NDK_BUILD_MODULES@
NDK_BUILD_NASM = @NDK_BUILD_NASM@
NDK_BUILD_SDK = @NDK_BUILD_SDK@
NEXT_ASSERT_H = @NEXT_ASSERT_H@
NEXT_AS_FIRST_DIRECTIVE_ASSERT_H = @NEXT_AS_FIRST_DIRECTIVE_ASSERT_H@
@ -1214,6 +1220,7 @@ NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H = @NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H@
NEXT_AS_FIRST_DIRECTIVE_LIMITS_H = @NEXT_AS_FIRST_DIRECTIVE_LIMITS_H@
NEXT_AS_FIRST_DIRECTIVE_MATH_H = @NEXT_AS_FIRST_DIRECTIVE_MATH_H@
NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H = @NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H@
NEXT_AS_FIRST_DIRECTIVE_STDALIGN_H = @NEXT_AS_FIRST_DIRECTIVE_STDALIGN_H@
NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@
NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@
NEXT_AS_FIRST_DIRECTIVE_STDIO_H = @NEXT_AS_FIRST_DIRECTIVE_STDIO_H@
@ -1235,6 +1242,7 @@ NEXT_INTTYPES_H = @NEXT_INTTYPES_H@
NEXT_LIMITS_H = @NEXT_LIMITS_H@
NEXT_MATH_H = @NEXT_MATH_H@
NEXT_SIGNAL_H = @NEXT_SIGNAL_H@
NEXT_STDALIGN_H = @NEXT_STDALIGN_H@
NEXT_STDDEF_H = @NEXT_STDDEF_H@
NEXT_STDINT_H = @NEXT_STDINT_H@
NEXT_STDIO_H = @NEXT_STDIO_H@
@ -1560,6 +1568,7 @@ SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@
SIZEOF_LONG = @SIZEOF_LONG@
SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
SMALL_JA_DIC = @SMALL_JA_DIC@
SQLITE3_CFLAGS = @SQLITE3_CFLAGS@
SQLITE3_LIBS = @SQLITE3_LIBS@
STDALIGN_H = @STDALIGN_H@
STDCKDINT_H = @STDCKDINT_H@
@ -3767,7 +3776,14 @@ BUILT_SOURCES += $(STDALIGN_H)
# doesn't have one that works.
ifneq (,$(GL_GENERATE_STDALIGN_H_CONDITION))
stdalign.h: stdalign.in.h $(top_builddir)/config.status
$(gl_V_at)$(SED_HEADER_TO_AT_t) $(srcdir)/stdalign.in.h
$(gl_V_at)$(SED_HEADER_STDOUT) \
-e 's|@''GUARD_PREFIX''@|GL|g' \
-e 's|@''HAVE_STDALIGN_H''@|$(HAVE_STDALIGN_H)|g' \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STDALIGN_H''@|$(NEXT_STDALIGN_H)|g' \
$(srcdir)/stdalign.in.h > $@-t
$(AM_V_at)mv $@-t $@
else
stdalign.h: $(top_builddir)/config.status

3242
lib/math.h

File diff suppressed because it is too large Load diff

View file

@ -20,8 +20,22 @@
/* Define two obsolescent C11 macros, assuming alignas and alignof are
either keywords or alignasof-defined macros. */
#ifndef _GL_STDALIGN_H
#define _GL_STDALIGN_H
#ifndef _@GUARD_PREFIX@_STDALIGN_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
@PRAGMA_COLUMNS@
/* We need to include the system's <stdalign.h> when it exists, because it might
define 'alignof' as a macro when it's not a keyword or compiler built-in. */
#if @HAVE_STDALIGN_H@
/* The include_next requires a split double-inclusion guard. */
# @INCLUDE_NEXT@ @NEXT_STDALIGN_H@
#endif
#ifndef _@GUARD_PREFIX@_STDALIGN_H
#define _@GUARD_PREFIX@_STDALIGN_H
#if (defined alignas \
|| (defined __STDC_VERSION__ && 202311 <= __STDC_VERSION__) \
@ -31,4 +45,5 @@
#define __alignof_is_defined 1
#endif /* _GL_STDALIGN_H */
#endif /* _@GUARD_PREFIX@_STDALIGN_H */
#endif /* _@GUARD_PREFIX@_STDALIGN_H */

View file

@ -83,6 +83,7 @@
#include <stdio.h> /* snprintf(), sprintf() */
#include <stdlib.h> /* abort(), malloc(), realloc(), free() */
#include <string.h> /* memcpy(), strlen() */
#include <wchar.h> /* mbstate_t, mbrtowc(), mbrlen(), wcrtomb() */
#include <errno.h> /* errno */
#include <limits.h> /* CHAR_BIT */
#include <float.h> /* DBL_MAX_EXP, LDBL_MAX_EXP */

View file

@ -1,4 +1,4 @@
# gnulib-common.m4 serial 77
# gnulib-common.m4 serial 78
dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@ -124,36 +124,43 @@ AC_DEFUN([gl_COMMON_BODY], [
by the Nth argument of the function is the size of the returned memory block.
*/
/* Applies to: function, pointer to function, function types. */
#ifndef _GL_ATTRIBUTE_ALLOC_SIZE
# if _GL_HAS_ATTRIBUTE (alloc_size)
# define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args))
# else
# define _GL_ATTRIBUTE_ALLOC_SIZE(args)
# endif
#endif
/* _GL_ATTRIBUTE_ALWAYS_INLINE tells that the compiler should always inline the
function and report an error if it cannot do so. */
/* Applies to: function. */
#ifndef _GL_ATTRIBUTE_ALWAYS_INLINE
# if _GL_HAS_ATTRIBUTE (always_inline)
# define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__))
# else
# define _GL_ATTRIBUTE_ALWAYS_INLINE
# endif
#endif
/* _GL_ATTRIBUTE_ARTIFICIAL declares that the function is not important to show
in stack traces when debugging. The compiler should omit the function from
stack traces. */
/* Applies to: function. */
#ifndef _GL_ATTRIBUTE_ARTIFICIAL
# if _GL_HAS_ATTRIBUTE (artificial)
# define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__))
# else
# define _GL_ATTRIBUTE_ARTIFICIAL
# endif
#endif
/* _GL_ATTRIBUTE_COLD declares that the function is rarely executed. */
/* Applies to: functions. */
/* Avoid __attribute__ ((cold)) on MinGW; see thread starting at
<https://lists.gnu.org/r/emacs-devel/2019-04/msg01152.html>.
Also, Oracle Studio 12.6 requires 'cold' not '__cold__'. */
#ifndef _GL_ATTRIBUTE_COLD
# if _GL_HAS_ATTRIBUTE (cold) && !defined __MINGW32__
# ifndef __SUNPRO_C
# define _GL_ATTRIBUTE_COLD __attribute__ ((__cold__))
@ -163,6 +170,7 @@ AC_DEFUN([gl_COMMON_BODY], [
# else
# define _GL_ATTRIBUTE_COLD
# endif
#endif
/* _GL_ATTRIBUTE_CONST declares that it is OK for a compiler to omit duplicate
calls to the function with the same arguments.
@ -171,11 +179,13 @@ AC_DEFUN([gl_COMMON_BODY], [
forever, and does not call longjmp.
(This attribute is stricter than _GL_ATTRIBUTE_PURE.) */
/* Applies to: functions. */
#ifndef _GL_ATTRIBUTE_CONST
# if _GL_HAS_ATTRIBUTE (const)
# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
# else
# define _GL_ATTRIBUTE_CONST
# endif
#endif
/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
that can be freed by passing them as the Ith argument to the
@ -183,11 +193,13 @@ AC_DEFUN([gl_COMMON_BODY], [
_GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that
can be freed via 'free'; it can be used only after declaring 'free'. */
/* Applies to: functions. Cannot be used on inline functions. */
#ifndef _GL_ATTRIBUTE_DEALLOC
# if _GL_GNUC_PREREQ (11, 0)
# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
# else
# define _GL_ATTRIBUTE_DEALLOC(f, i)
# endif
#endif
/* If gnulib's <string.h> or <wchar.h> has already defined this macro, continue
to use this earlier definition, since <stdlib.h> may not have been included
yet. */
@ -210,6 +222,7 @@ AC_DEFUN([gl_COMMON_BODY], [
- enumeration, enumeration item,
- typedef,
in C++ also: namespace, class, template specialization. */
#ifndef _GL_ATTRIBUTE_DEPRECATED
# ifdef __has_c_attribute
# if __has_c_attribute (__deprecated__)
# define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]]
@ -221,12 +234,14 @@ AC_DEFUN([gl_COMMON_BODY], [
# ifndef _GL_ATTRIBUTE_DEPRECATED
# define _GL_ATTRIBUTE_DEPRECATED
# endif
#endif
/* _GL_ATTRIBUTE_ERROR(msg) requests an error if a function is called and
the function call is not optimized away.
_GL_ATTRIBUTE_WARNING(msg) requests a warning if a function is called and
the function call is not optimized away. */
/* Applies to: functions. */
#if !(defined _GL_ATTRIBUTE_ERROR && defined _GL_ATTRIBUTE_WARNING)
# if _GL_HAS_ATTRIBUTE (error)
# define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__error__ (msg)))
# define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__warning__ (msg)))
@ -237,21 +252,25 @@ AC_DEFUN([gl_COMMON_BODY], [
# define _GL_ATTRIBUTE_ERROR(msg)
# define _GL_ATTRIBUTE_WARNING(msg)
# endif
#endif
/* _GL_ATTRIBUTE_EXTERNALLY_VISIBLE declares that the entity should remain
visible to debuggers etc., even with '-fwhole-program'. */
/* Applies to: functions, variables. */
#ifndef _GL_ATTRIBUTE_EXTERNALLY_VISIBLE
# if _GL_HAS_ATTRIBUTE (externally_visible)
# define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE __attribute__ ((externally_visible))
# else
# define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE
# endif
#endif
/* _GL_ATTRIBUTE_FALLTHROUGH declares that it is not a programming mistake if
the control flow falls through to the immediately following 'case' or
'default' label. The compiler should not warn in this case. */
/* Applies to: Empty statement (;), inside a 'switch' statement. */
/* Always expands to something. */
#ifndef _GL_ATTRIBUTE_FALLTHROUGH
# ifdef __has_c_attribute
# if __has_c_attribute (__fallthrough__)
# define _GL_ATTRIBUTE_FALLTHROUGH [[__fallthrough__]]
@ -263,6 +282,7 @@ AC_DEFUN([gl_COMMON_BODY], [
# ifndef _GL_ATTRIBUTE_FALLTHROUGH
# define _GL_ATTRIBUTE_FALLTHROUGH ((void) 0)
# endif
#endif
/* _GL_ATTRIBUTE_FORMAT ((ARCHETYPE, STRING-INDEX, FIRST-TO-CHECK))
declares that the STRING-INDEXth function argument is a format string of
@ -275,42 +295,50 @@ AC_DEFUN([gl_COMMON_BODY], [
If FIRST-TO-CHECK is not 0, arguments starting at FIRST-TO_CHECK
are suitable for the format string. */
/* Applies to: functions. */
#ifndef _GL_ATTRIBUTE_FORMAT
# if _GL_HAS_ATTRIBUTE (format)
# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
# else
# define _GL_ATTRIBUTE_FORMAT(spec)
# endif
#endif
/* _GL_ATTRIBUTE_LEAF declares that if the function is called from some other
compilation unit, it executes code from that unit only by return or by
exception handling. This declaration lets the compiler optimize that unit
more aggressively. */
/* Applies to: functions. */
#ifndef _GL_ATTRIBUTE_LEAF
# if _GL_HAS_ATTRIBUTE (leaf)
# define _GL_ATTRIBUTE_LEAF __attribute__ ((__leaf__))
# else
# define _GL_ATTRIBUTE_LEAF
# endif
#endif
/* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
allocated memory. */
/* Applies to: functions. */
#ifndef _GL_ATTRIBUTE_MALLOC
# if _GL_HAS_ATTRIBUTE (malloc)
# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
# else
# define _GL_ATTRIBUTE_MALLOC
# endif
#endif
/* _GL_ATTRIBUTE_MAY_ALIAS declares that pointers to the type may point to the
same storage as pointers to other types. Thus this declaration disables
strict aliasing optimization. */
/* Applies to: types. */
/* Oracle Studio 12.6 mishandles may_alias despite __has_attribute OK. */
#ifndef _GL_ATTRIBUTE_MAY_ALIAS
# if _GL_HAS_ATTRIBUTE (may_alias) && !defined __SUNPRO_C
# define _GL_ATTRIBUTE_MAY_ALIAS __attribute__ ((__may_alias__))
# else
# define _GL_ATTRIBUTE_MAY_ALIAS
# endif
#endif
/* _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
@ -324,6 +352,7 @@ AC_DEFUN([gl_COMMON_BODY], [
/* In C++ and C23, this is spelled [[__maybe_unused__]].
GCC's syntax is __attribute__ ((__unused__)).
clang supports both syntaxes. */
#ifndef _GL_ATTRIBUTE_MAYBE_UNUSED
# ifdef __has_c_attribute
# if __has_c_attribute (__maybe_unused__)
# define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]]
@ -332,6 +361,7 @@ AC_DEFUN([gl_COMMON_BODY], [
# ifndef _GL_ATTRIBUTE_MAYBE_UNUSED
# define _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_UNUSED
# endif
#endif
/* Alternative spelling of this macro, for convenience and for
compatibility with glibc/include/libc-symbols.h. */
#define _GL_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED
@ -342,6 +372,7 @@ AC_DEFUN([gl_COMMON_BODY], [
discard the return value. The compiler may warn if the caller does not use
the return value, unless the caller uses something like ignore_value. */
/* Applies to: function, enumeration, class. */
#ifndef _GL_ATTRIBUTE_NODISCARD
# ifdef __has_c_attribute
# if __has_c_attribute (__nodiscard__)
# define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]]
@ -353,47 +384,56 @@ AC_DEFUN([gl_COMMON_BODY], [
# ifndef _GL_ATTRIBUTE_NODISCARD
# define _GL_ATTRIBUTE_NODISCARD
# endif
#endif
/* _GL_ATTRIBUTE_NOINLINE tells that the compiler should not inline the
function. */
/* Applies to: functions. */
#ifndef _GL_ATTRIBUTE_NOINLINE
# if _GL_HAS_ATTRIBUTE (noinline)
# define _GL_ATTRIBUTE_NOINLINE __attribute__ ((__noinline__))
# else
# define _GL_ATTRIBUTE_NOINLINE
# endif
#endif
/* _GL_ATTRIBUTE_NONNULL ((N1, N2,...)) declares that the arguments N1, N2,...
must not be NULL.
_GL_ATTRIBUTE_NONNULL () declares that all pointer arguments must not be
null. */
/* Applies to: functions. */
#ifndef _GL_ATTRIBUTE_NONNULL
# if _GL_HAS_ATTRIBUTE (nonnull)
# define _GL_ATTRIBUTE_NONNULL(args) __attribute__ ((__nonnull__ args))
# else
# define _GL_ATTRIBUTE_NONNULL(args)
# endif
#endif
/* _GL_ATTRIBUTE_NONSTRING declares that the contents of a character array is
not meant to be NUL-terminated. */
/* Applies to: struct/union members and variables that are arrays of element
type '[[un]signed] char'. */
#ifndef _GL_ATTRIBUTE_NONSTRING
# if _GL_HAS_ATTRIBUTE (nonstring)
# define _GL_ATTRIBUTE_NONSTRING __attribute__ ((__nonstring__))
# else
# define _GL_ATTRIBUTE_NONSTRING
# endif
#endif
/* There is no _GL_ATTRIBUTE_NORETURN; use _Noreturn instead. */
/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions.
*/
/* Applies to: functions. */
#ifndef _GL_ATTRIBUTE_NOTHROW
# if _GL_HAS_ATTRIBUTE (nothrow) && !defined __cplusplus
# define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__))
# else
# define _GL_ATTRIBUTE_NOTHROW
# endif
#endif
/* _GL_ATTRIBUTE_PACKED declares:
For struct members: The member has the smallest possible alignment.
@ -401,11 +441,13 @@ AC_DEFUN([gl_COMMON_BODY], [
minimizing the memory required. */
/* Applies to: struct members, struct, union,
in C++ also: class. */
#ifndef _GL_ATTRIBUTE_PACKED
# if _GL_HAS_ATTRIBUTE (packed)
# define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__))
# else
# define _GL_ATTRIBUTE_PACKED
# endif
#endif
/* _GL_ATTRIBUTE_PURE declares that It is OK for a compiler to omit duplicate
calls to the function with the same arguments if observable state is not
@ -414,38 +456,46 @@ AC_DEFUN([gl_COMMON_BODY], [
observable state, and always returns exactly once.
(This attribute is looser than _GL_ATTRIBUTE_CONST.) */
/* Applies to: functions. */
#ifndef _GL_ATTRIBUTE_PURE
# if _GL_HAS_ATTRIBUTE (pure)
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
# else
# define _GL_ATTRIBUTE_PURE
# endif
#endif
/* _GL_ATTRIBUTE_RETURNS_NONNULL declares that the function's return value is
a non-NULL pointer. */
/* Applies to: functions. */
#ifndef _GL_ATTRIBUTE_RETURNS_NONNULL
# if _GL_HAS_ATTRIBUTE (returns_nonnull)
# define _GL_ATTRIBUTE_RETURNS_NONNULL __attribute__ ((__returns_nonnull__))
# else
# define _GL_ATTRIBUTE_RETURNS_NONNULL
# endif
#endif
/* _GL_ATTRIBUTE_SENTINEL(pos) declares that the variadic function expects a
trailing NULL argument.
_GL_ATTRIBUTE_SENTINEL () - The last argument is NULL (requires C99).
_GL_ATTRIBUTE_SENTINEL ((N)) - The (N+1)st argument from the end is NULL. */
/* Applies to: functions. */
#ifndef _GL_ATTRIBUTE_SENTINEL
# if _GL_HAS_ATTRIBUTE (sentinel)
# define _GL_ATTRIBUTE_SENTINEL(pos) __attribute__ ((__sentinel__ pos))
# else
# define _GL_ATTRIBUTE_SENTINEL(pos)
# endif
#endif
/* A helper macro. Don't use it directly. */
#ifndef _GL_ATTRIBUTE_UNUSED
# if _GL_HAS_ATTRIBUTE (unused)
# define _GL_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
# else
# define _GL_ATTRIBUTE_UNUSED
# endif
#endif
]dnl There is no _GL_ATTRIBUTE_VISIBILITY; see m4/visibility.m4 instead.
[
@ -455,11 +505,13 @@ AC_DEFUN([gl_COMMON_BODY], [
/* Applies to: label (both in C and C++). */
/* Note that g++ < 4.5 does not support the '__attribute__ ((__unused__)) ;'
syntax. But clang does. */
#ifndef _GL_UNUSED_LABEL
# if !(defined __cplusplus && !_GL_GNUC_PREREQ (4, 5)) || defined __clang__
# define _GL_UNUSED_LABEL _GL_ATTRIBUTE_UNUSED
# else
# define _GL_UNUSED_LABEL
# endif
#endif
])
AH_VERBATIM([async_safe],
[/* The _GL_ASYNC_SAFE marker should be attached to functions that are

View file

@ -71,7 +71,8 @@ AC_DEFUN([gl_ALIGNASOF],
[#if !defined HAVE_C_ALIGNASOF && __cplusplus < 201103 && !defined alignof
# if HAVE_STDALIGN_H
# include <stdalign.h>
# else
# endif
/* ISO C23 alignas and alignof for platforms that lack it.
References:
@ -103,6 +104,7 @@ AC_DEFUN([gl_ALIGNASOF],
|| (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \
&& !defined __clang__) \
|| (defined __clang__ && __clang_major__ < 8))
# undef/**/_Alignof
# ifdef __cplusplus
# if (201103 <= __cplusplus || defined _MSC_VER)
# define _Alignof(type) alignof (type)
@ -112,11 +114,16 @@ AC_DEFUN([gl_ALIGNASOF],
# define _GL_STDALIGN_NEEDS_STDDEF 1
# endif
# else
# if (defined __GNUC__ && 4 <= __GNUC__) || defined __clang__
# define _Alignof(type) __builtin_offsetof (struct { char __a; type __b; }, __b)
# else
# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b)
# define _GL_STDALIGN_NEEDS_STDDEF 1
# endif
# endif
# endif
# if ! (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER))
# undef/**/alignof
# define alignof _Alignof
# endif
@ -144,6 +151,7 @@ AC_DEFUN([gl_ALIGNASOF],
- alignas (TYPE) is equivalent to alignas (alignof (TYPE)).
*/
# if !HAVE_STDALIGN_H
# if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112
# if defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER)
# define _Alignas(a) alignas (a)
@ -165,19 +173,28 @@ AC_DEFUN([gl_ALIGNASOF],
|| (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__))
# define alignas _Alignas
# endif
# endif
# if _GL_STDALIGN_NEEDS_STDDEF
# include <stddef.h>
# endif
# endif
#endif])
])
AC_DEFUN([gl_STDALIGN_H],
[
AC_REQUIRE([gl_ALIGNASOF])
if test "$gl_cv_header_working_stdalign_h" = no; then
GL_GENERATE_STDALIGN_H=true
else
GL_GENERATE_STDALIGN_H=false
AS_IF([test "$gl_cv_header_working_stdalign_h" = no],
[GL_GENERATE_STDALIGN_H=true])
fi
AC_CHECK_HEADERS_ONCE([stdalign.h])
gl_CHECK_NEXT_HEADERS([stdalign.h])
if test $ac_cv_header_stdalign_h = yes; then
HAVE_STDALIGN_H=1
else
HAVE_STDALIGN_H=0
fi
AC_SUBST([HAVE_STDALIGN_H])
])

View file

@ -1,4 +1,4 @@
# stddef_h.m4 serial 12
# stddef_h.m4 serial 13
dnl Copyright (C) 2009-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@ -22,7 +22,14 @@ AC_DEFUN_ONCE([gl_STDDEF_H],
[gl_cv_type_max_align_t],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <stddef.h>
[[/* On FreeBSD 12.0/x86, max_align_t defined by <stddef.h> has
the correct alignment with the default (wrong) definition of
_Alignof, but a wrong alignment as soon as we activate an
ISO C compliant _Alignof definition. */
#if ((defined __GNUC__ && 4 <= __GNUC__) || defined __clang__) && !defined __cplusplus
#define _Alignof(type) __builtin_offsetof (struct { char __a; type __b; }, __b)
#endif
#include <stddef.h>
unsigned int s = sizeof (max_align_t);
#if defined __GNUC__ || defined __clang__ || defined __IBM__ALIGNOF__
int check1[2 * (__alignof__ (double) <= __alignof__ (max_align_t)) - 1];