diff options
Diffstat (limited to 'gl/sched.h')
| -rw-r--r-- | gl/sched.h | 631 |
1 files changed, 631 insertions, 0 deletions
diff --git a/gl/sched.h b/gl/sched.h new file mode 100644 index 00000000..4d9d546d --- /dev/null +++ b/gl/sched.h | |||
| @@ -0,0 +1,631 @@ | |||
| 1 | /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ | ||
| 2 | /* A GNU-like <sched.h>. | ||
| 3 | Copyright (C) 2008-2025 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | This file is free software: you can redistribute it and/or modify | ||
| 6 | it under the terms of the GNU Lesser General Public License as | ||
| 7 | published by the Free Software Foundation; either version 2.1 of the | ||
| 8 | License, or (at your option) any later version. | ||
| 9 | |||
| 10 | This file 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 | ||
| 13 | GNU Lesser General Public License for more details. | ||
| 14 | |||
| 15 | You should have received a copy of the GNU Lesser General Public License | ||
| 16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | ||
| 17 | |||
| 18 | #ifndef _GL_SCHED_H | ||
| 19 | |||
| 20 | #if __GNUC__ >= 3 | ||
| 21 | #pragma GCC system_header | ||
| 22 | #endif | ||
| 23 | |||
| 24 | |||
| 25 | /* This file uses #include_next of a system file that defines time_t. | ||
| 26 | For the 'year2038' module to work right, <config.h> needs to have been | ||
| 27 | included before. */ | ||
| 28 | #if !_GL_CONFIG_H_INCLUDED | ||
| 29 | #error "Please include config.h first." | ||
| 30 | #endif | ||
| 31 | |||
| 32 | /* The include_next requires a split double-inclusion guard. */ | ||
| 33 | #if 1 | ||
| 34 | # if 1 | ||
| 35 | # include <sys/cdefs.h> | ||
| 36 | # endif | ||
| 37 | # include_next <sched.h> | ||
| 38 | #endif | ||
| 39 | |||
| 40 | #ifndef _GL_SCHED_H | ||
| 41 | #define _GL_SCHED_H | ||
| 42 | |||
| 43 | /* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ | ||
| 44 | #if !_GL_CONFIG_H_INCLUDED | ||
| 45 | #error "Please include config.h first." | ||
| 46 | #endif | ||
| 47 | |||
| 48 | /* Get pid_t. | ||
| 49 | This is needed on glibc 2.11 (see | ||
| 50 | glibc bug <https://sourceware.org/PR13198>) | ||
| 51 | and Mac OS X 10.5. */ | ||
| 52 | #include <sys/types.h> | ||
| 53 | |||
| 54 | #ifdef __KLIBC__ | ||
| 55 | /* On OS/2 kLIBC, struct sched_param is in spawn.h. */ | ||
| 56 | # include <spawn.h> | ||
| 57 | #endif | ||
| 58 | |||
| 59 | #ifdef __VMS | ||
| 60 | /* On OpenVMS, struct sched_param is in <pthread.h>. */ | ||
| 61 | # include <pthread.h> | ||
| 62 | #endif | ||
| 63 | |||
| 64 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ | ||
| 65 | /* C++ compatible function declaration macros. | ||
| 66 | Copyright (C) 2010-2025 Free Software Foundation, Inc. | ||
| 67 | |||
| 68 | This program is free software: you can redistribute it and/or modify it | ||
| 69 | under the terms of the GNU Lesser General Public License as published | ||
| 70 | by the Free Software Foundation; either version 2 of the License, or | ||
| 71 | (at your option) any later version. | ||
| 72 | |||
| 73 | This program is distributed in the hope that it will be useful, | ||
| 74 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 75 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 76 | Lesser General Public License for more details. | ||
| 77 | |||
| 78 | You should have received a copy of the GNU Lesser General Public License | ||
| 79 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | ||
| 80 | |||
| 81 | #ifndef _GL_CXXDEFS_H | ||
| 82 | #define _GL_CXXDEFS_H | ||
| 83 | |||
| 84 | /* Begin/end the GNULIB_NAMESPACE namespace. */ | ||
| 85 | #if defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 86 | # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { | ||
| 87 | # define _GL_END_NAMESPACE } | ||
| 88 | #else | ||
| 89 | # define _GL_BEGIN_NAMESPACE | ||
| 90 | # define _GL_END_NAMESPACE | ||
| 91 | #endif | ||
| 92 | |||
| 93 | /* The three most frequent use cases of these macros are: | ||
| 94 | |||
| 95 | * For providing a substitute for a function that is missing on some | ||
| 96 | platforms, but is declared and works fine on the platforms on which | ||
| 97 | it exists: | ||
| 98 | |||
| 99 | #if @GNULIB_FOO@ | ||
| 100 | # if !@HAVE_FOO@ | ||
| 101 | _GL_FUNCDECL_SYS (foo, ...); | ||
| 102 | # endif | ||
| 103 | _GL_CXXALIAS_SYS (foo, ...); | ||
| 104 | _GL_CXXALIASWARN (foo); | ||
| 105 | #elif defined GNULIB_POSIXCHECK | ||
| 106 | ... | ||
| 107 | #endif | ||
| 108 | |||
| 109 | * For providing a replacement for a function that exists on all platforms, | ||
| 110 | but is broken/insufficient and needs to be replaced on some platforms: | ||
| 111 | |||
| 112 | #if @GNULIB_FOO@ | ||
| 113 | # if @REPLACE_FOO@ | ||
| 114 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 115 | # undef foo | ||
| 116 | # define foo rpl_foo | ||
| 117 | # endif | ||
| 118 | _GL_FUNCDECL_RPL (foo, ...); | ||
| 119 | _GL_CXXALIAS_RPL (foo, ...); | ||
| 120 | # else | ||
| 121 | _GL_CXXALIAS_SYS (foo, ...); | ||
| 122 | # endif | ||
| 123 | _GL_CXXALIASWARN (foo); | ||
| 124 | #elif defined GNULIB_POSIXCHECK | ||
| 125 | ... | ||
| 126 | #endif | ||
| 127 | |||
| 128 | * For providing a replacement for a function that exists on some platforms | ||
| 129 | but is broken/insufficient and needs to be replaced on some of them and | ||
| 130 | is additionally either missing or undeclared on some other platforms: | ||
| 131 | |||
| 132 | #if @GNULIB_FOO@ | ||
| 133 | # if @REPLACE_FOO@ | ||
| 134 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 135 | # undef foo | ||
| 136 | # define foo rpl_foo | ||
| 137 | # endif | ||
| 138 | _GL_FUNCDECL_RPL (foo, ...); | ||
| 139 | _GL_CXXALIAS_RPL (foo, ...); | ||
| 140 | # else | ||
| 141 | # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ | ||
| 142 | _GL_FUNCDECL_SYS (foo, ...); | ||
| 143 | # endif | ||
| 144 | _GL_CXXALIAS_SYS (foo, ...); | ||
| 145 | # endif | ||
| 146 | _GL_CXXALIASWARN (foo); | ||
| 147 | #elif defined GNULIB_POSIXCHECK | ||
| 148 | ... | ||
| 149 | #endif | ||
| 150 | */ | ||
| 151 | |||
| 152 | /* _GL_EXTERN_C declaration; | ||
| 153 | performs the declaration with C linkage. */ | ||
| 154 | #if defined __cplusplus | ||
| 155 | # define _GL_EXTERN_C extern "C" | ||
| 156 | #else | ||
| 157 | # define _GL_EXTERN_C extern | ||
| 158 | #endif | ||
| 159 | |||
| 160 | /* _GL_EXTERN_C_FUNC declaration; | ||
| 161 | performs the declaration of a function with C linkage. */ | ||
| 162 | #if defined __cplusplus | ||
| 163 | # define _GL_EXTERN_C_FUNC extern "C" | ||
| 164 | #else | ||
| 165 | /* In C mode, omit the 'extern' keyword, because attributes in bracket syntax | ||
| 166 | are not allowed between 'extern' and the return type (see gnulib-common.m4). | ||
| 167 | */ | ||
| 168 | # define _GL_EXTERN_C_FUNC | ||
| 169 | #endif | ||
| 170 | |||
| 171 | /* _GL_FUNCDECL_RPL (func, rettype, parameters, [attributes]); | ||
| 172 | declares a replacement function, named rpl_func, with the given prototype, | ||
| 173 | consisting of return type, parameters, and attributes. | ||
| 174 | Although attributes are optional, the comma before them is required | ||
| 175 | for portability to C17 and earlier. The attribute _GL_ATTRIBUTE_NOTHROW, | ||
| 176 | if needed, must be placed after the _GL_FUNCDECL_RPL invocation, | ||
| 177 | at the end of the declaration. | ||
| 178 | Examples: | ||
| 179 | _GL_FUNCDECL_RPL (free, void, (void *ptr), ) _GL_ATTRIBUTE_NOTHROW; | ||
| 180 | _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...), | ||
| 181 | _GL_ARG_NONNULL ((1))); | ||
| 182 | |||
| 183 | Note: Attributes, such as _GL_ATTRIBUTE_DEPRECATED, are supported in front | ||
| 184 | of a _GL_FUNCDECL_RPL invocation only in C mode, not in C++ mode. (That's | ||
| 185 | because | ||
| 186 | [[...]] extern "C" <declaration>; | ||
| 187 | is invalid syntax in C++.) | ||
| 188 | */ | ||
| 189 | #define _GL_FUNCDECL_RPL(func,rettype,parameters,...) \ | ||
| 190 | _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters, __VA_ARGS__) | ||
| 191 | #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters,...) \ | ||
| 192 | _GL_EXTERN_C_FUNC __VA_ARGS__ rettype rpl_func parameters | ||
| 193 | |||
| 194 | /* _GL_FUNCDECL_SYS_NAME (func) expands to plain func if C++, and to | ||
| 195 | parenthesized func otherwise. Parenthesization is needed in C23 if | ||
| 196 | the function is like strchr and so is a qualifier-generic macro | ||
| 197 | that expands to something more complicated. */ | ||
| 198 | #ifdef __cplusplus | ||
| 199 | # define _GL_FUNCDECL_SYS_NAME(func) func | ||
| 200 | #else | ||
| 201 | # define _GL_FUNCDECL_SYS_NAME(func) (func) | ||
| 202 | #endif | ||
| 203 | |||
| 204 | /* _GL_FUNCDECL_SYS (func, rettype, parameters, [attributes]); | ||
| 205 | declares the system function, named func, with the given prototype, | ||
| 206 | consisting of return type, parameters, and attributes. | ||
| 207 | Although attributes are optional, the comma before them is required | ||
| 208 | for portability to C17 and earlier. The attribute _GL_ATTRIBUTE_NOTHROW, | ||
| 209 | if needed, must be placed after the _GL_FUNCDECL_RPL invocation, | ||
| 210 | at the end of the declaration. | ||
| 211 | Examples: | ||
| 212 | _GL_FUNCDECL_SYS (getumask, mode_t, (void), ) _GL_ATTRIBUTE_NOTHROW; | ||
| 213 | _GL_FUNCDECL_SYS (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD); | ||
| 214 | */ | ||
| 215 | #define _GL_FUNCDECL_SYS(func,rettype,parameters,...) \ | ||
| 216 | _GL_EXTERN_C_FUNC __VA_ARGS__ rettype _GL_FUNCDECL_SYS_NAME (func) parameters | ||
| 217 | |||
| 218 | /* _GL_CXXALIAS_RPL (func, rettype, parameters); | ||
| 219 | declares a C++ alias called GNULIB_NAMESPACE::func | ||
| 220 | that redirects to rpl_func, if GNULIB_NAMESPACE is defined. | ||
| 221 | Example: | ||
| 222 | _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); | ||
| 223 | |||
| 224 | Wrapping rpl_func in an object with an inline conversion operator | ||
| 225 | avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is | ||
| 226 | actually used in the program. */ | ||
| 227 | #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ | ||
| 228 | _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) | ||
| 229 | #if defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 230 | # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ | ||
| 231 | namespace GNULIB_NAMESPACE \ | ||
| 232 | { \ | ||
| 233 | static const struct _gl_ ## func ## _wrapper \ | ||
| 234 | { \ | ||
| 235 | typedef rettype (*type) parameters; \ | ||
| 236 | \ | ||
| 237 | inline operator type () const \ | ||
| 238 | { \ | ||
| 239 | return ::rpl_func; \ | ||
| 240 | } \ | ||
| 241 | } func = {}; \ | ||
| 242 | } \ | ||
| 243 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
| 244 | #else | ||
| 245 | # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ | ||
| 246 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
| 247 | #endif | ||
| 248 | |||
| 249 | /* _GL_CXXALIAS_MDA (func, rettype, parameters); | ||
| 250 | is to be used when func is a Microsoft deprecated alias, on native Windows. | ||
| 251 | It declares a C++ alias called GNULIB_NAMESPACE::func | ||
| 252 | that redirects to _func, if GNULIB_NAMESPACE is defined. | ||
| 253 | Example: | ||
| 254 | _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...)); | ||
| 255 | */ | ||
| 256 | #define _GL_CXXALIAS_MDA(func,rettype,parameters) \ | ||
| 257 | _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters) | ||
| 258 | |||
| 259 | /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); | ||
| 260 | is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); | ||
| 261 | except that the C function rpl_func may have a slightly different | ||
| 262 | declaration. A cast is used to silence the "invalid conversion" error | ||
| 263 | that would otherwise occur. */ | ||
| 264 | #if defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 265 | # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ | ||
| 266 | namespace GNULIB_NAMESPACE \ | ||
| 267 | { \ | ||
| 268 | static const struct _gl_ ## func ## _wrapper \ | ||
| 269 | { \ | ||
| 270 | typedef rettype (*type) parameters; \ | ||
| 271 | \ | ||
| 272 | inline operator type () const \ | ||
| 273 | { \ | ||
| 274 | return reinterpret_cast<type>(::rpl_func); \ | ||
| 275 | } \ | ||
| 276 | } func = {}; \ | ||
| 277 | } \ | ||
| 278 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
| 279 | #else | ||
| 280 | # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ | ||
| 281 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
| 282 | #endif | ||
| 283 | |||
| 284 | /* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters); | ||
| 285 | is like _GL_CXXALIAS_MDA (func, rettype, parameters); | ||
| 286 | except that the C function func may have a slightly different declaration. | ||
| 287 | A cast is used to silence the "invalid conversion" error that would | ||
| 288 | otherwise occur. */ | ||
| 289 | #define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \ | ||
| 290 | _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters) | ||
| 291 | |||
| 292 | /* _GL_CXXALIAS_SYS (func, rettype, parameters); | ||
| 293 | declares a C++ alias called GNULIB_NAMESPACE::func | ||
| 294 | that redirects to the system provided function func, if GNULIB_NAMESPACE | ||
| 295 | is defined. | ||
| 296 | Example: | ||
| 297 | _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); | ||
| 298 | |||
| 299 | Wrapping func in an object with an inline conversion operator | ||
| 300 | avoids a reference to func unless GNULIB_NAMESPACE::func is | ||
| 301 | actually used in the program. */ | ||
| 302 | #if defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 303 | # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ | ||
| 304 | namespace GNULIB_NAMESPACE \ | ||
| 305 | { \ | ||
| 306 | static const struct _gl_ ## func ## _wrapper \ | ||
| 307 | { \ | ||
| 308 | typedef rettype (*type) parameters; \ | ||
| 309 | \ | ||
| 310 | inline operator type () const \ | ||
| 311 | { \ | ||
| 312 | return ::func; \ | ||
| 313 | } \ | ||
| 314 | } func = {}; \ | ||
| 315 | } \ | ||
| 316 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
| 317 | #else | ||
| 318 | # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ | ||
| 319 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
| 320 | #endif | ||
| 321 | |||
| 322 | /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); | ||
| 323 | is like _GL_CXXALIAS_SYS (func, rettype, parameters); | ||
| 324 | except that the C function func may have a slightly different declaration. | ||
| 325 | A cast is used to silence the "invalid conversion" error that would | ||
| 326 | otherwise occur. */ | ||
| 327 | #if defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 328 | # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ | ||
| 329 | namespace GNULIB_NAMESPACE \ | ||
| 330 | { \ | ||
| 331 | static const struct _gl_ ## func ## _wrapper \ | ||
| 332 | { \ | ||
| 333 | typedef rettype (*type) parameters; \ | ||
| 334 | \ | ||
| 335 | inline operator type () const \ | ||
| 336 | { \ | ||
| 337 | return reinterpret_cast<type>(::func); \ | ||
| 338 | } \ | ||
| 339 | } func = {}; \ | ||
| 340 | } \ | ||
| 341 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
| 342 | #else | ||
| 343 | # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ | ||
| 344 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
| 345 | #endif | ||
| 346 | |||
| 347 | /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); | ||
| 348 | is like _GL_CXXALIAS_SYS (func, rettype, parameters); | ||
| 349 | except that the C function is picked among a set of overloaded functions, | ||
| 350 | namely the one with rettype2 and parameters2. Two consecutive casts | ||
| 351 | are used to silence the "cannot find a match" and "invalid conversion" | ||
| 352 | errors that would otherwise occur. */ | ||
| 353 | #if defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 354 | /* The outer cast must be a reinterpret_cast. | ||
| 355 | The inner cast: When the function is defined as a set of overloaded | ||
| 356 | functions, it works as a static_cast<>, choosing the designated variant. | ||
| 357 | When the function is defined as a single variant, it works as a | ||
| 358 | reinterpret_cast<>. The parenthesized cast syntax works both ways. */ | ||
| 359 | # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ | ||
| 360 | namespace GNULIB_NAMESPACE \ | ||
| 361 | { \ | ||
| 362 | static const struct _gl_ ## func ## _wrapper \ | ||
| 363 | { \ | ||
| 364 | typedef rettype (*type) parameters; \ | ||
| 365 | \ | ||
| 366 | inline operator type () const \ | ||
| 367 | { \ | ||
| 368 | return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \ | ||
| 369 | } \ | ||
| 370 | } func = {}; \ | ||
| 371 | } \ | ||
| 372 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
| 373 | #else | ||
| 374 | # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ | ||
| 375 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
| 376 | #endif | ||
| 377 | |||
| 378 | /* _GL_CXXALIASWARN (func); | ||
| 379 | causes a warning to be emitted when ::func is used but not when | ||
| 380 | GNULIB_NAMESPACE::func is used. func must be defined without overloaded | ||
| 381 | variants. */ | ||
| 382 | #if defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 383 | # define _GL_CXXALIASWARN(func) \ | ||
| 384 | _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) | ||
| 385 | # define _GL_CXXALIASWARN_1(func,namespace) \ | ||
| 386 | _GL_CXXALIASWARN_2 (func, namespace) | ||
| 387 | /* To work around GCC bug <https://gcc.gnu.org/PR43881>, | ||
| 388 | we enable the warning only when not optimizing. */ | ||
| 389 | # if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) | ||
| 390 | # define _GL_CXXALIASWARN_2(func,namespace) \ | ||
| 391 | _GL_WARN_ON_USE (func, \ | ||
| 392 | "The symbol ::" #func " refers to the system function. " \ | ||
| 393 | "Use " #namespace "::" #func " instead.") | ||
| 394 | # elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING | ||
| 395 | # define _GL_CXXALIASWARN_2(func,namespace) \ | ||
| 396 | extern __typeof__ (func) func | ||
| 397 | # else | ||
| 398 | # define _GL_CXXALIASWARN_2(func,namespace) \ | ||
| 399 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
| 400 | # endif | ||
| 401 | #else | ||
| 402 | # define _GL_CXXALIASWARN(func) \ | ||
| 403 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
| 404 | #endif | ||
| 405 | |||
| 406 | /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); | ||
| 407 | causes a warning to be emitted when the given overloaded variant of ::func | ||
| 408 | is used but not when GNULIB_NAMESPACE::func is used. */ | ||
| 409 | #if defined __cplusplus && defined GNULIB_NAMESPACE | ||
| 410 | # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ | ||
| 411 | _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ | ||
| 412 | GNULIB_NAMESPACE) | ||
| 413 | # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ | ||
| 414 | _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) | ||
| 415 | /* To work around GCC bug <https://gcc.gnu.org/PR43881>, | ||
| 416 | we enable the warning only when not optimizing. */ | ||
| 417 | # if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) | ||
| 418 | # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ | ||
| 419 | _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \ | ||
| 420 | "The symbol ::" #func " refers to the system function. " \ | ||
| 421 | "Use " #namespace "::" #func " instead.") | ||
| 422 | # else | ||
| 423 | # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ | ||
| 424 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
| 425 | # endif | ||
| 426 | #else | ||
| 427 | # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ | ||
| 428 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
| 429 | #endif | ||
| 430 | |||
| 431 | #endif /* _GL_CXXDEFS_H */ | ||
| 432 | |||
| 433 | /* The definition of _GL_WARN_ON_USE is copied here. */ | ||
| 434 | /* A C macro for emitting warnings if a function is used. | ||
| 435 | Copyright (C) 2010-2025 Free Software Foundation, Inc. | ||
| 436 | |||
| 437 | This program is free software: you can redistribute it and/or modify it | ||
| 438 | under the terms of the GNU Lesser General Public License as published | ||
| 439 | by the Free Software Foundation; either version 2 of the License, or | ||
| 440 | (at your option) any later version. | ||
| 441 | |||
| 442 | This program is distributed in the hope that it will be useful, | ||
| 443 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 444 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 445 | Lesser General Public License for more details. | ||
| 446 | |||
| 447 | You should have received a copy of the GNU Lesser General Public License | ||
| 448 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | ||
| 449 | |||
| 450 | /* _GL_WARN_ON_USE (function, "literal string") issues a declaration | ||
| 451 | for FUNCTION which will then trigger a compiler warning containing | ||
| 452 | the text of "literal string" anywhere that function is called, if | ||
| 453 | supported by the compiler. If the compiler does not support this | ||
| 454 | feature, the macro expands to an unused extern declaration. | ||
| 455 | |||
| 456 | _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the | ||
| 457 | attribute used in _GL_WARN_ON_USE. If the compiler does not support | ||
| 458 | this feature, it expands to empty. | ||
| 459 | |||
| 460 | These macros are useful for marking a function as a potential | ||
| 461 | portability trap, with the intent that "literal string" include | ||
| 462 | instructions on the replacement function that should be used | ||
| 463 | instead. | ||
| 464 | _GL_WARN_ON_USE is for functions with 'extern' linkage. | ||
| 465 | _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline' | ||
| 466 | linkage. | ||
| 467 | |||
| 468 | _GL_WARN_ON_USE should not be used more than once for a given function | ||
| 469 | in a given compilation unit (because this may generate a warning even | ||
| 470 | if the function is never called). | ||
| 471 | |||
| 472 | However, one of the reasons that a function is a portability trap is | ||
| 473 | if it has the wrong signature. Declaring FUNCTION with a different | ||
| 474 | signature in C is a compilation error, so this macro must use the | ||
| 475 | same type as any existing declaration so that programs that avoid | ||
| 476 | the problematic FUNCTION do not fail to compile merely because they | ||
| 477 | included a header that poisoned the function. But this implies that | ||
| 478 | _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already | ||
| 479 | have a declaration. Use of this macro implies that there must not | ||
| 480 | be any other macro hiding the declaration of FUNCTION; but | ||
| 481 | undefining FUNCTION first is part of the poisoning process anyway | ||
| 482 | (although for symbols that are provided only via a macro, the result | ||
| 483 | is a compilation error rather than a warning containing | ||
| 484 | "literal string"). Also note that in C++, it is only safe to use if | ||
| 485 | FUNCTION has no overloads. | ||
| 486 | |||
| 487 | For an example, it is possible to poison 'getline' by: | ||
| 488 | - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]], | ||
| 489 | [getline]) in configure.ac, which potentially defines | ||
| 490 | HAVE_RAW_DECL_GETLINE | ||
| 491 | - adding this code to a header that wraps the system <stdio.h>: | ||
| 492 | #undef getline | ||
| 493 | #if HAVE_RAW_DECL_GETLINE | ||
| 494 | _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" | ||
| 495 | "not universally present; use the gnulib module getline"); | ||
| 496 | #endif | ||
| 497 | |||
| 498 | It is not possible to directly poison global variables. But it is | ||
| 499 | possible to write a wrapper accessor function, and poison that | ||
| 500 | (less common usage, like &environ, will cause a compilation error | ||
| 501 | rather than issue the nice warning, but the end result of informing | ||
| 502 | the developer about their portability problem is still achieved): | ||
| 503 | #if HAVE_RAW_DECL_ENVIRON | ||
| 504 | static char *** | ||
| 505 | rpl_environ (void) { return &environ; } | ||
| 506 | _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); | ||
| 507 | # undef environ | ||
| 508 | # define environ (*rpl_environ ()) | ||
| 509 | #endif | ||
| 510 | or better (avoiding contradictory use of 'static' and 'extern'): | ||
| 511 | #if HAVE_RAW_DECL_ENVIRON | ||
| 512 | static char *** | ||
| 513 | _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared") | ||
| 514 | rpl_environ (void) { return &environ; } | ||
| 515 | # undef environ | ||
| 516 | # define environ (*rpl_environ ()) | ||
| 517 | #endif | ||
| 518 | */ | ||
| 519 | #ifndef _GL_WARN_ON_USE | ||
| 520 | |||
| 521 | # if (4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)) && !defined __clang__ | ||
| 522 | /* A compiler attribute is available in gcc versions 4.3.0 and later. */ | ||
| 523 | # define _GL_WARN_ON_USE(function, message) \ | ||
| 524 | _GL_WARN_EXTERN_C __typeof__ (function) function __attribute__ ((__warning__ (message))) | ||
| 525 | # define _GL_WARN_ON_USE_ATTRIBUTE(message) \ | ||
| 526 | __attribute__ ((__warning__ (message))) | ||
| 527 | # elif __clang_major__ >= 4 | ||
| 528 | /* Another compiler attribute is available in clang. */ | ||
| 529 | # define _GL_WARN_ON_USE(function, message) \ | ||
| 530 | _GL_WARN_EXTERN_C __typeof__ (function) function \ | ||
| 531 | __attribute__ ((__diagnose_if__ (1, message, "warning"))) | ||
| 532 | # define _GL_WARN_ON_USE_ATTRIBUTE(message) \ | ||
| 533 | __attribute__ ((__diagnose_if__ (1, message, "warning"))) | ||
| 534 | # elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING | ||
| 535 | /* Verify the existence of the function. */ | ||
| 536 | # define _GL_WARN_ON_USE(function, message) \ | ||
| 537 | _GL_WARN_EXTERN_C __typeof__ (function) function | ||
| 538 | # define _GL_WARN_ON_USE_ATTRIBUTE(message) | ||
| 539 | # else /* Unsupported. */ | ||
| 540 | # define _GL_WARN_ON_USE(function, message) \ | ||
| 541 | _GL_WARN_EXTERN_C int _gl_warn_on_use | ||
| 542 | # define _GL_WARN_ON_USE_ATTRIBUTE(message) | ||
| 543 | # endif | ||
| 544 | #endif | ||
| 545 | |||
| 546 | /* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message") | ||
| 547 | is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the | ||
| 548 | function is declared with the given prototype, consisting of return type, | ||
| 549 | parameters, and attributes. | ||
| 550 | This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does | ||
| 551 | not work in this case. */ | ||
| 552 | #ifndef _GL_WARN_ON_USE_CXX | ||
| 553 | # if !defined __cplusplus | ||
| 554 | # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ | ||
| 555 | _GL_WARN_ON_USE (function, msg) | ||
| 556 | # else | ||
| 557 | # if (4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)) && !defined __clang__ | ||
| 558 | /* A compiler attribute is available in gcc versions 4.3.0 and later. */ | ||
| 559 | # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ | ||
| 560 | extern rettype_gcc function parameters_and_attributes \ | ||
| 561 | __attribute__ ((__warning__ (msg))) | ||
| 562 | # elif __clang_major__ >= 4 | ||
| 563 | /* Another compiler attribute is available in clang. */ | ||
| 564 | # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ | ||
| 565 | extern rettype_clang function parameters_and_attributes \ | ||
| 566 | __attribute__ ((__diagnose_if__ (1, msg, "warning"))) | ||
| 567 | # elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING | ||
| 568 | /* Verify the existence of the function. */ | ||
| 569 | # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ | ||
| 570 | extern rettype_gcc function parameters_and_attributes | ||
| 571 | # else /* Unsupported. */ | ||
| 572 | # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ | ||
| 573 | _GL_WARN_EXTERN_C int _gl_warn_on_use | ||
| 574 | # endif | ||
| 575 | # endif | ||
| 576 | #endif | ||
| 577 | |||
| 578 | /* _GL_WARN_EXTERN_C declaration; | ||
| 579 | performs the declaration with C linkage. */ | ||
| 580 | #ifndef _GL_WARN_EXTERN_C | ||
| 581 | # if defined __cplusplus | ||
| 582 | # define _GL_WARN_EXTERN_C extern "C" | ||
| 583 | # else | ||
| 584 | # define _GL_WARN_EXTERN_C extern | ||
| 585 | # endif | ||
| 586 | #endif | ||
| 587 | |||
| 588 | #if !1 | ||
| 589 | |||
| 590 | # if !GNULIB_defined_struct_sched_param | ||
| 591 | struct sched_param | ||
| 592 | { | ||
| 593 | int sched_priority; | ||
| 594 | }; | ||
| 595 | # define GNULIB_defined_struct_sched_param 1 | ||
| 596 | # endif | ||
| 597 | |||
| 598 | #endif | ||
| 599 | |||
| 600 | #if !(defined SCHED_FIFO && defined SCHED_RR && defined SCHED_OTHER) | ||
| 601 | # define SCHED_FIFO 1 | ||
| 602 | # define SCHED_RR 2 | ||
| 603 | # define SCHED_OTHER 0 | ||
| 604 | #endif | ||
| 605 | |||
| 606 | #if 0 | ||
| 607 | # if 0 | ||
| 608 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 609 | # undef sched_yield | ||
| 610 | # define sched_yield rpl_sched_yield | ||
| 611 | # endif | ||
| 612 | _GL_FUNCDECL_RPL (sched_yield, int, (void), ); | ||
| 613 | _GL_CXXALIAS_RPL (sched_yield, int, (void)); | ||
| 614 | # else | ||
| 615 | # if !1 | ||
| 616 | _GL_FUNCDECL_SYS (sched_yield, int, (void), ); | ||
| 617 | # endif | ||
| 618 | _GL_CXXALIAS_SYS (sched_yield, int, (void)); | ||
| 619 | # endif | ||
| 620 | # if __GLIBC__ >= 2 | ||
| 621 | _GL_CXXALIASWARN (sched_yield); | ||
| 622 | # endif | ||
| 623 | #elif defined GNULIB_POSIXCHECK | ||
| 624 | # if HAVE_RAW_DECL_SCHED_YIELD | ||
| 625 | _GL_WARN_ON_USE (sched_yield, "sched_yield is not portable - " | ||
| 626 | "use gnulib module sched_yield for portability"); | ||
| 627 | # endif | ||
| 628 | #endif | ||
| 629 | |||
| 630 | #endif /* _GL_SCHED_H */ | ||
| 631 | #endif /* _GL_SCHED_H */ | ||
