Merge pull request #2046 from RincewindsHat/fix/format_string
[monitoring-plugins.git] / gl / libc-config.h
blob70114608fb15aae9905f5b5f1bcff578dce0d4cb
1 /* System definitions for code taken from the GNU C Library
3 Copyright 2017-2024 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this program; if not, see
17 <https://www.gnu.org/licenses/>. */
19 /* Written by Paul Eggert. */
21 /* This is intended to be a good-enough substitute for glibc system
22 macros like those defined in <sys/cdefs.h>, so that Gnulib code
23 shared with glibc can do this as the first #include:
25 #ifndef _LIBC
26 # include <libc-config.h>
27 #endif
29 When compiled as part of glibc this is a no-op; when compiled as
30 part of Gnulib this includes Gnulib's <config.h> and defines macros
31 that glibc library code would normally assume.
33 Note: This header file MUST NOT be included by public header files
34 of Gnulib. */
36 #include <config.h>
38 /* On glibc this includes <features.h> and <sys/cdefs.h> and #defines
39 _FEATURES_H, __WORDSIZE, and __set_errno. On FreeBSD 11 and
40 DragonFlyBSD 5.9 it includes <sys/cdefs.h> which defines __nonnull.
41 Elsewhere it is harmless. */
42 #include <errno.h>
44 /* From glibc <errno.h>. */
45 #ifndef __set_errno
46 # define __set_errno(val) (errno = (val))
47 #endif
49 /* From glibc <features.h>. */
51 #ifndef __GNUC_PREREQ
52 # if defined __GNUC__ && defined __GNUC_MINOR__
53 # define __GNUC_PREREQ(maj, min) ((maj) < __GNUC__ + ((min) <= __GNUC_MINOR__))
54 # else
55 # define __GNUC_PREREQ(maj, min) 0
56 # endif
57 #endif
59 #ifndef __glibc_clang_prereq
60 # if defined __clang_major__ && defined __clang_minor__
61 # ifdef __apple_build_version__
62 /* Apple for some reason renumbers __clang_major__ and __clang_minor__.
63 Gnulib code uses only __glibc_clang_prereq (3, 5); map it to
64 6000000 <= __apple_build_version__. Support for other calls to
65 __glibc_clang_prereq can be added here as needed. */
66 # define __glibc_clang_prereq(maj, min) \
67 ((maj) == 3 && (min) == 5 ? 6000000 <= __apple_build_version__ : 0)
68 # else
69 # define __glibc_clang_prereq(maj, min) \
70 ((maj) < __clang_major__ + ((min) <= __clang_minor__))
71 # endif
72 # else
73 # define __glibc_clang_prereq(maj, min) 0
74 # endif
75 #endif
77 #ifndef __attribute_nonnull__
78 /* <sys/cdefs.h> either does not exist, or is too old for Gnulib.
79 Prepare to include <cdefs.h>, which is Gnulib's version of a
80 more-recent glibc <sys/cdefs.h>. */
82 /* Define _FEATURES_H so that <cdefs.h> does not include <features.h>. */
83 # ifndef _FEATURES_H
84 # define _FEATURES_H 1
85 # endif
86 /* Define __GNULIB_CDEFS so that <cdefs.h> does not attempt to include
87 nonexistent files. */
88 # define __GNULIB_CDEFS
89 /* Undef the macros unconditionally defined by our copy of glibc
90 <sys/cdefs.h>, so that they do not clash with any system-defined
91 versions. */
92 # undef _SYS_CDEFS_H
93 # undef __ASMNAME
94 # undef __ASMNAME2
95 # undef __BEGIN_DECLS
96 # undef __CONCAT
97 # undef __END_DECLS
98 # undef __HAVE_GENERIC_SELECTION
99 # undef __LDBL_COMPAT
100 # undef __LDBL_REDIR
101 # undef __LDBL_REDIR1
102 # undef __LDBL_REDIR1_DECL
103 # undef __LDBL_REDIR1_NTH
104 # undef __LDBL_REDIR2_DECL
105 # undef __LDBL_REDIR_DECL
106 # undef __LDBL_REDIR_NTH
107 # undef __LEAF
108 # undef __LEAF_ATTR
109 # undef __NTH
110 # undef __NTHNL
111 # undef __REDIRECT
112 # undef __REDIRECT_LDBL
113 # undef __REDIRECT_NTH
114 # undef __REDIRECT_NTHNL
115 # undef __REDIRECT_NTH_LDBL
116 # undef __STRING
117 # undef __THROW
118 # undef __THROWNL
119 # undef __attr_access
120 # undef __attr_access_none
121 # undef __attr_dealloc
122 # undef __attr_dealloc_free
123 # undef __attribute__
124 # undef __attribute_alloc_align__
125 # undef __attribute_alloc_size__
126 # undef __attribute_artificial__
127 # undef __attribute_const__
128 # undef __attribute_deprecated__
129 # undef __attribute_deprecated_msg__
130 # undef __attribute_format_arg__
131 # undef __attribute_format_strfmon__
132 # undef __attribute_malloc__
133 # undef __attribute_maybe_unused__
134 # undef __attribute_noinline__
135 # undef __attribute_nonstring__
136 # undef __attribute_pure__
137 # undef __attribute_returns_twice__
138 # undef __attribute_used__
139 # undef __attribute_warn_unused_result__
140 # undef __errordecl
141 # undef __extension__
142 # undef __extern_always_inline
143 # undef __extern_inline
144 # undef __flexarr
145 # undef __fortified_attr_access
146 # undef __fortify_function
147 # undef __glibc_c99_flexarr_available
148 # undef __glibc_has_attribute
149 # undef __glibc_has_builtin
150 # undef __glibc_has_extension
151 # undef __glibc_likely
152 # undef __glibc_macro_warning
153 # undef __glibc_macro_warning1
154 # undef __glibc_unlikely
155 # undef __inline
156 # undef __ptr_t
157 # undef __restrict
158 # undef __restrict_arr
159 # undef __va_arg_pack
160 # undef __va_arg_pack_len
161 # undef __warnattr
162 # undef __wur
163 # ifndef __GNULIB_CDEFS
164 # undef __bos
165 # undef __bos0
166 # undef __glibc_fortify
167 # undef __glibc_fortify_n
168 # undef __glibc_objsize
169 # undef __glibc_objsize0
170 # undef __glibc_safe_len_cond
171 # undef __glibc_safe_or_unknown_len
172 # undef __glibc_unsafe_len
173 # undef __glibc_unsigned_or_positive
174 # endif
176 /* Include our copy of glibc <sys/cdefs.h>. */
177 # include <cdefs.h>
179 /* <cdefs.h> __inline is too pessimistic for non-GCC. */
180 # undef __inline
181 # ifndef HAVE___INLINE
182 # if 199901 <= __STDC_VERSION__ || defined inline
183 # define __inline inline
184 # else
185 # define __inline
186 # endif
187 # endif
189 #endif /* defined __glibc_likely */
192 /* A substitute for glibc <libc-symbols.h>, good enough for Gnulib. */
193 #define attribute_hidden
194 #define libc_hidden_proto(name)
195 #define libc_hidden_def(name)
196 #define libc_hidden_weak(name)
197 #define libc_hidden_ver(local, name)
198 #define strong_alias(name, aliasname)
199 #define weak_alias(name, aliasname)
201 /* A substitute for glibc <shlib-compat.h>, good enough for Gnulib. */
202 #define SHLIB_COMPAT(lib, introduced, obsoleted) 0
203 #define compat_symbol(lib, local, symbol, version) extern int dummy
204 #define versioned_symbol(lib, local, symbol, version) extern int dummy