summaryrefslogtreecommitdiffstats
path: root/gl/stddef.in.h
diff options
context:
space:
mode:
authorRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2021-11-17 01:05:54 +0100
committerRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2022-07-24 19:35:11 +0200
commita405fc138596f552581d2011fd6de02d5c8186c4 (patch)
tree4c084700b5cb5e9fcedf982a2d921bbc41d9935a /gl/stddef.in.h
parent9f2a9ca3d72023ff9b5707d1872c54d65edc9017 (diff)
downloadmonitoring-plugins-a405fc138596f552581d2011fd6de02d5c8186c4.tar.gz
Sync with the latest Gnulib code (1a268176f)
Diffstat (limited to 'gl/stddef.in.h')
-rw-r--r--gl/stddef.in.h111
1 files changed, 86 insertions, 25 deletions
diff --git a/gl/stddef.in.h b/gl/stddef.in.h
index 40f0536a..42290d44 100644
--- a/gl/stddef.in.h
+++ b/gl/stddef.in.h
@@ -1,25 +1,25 @@
1/* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues. 1/* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
2 2
3 Copyright (C) 2009-2013 Free Software Foundation, Inc. 3 Copyright (C) 2009-2021 Free Software Foundation, Inc.
4 4
5 This program is free software; you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU Lesser General Public License as
7 the Free Software Foundation; either version 3, or (at your option) 7 published by the Free Software Foundation; either version 2.1 of the
8 any later version. 8 License, or (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU Lesser General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU Lesser General Public License
16 along with this program; if not, see <http://www.gnu.org/licenses/>. */ 16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17 17
18/* Written by Eric Blake. */ 18/* Written by Eric Blake. */
19 19
20/* 20/*
21 * POSIX 2008 <stddef.h> for platforms that have issues. 21 * POSIX 2008 <stddef.h> for platforms that have issues.
22 * <http://www.opengroup.org/susv3xbd/stddef.h.html> 22 * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stddef.h.html>
23 */ 23 */
24 24
25#if __GNUC__ >= 3 25#if __GNUC__ >= 3
@@ -39,10 +39,16 @@
39 39
40# if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _GL_STDDEF_WINT_T) 40# if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _GL_STDDEF_WINT_T)
41# ifdef __need_wint_t 41# ifdef __need_wint_t
42# undef _@GUARD_PREFIX@_STDDEF_H
43# define _GL_STDDEF_WINT_T 42# define _GL_STDDEF_WINT_T
44# endif 43# endif
45# @INCLUDE_NEXT@ @NEXT_STDDEF_H@ 44# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
45 /* On TinyCC, make sure that the macros that indicate the special invocation
46 convention get undefined. */
47# undef __need_wchar_t
48# undef __need_size_t
49# undef __need_ptrdiff_t
50# undef __need_NULL
51# undef __need_wint_t
46# endif 52# endif
47 53
48#else 54#else
@@ -50,37 +56,92 @@
50 56
51# ifndef _@GUARD_PREFIX@_STDDEF_H 57# ifndef _@GUARD_PREFIX@_STDDEF_H
52 58
59/* On AIX 7.2, with xlc in 64-bit mode, <stddef.h> defines max_align_t to a
60 type with alignment 4, but 'long' has alignment 8. */
61# if defined _AIX && defined __LP64__
62# if !GNULIB_defined_max_align_t
63# ifdef _MAX_ALIGN_T
64/* /usr/include/stddef.h has already defined max_align_t. Override it. */
65typedef long rpl_max_align_t;
66# define max_align_t rpl_max_align_t
67# else
68/* Prevent /usr/include/stddef.h from defining max_align_t. */
69typedef long max_align_t;
70# define _MAX_ALIGN_T
71# endif
72# define GNULIB_defined_max_align_t 1
73# endif
74# endif
75
53/* The include_next requires a split double-inclusion guard. */ 76/* The include_next requires a split double-inclusion guard. */
54 77
55# @INCLUDE_NEXT@ @NEXT_STDDEF_H@ 78# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
56 79
57# ifndef _@GUARD_PREFIX@_STDDEF_H
58# define _@GUARD_PREFIX@_STDDEF_H
59
60/* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */ 80/* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */
61#if @REPLACE_NULL@ 81# if (@REPLACE_NULL@ \
62# undef NULL 82 && (!defined _@GUARD_PREFIX@_STDDEF_H || defined _GL_STDDEF_WINT_T))
63# ifdef __cplusplus 83# undef NULL
84# ifdef __cplusplus
64 /* ISO C++ says that the macro NULL must expand to an integer constant 85 /* ISO C++ says that the macro NULL must expand to an integer constant
65 expression, hence '((void *) 0)' is not allowed in C++. */ 86 expression, hence '((void *) 0)' is not allowed in C++. */
66# if __GNUG__ >= 3 87# if __GNUG__ >= 3
67 /* GNU C++ has a __null macro that behaves like an integer ('int' or 88 /* GNU C++ has a __null macro that behaves like an integer ('int' or
68 'long') but has the same size as a pointer. Use that, to avoid 89 'long') but has the same size as a pointer. Use that, to avoid
69 warnings. */ 90 warnings. */
70# define NULL __null 91# define NULL __null
71# else 92# else
72# define NULL 0L 93# define NULL 0L
94# endif
95# else
96# define NULL ((void *) 0)
97# endif
73# endif 98# endif
74# else 99
75# define NULL ((void *) 0) 100# ifndef _@GUARD_PREFIX@_STDDEF_H
76# endif 101# define _@GUARD_PREFIX@_STDDEF_H
77#endif
78 102
79/* Some platforms lack wchar_t. */ 103/* Some platforms lack wchar_t. */
80#if !@HAVE_WCHAR_T@ 104#if !@HAVE_WCHAR_T@
81# define wchar_t int 105# define wchar_t int
82#endif 106#endif
83 107
108/* Some platforms lack max_align_t. The check for _GCC_MAX_ALIGN_T is
109 a hack in case the configure-time test was done with g++ even though
110 we are currently compiling with gcc.
111 On MSVC, max_align_t is defined only in C++ mode, after <cstddef> was
112 included. Its definition is good since it has an alignment of 8 (on x86
113 and x86_64).
114 Similarly on OS/2 kLIBC. */
115#if (defined _MSC_VER || (defined __KLIBC__ && !defined __LIBCN__)) \
116 && defined __cplusplus
117# include <cstddef>
118#else
119# if ! (@HAVE_MAX_ALIGN_T@ || (defined _GCC_MAX_ALIGN_T && !defined __clang__))
120# if !GNULIB_defined_max_align_t
121/* On the x86, the maximum storage alignment of double, long, etc. is 4,
122 but GCC's C11 ABI for x86 says that max_align_t has an alignment of 8,
123 and the C11 standard allows this. Work around this problem by
124 using __alignof__ (which returns 8 for double) rather than _Alignof
125 (which returns 4), and align each union member accordingly. */
126# if defined __GNUC__ || (__clang_major__ >= 4)
127# define _GL_STDDEF_ALIGNAS(type) \
128 __attribute__ ((__aligned__ (__alignof__ (type))))
129# else
130# define _GL_STDDEF_ALIGNAS(type) /* */
131# endif
132typedef union
133{
134 char *__p _GL_STDDEF_ALIGNAS (char *);
135 double __d _GL_STDDEF_ALIGNAS (double);
136 long double __ld _GL_STDDEF_ALIGNAS (long double);
137 long int __i _GL_STDDEF_ALIGNAS (long int);
138} rpl_max_align_t;
139# define max_align_t rpl_max_align_t
140# define GNULIB_defined_max_align_t 1
141# endif
142# endif
143#endif
144
84# endif /* _@GUARD_PREFIX@_STDDEF_H */ 145# endif /* _@GUARD_PREFIX@_STDDEF_H */
85# endif /* _@GUARD_PREFIX@_STDDEF_H */ 146# endif /* _@GUARD_PREFIX@_STDDEF_H */
86#endif /* __need_XXX */ 147#endif /* __need_XXX */