af_alg: Improve comments.
[gnulib.git] / lib / libc-config.h
blob747d6206b5409d3dc3f004ebd775984cbae0d08e
1 /* System definitions for code taken from the GNU C Library
3 Copyright 2017-2018 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 #include <config.h>
35 /* On glibc this includes <features.h> and <sys/cdefs.h> and #defines
36 _FEATURES_H, __WORDSIZE, and __set_errno. On other platforms this
37 is harmless. */
38 #include <errno.h>
40 /* From glibc <errno.h>. */
41 #ifndef __set_errno
42 # define __set_errno(val) (errno = (val))
43 #endif
45 /* From glibc <features.h>. */
47 #ifndef __GNUC_PREREQ
48 # if defined __GNUC__ && defined __GNUC_MINOR__
49 # define __GNUC_PREREQ(maj, min) ((maj) < __GNUC__ + ((min) <= __GNUC_MINOR__))
50 # else
51 # define __GNUC_PREREQ(maj, min) 0
52 # endif
53 #endif
55 #ifndef __glibc_clang_prereq
56 # if defined __clang_major__ && defined __clang_minor__
57 # define __glibc_clang_prereq(maj, min) \
58 ((maj) < __clang_major__ + ((min) <= __clang_minor__))
59 # else
60 # define __glibc_clang_prereq(maj, min) 0
61 # endif
62 #endif
65 /* Prepare to include <cdefs.h>, which is our copy of glibc
66 <sys/cdefs.h>. */
68 /* Define _FEATURES_H so that <cdefs.h> does not include <features.h>. */
69 #ifndef _FEATURES_H
70 # define _FEATURES_H 1
71 #endif
72 /* Define __WORDSIZE so that <cdefs.h> does not attempt to include
73 nonexistent files. Make it a syntax error, since Gnulib does not
74 use __WORDSIZE now, and if Gnulib uses it later the syntax error
75 will let us know that __WORDSIZE needs configuring. */
76 #ifndef __WORDSIZE
77 # define __WORDSIZE %%%
78 #endif
79 /* Undef the macros unconditionally defined by our copy of glibc
80 <sys/cdefs.h>, so that they do not clash with any system-defined
81 versions. */
82 #undef _SYS_CDEFS_H
83 #undef __ASMNAME
84 #undef __ASMNAME2
85 #undef __BEGIN_DECLS
86 #undef __CONCAT
87 #undef __END_DECLS
88 #undef __HAVE_GENERIC_SELECTION
89 #undef __LDBL_COMPAT
90 #undef __LDBL_REDIR
91 #undef __LDBL_REDIR1
92 #undef __LDBL_REDIR1_DECL
93 #undef __LDBL_REDIR1_NTH
94 #undef __LDBL_REDIR_DECL
95 #undef __LDBL_REDIR_NTH
96 #undef __LEAF
97 #undef __LEAF_ATTR
98 #undef __NTH
99 #undef __NTHNL
100 #undef __P
101 #undef __PMT
102 #undef __REDIRECT
103 #undef __REDIRECT_LDBL
104 #undef __REDIRECT_NTH
105 #undef __REDIRECT_NTHNL
106 #undef __REDIRECT_NTH_LDBL
107 #undef __STRING
108 #undef __THROW
109 #undef __THROWNL
110 #undef __always_inline
111 #undef __attribute__
112 #undef __attribute_alloc_size__
113 #undef __attribute_artificial__
114 #undef __attribute_const__
115 #undef __attribute_deprecated__
116 #undef __attribute_deprecated_msg__
117 #undef __attribute_format_arg__
118 #undef __attribute_format_strfmon__
119 #undef __attribute_malloc__
120 #undef __attribute_noinline__
121 #undef __attribute_pure__
122 #undef __attribute_used__
123 #undef __attribute_warn_unused_result__
124 #undef __bos
125 #undef __bos0
126 #undef __errordecl
127 #undef __extension__
128 #undef __extern_always_inline
129 #undef __extern_inline
130 #undef __flexarr
131 #undef __fortify_function
132 #undef __glibc_c99_flexarr_available
133 #undef __glibc_clang_has_extension
134 #undef __glibc_likely
135 #undef __glibc_macro_warning
136 #undef __glibc_macro_warning1
137 #undef __glibc_unlikely
138 #undef __inline
139 #undef __nonnull
140 #undef __ptr_t
141 #undef __restrict
142 #undef __restrict_arr
143 #undef __va_arg_pack
144 #undef __va_arg_pack_len
145 #undef __warnattr
146 #undef __warndecl
148 /* Include our copy of glibc <sys/cdefs.h>. */
149 #include <cdefs.h>
151 /* <cdefs.h> __inline is too pessimistic for non-GCC. */
152 #undef __inline
153 #ifndef HAVE___INLINE
154 # if 199901 <= __STDC_VERSION__ || defined inline
155 # define __inline inline
156 # else
157 # define __inline
158 # endif
159 #endif
161 /* <cdefs.h> __restrict is too pessimistic for non-GCC. GCC 2.95 and
162 later have "__restrict", and C99 compilers have "restrict". */
163 #undef __restrict
164 #if !__GNUC_PREREQ (2, 95)
165 # if 199901L <= __STDC_VERSION__
166 # define __restrict restrict
167 # else
168 # define __restrict
169 # endif
170 #endif
173 /* A substitute for glibc <libc-symbols.h>, good enough for Gnulib. */
174 #define attribute_hidden
175 #define libc_hidden_proto(name, ...)
176 #define libc_hidden_def(name)
177 #define libc_hidden_weak(name)
178 #define libc_hidden_ver(local, name)
179 #define strong_alias(name, aliasname)
180 #define weak_alias(name, aliasname)
182 /* A substitute for glibc <shlib-compat.h>, good enough for Gnulib. */
183 #define SHLIB_COMPAT(lib, introduced, obsoleted) 0
184 #define versioned_symbol(lib, local, symbol, version)