1 /* This file is automatically generated. DO NOT EDIT! */ 2 /* Generated from: NetBSD: mknative-gdb,v 1.12 2020/09/17 16:54:31 christos Exp */ 3 /* Generated from: NetBSD: mknative.common,v 1.16 2018/04/15 15:13:37 christos Exp */ 4 5 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 6 /* A GNU-like <signal.h>. 7 8 Copyright (C) 2006-2020 Free Software Foundation, Inc. 9 10 This program is free software: you can redistribute it and/or modify 11 it under the terms of the GNU General Public License as published by 12 the Free Software Foundation; either version 3 of the License, or 13 (at your option) any later version. 14 15 This program is distributed in the hope that it will be useful, 16 but WITHOUT ANY WARRANTY; without even the implied warranty of 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 GNU General Public License for more details. 19 20 You should have received a copy of the GNU General Public License 21 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 22 23 #if __GNUC__ >= 3 24 #pragma GCC system_header 25 #endif 26 27 28 #if defined __need_sig_atomic_t || defined __need_sigset_t || defined _GL_ALREADY_INCLUDING_SIGNAL_H || (defined _SIGNAL_H && !defined __SIZEOF_PTHREAD_MUTEX_T) 29 /* Special invocation convention: 30 - Inside glibc header files. 31 - On glibc systems we have a sequence of nested includes 32 <signal.h> -> <ucontext.h> -> <signal.h>. 33 In this situation, the functions are not yet declared, therefore we cannot 34 provide the C++ aliases. 35 - On glibc systems with GCC 4.3 we have a sequence of nested includes 36 <csignal> -> </usr/include/signal.h> -> <sys/ucontext.h> -> <signal.h>. 37 In this situation, some of the functions are not yet declared, therefore 38 we cannot provide the C++ aliases. */ 39 40 # include_next <signal.h> 41 42 #else 43 /* Normal invocation convention. */ 44 45 #ifndef _GL_SIGNAL_H 46 47 #define _GL_ALREADY_INCLUDING_SIGNAL_H 48 49 /* Define pid_t, uid_t. 50 Also, mingw defines sigset_t not in <signal.h>, but in <sys/types.h>. 51 On Solaris 10, <signal.h> includes <sys/types.h>, which eventually includes 52 us; so include <sys/types.h> now, before the second inclusion guard. */ 53 #include <sys/types.h> 54 55 /* The include_next requires a split double-inclusion guard. */ 56 #include_next <signal.h> 57 58 #undef _GL_ALREADY_INCLUDING_SIGNAL_H 59 60 #ifndef _GL_SIGNAL_H 61 #define _GL_SIGNAL_H 62 63 /* Mac OS X 10.3, FreeBSD 6.4, OpenBSD 3.8, OSF/1 4.0, Solaris 2.6, Android 64 declare pthread_sigmask in <pthread.h>, not in <signal.h>. 65 But avoid namespace pollution on glibc systems.*/ 66 #if (0 || defined GNULIB_POSIXCHECK) \ 67 && ((defined __APPLE__ && defined __MACH__) \ 68 || defined __FreeBSD__ || defined __OpenBSD__ || defined __osf__ \ 69 || defined __sun || defined __ANDROID__) \ 70 && ! defined __GLIBC__ 71 # include <pthread.h> 72 #endif 73 74 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 75 /* C++ compatible function declaration macros. 76 Copyright (C) 2010-2020 Free Software Foundation, Inc. 77 78 This program is free software: you can redistribute it and/or modify it 79 under the terms of the GNU General Public License as published 80 by the Free Software Foundation; either version 3 of the License, or 81 (at your option) any later version. 82 83 This program is distributed in the hope that it will be useful, 84 but WITHOUT ANY WARRANTY; without even the implied warranty of 85 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 86 General Public License for more details. 87 88 You should have received a copy of the GNU General Public License 89 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 90 91 #ifndef _GL_CXXDEFS_H 92 #define _GL_CXXDEFS_H 93 94 /* Begin/end the GNULIB_NAMESPACE namespace. */ 95 #if defined __cplusplus && defined GNULIB_NAMESPACE 96 # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { 97 # define _GL_END_NAMESPACE } 98 #else 99 # define _GL_BEGIN_NAMESPACE 100 # define _GL_END_NAMESPACE 101 #endif 102 103 /* The three most frequent use cases of these macros are: 104 105 * For providing a substitute for a function that is missing on some 106 platforms, but is declared and works fine on the platforms on which 107 it exists: 108 109 #if @GNULIB_FOO@ 110 # if !@HAVE_FOO@ 111 _GL_FUNCDECL_SYS (foo, ...); 112 # endif 113 _GL_CXXALIAS_SYS (foo, ...); 114 _GL_CXXALIASWARN (foo); 115 #elif defined GNULIB_POSIXCHECK 116 ... 117 #endif 118 119 * For providing a replacement for a function that exists on all platforms, 120 but is broken/insufficient and needs to be replaced on some platforms: 121 122 #if @GNULIB_FOO@ 123 # if @REPLACE_FOO@ 124 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 125 # undef foo 126 # define foo rpl_foo 127 # endif 128 _GL_FUNCDECL_RPL (foo, ...); 129 _GL_CXXALIAS_RPL (foo, ...); 130 # else 131 _GL_CXXALIAS_SYS (foo, ...); 132 # endif 133 _GL_CXXALIASWARN (foo); 134 #elif defined GNULIB_POSIXCHECK 135 ... 136 #endif 137 138 * For providing a replacement for a function that exists on some platforms 139 but is broken/insufficient and needs to be replaced on some of them and 140 is additionally either missing or undeclared on some other platforms: 141 142 #if @GNULIB_FOO@ 143 # if @REPLACE_FOO@ 144 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 145 # undef foo 146 # define foo rpl_foo 147 # endif 148 _GL_FUNCDECL_RPL (foo, ...); 149 _GL_CXXALIAS_RPL (foo, ...); 150 # else 151 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ 152 _GL_FUNCDECL_SYS (foo, ...); 153 # endif 154 _GL_CXXALIAS_SYS (foo, ...); 155 # endif 156 _GL_CXXALIASWARN (foo); 157 #elif defined GNULIB_POSIXCHECK 158 ... 159 #endif 160 */ 161 162 /* _GL_EXTERN_C declaration; 163 performs the declaration with C linkage. */ 164 #if defined __cplusplus 165 # define _GL_EXTERN_C extern "C" 166 #else 167 # define _GL_EXTERN_C extern 168 #endif 169 170 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); 171 declares a replacement function, named rpl_func, with the given prototype, 172 consisting of return type, parameters, and attributes. 173 Example: 174 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) 175 _GL_ARG_NONNULL ((1))); 176 */ 177 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ 178 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) 179 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ 180 _GL_EXTERN_C rettype rpl_func parameters_and_attributes 181 182 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); 183 declares the system function, named func, with the given prototype, 184 consisting of return type, parameters, and attributes. 185 Example: 186 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) 187 _GL_ARG_NONNULL ((1))); 188 */ 189 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ 190 _GL_EXTERN_C rettype func parameters_and_attributes 191 192 /* _GL_CXXALIAS_RPL (func, rettype, parameters); 193 declares a C++ alias called GNULIB_NAMESPACE::func 194 that redirects to rpl_func, if GNULIB_NAMESPACE is defined. 195 Example: 196 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); 197 198 Wrapping rpl_func in an object with an inline conversion operator 199 avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is 200 actually used in the program. */ 201 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ 202 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) 203 #if defined __cplusplus && defined GNULIB_NAMESPACE 204 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 205 namespace GNULIB_NAMESPACE \ 206 { \ 207 static const struct _gl_ ## func ## _wrapper \ 208 { \ 209 typedef rettype (*type) parameters; \ 210 \ 211 inline operator type () const \ 212 { \ 213 return ::rpl_func; \ 214 } \ 215 } func = {}; \ 216 } \ 217 _GL_EXTERN_C int _gl_cxxalias_dummy 218 #else 219 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 220 _GL_EXTERN_C int _gl_cxxalias_dummy 221 #endif 222 223 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); 224 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); 225 except that the C function rpl_func may have a slightly different 226 declaration. A cast is used to silence the "invalid conversion" error 227 that would otherwise occur. */ 228 #if defined __cplusplus && defined GNULIB_NAMESPACE 229 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 230 namespace GNULIB_NAMESPACE \ 231 { \ 232 static const struct _gl_ ## func ## _wrapper \ 233 { \ 234 typedef rettype (*type) parameters; \ 235 \ 236 inline operator type () const \ 237 { \ 238 return reinterpret_cast<type>(::rpl_func); \ 239 } \ 240 } func = {}; \ 241 } \ 242 _GL_EXTERN_C int _gl_cxxalias_dummy 243 #else 244 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 245 _GL_EXTERN_C int _gl_cxxalias_dummy 246 #endif 247 248 /* _GL_CXXALIAS_SYS (func, rettype, parameters); 249 declares a C++ alias called GNULIB_NAMESPACE::func 250 that redirects to the system provided function func, if GNULIB_NAMESPACE 251 is defined. 252 Example: 253 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); 254 255 Wrapping func in an object with an inline conversion operator 256 avoids a reference to func unless GNULIB_NAMESPACE::func is 257 actually used in the program. */ 258 #if defined __cplusplus && defined GNULIB_NAMESPACE 259 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 260 namespace GNULIB_NAMESPACE \ 261 { \ 262 static const struct _gl_ ## func ## _wrapper \ 263 { \ 264 typedef rettype (*type) parameters; \ 265 \ 266 inline operator type () const \ 267 { \ 268 return ::func; \ 269 } \ 270 } func = {}; \ 271 } \ 272 _GL_EXTERN_C int _gl_cxxalias_dummy 273 #else 274 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 275 _GL_EXTERN_C int _gl_cxxalias_dummy 276 #endif 277 278 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); 279 is like _GL_CXXALIAS_SYS (func, rettype, parameters); 280 except that the C function func may have a slightly different declaration. 281 A cast is used to silence the "invalid conversion" error that would 282 otherwise occur. */ 283 #if defined __cplusplus && defined GNULIB_NAMESPACE 284 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 285 namespace GNULIB_NAMESPACE \ 286 { \ 287 static const struct _gl_ ## func ## _wrapper \ 288 { \ 289 typedef rettype (*type) parameters; \ 290 \ 291 inline operator type () const \ 292 { \ 293 return reinterpret_cast<type>(::func); \ 294 } \ 295 } func = {}; \ 296 } \ 297 _GL_EXTERN_C int _gl_cxxalias_dummy 298 #else 299 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 300 _GL_EXTERN_C int _gl_cxxalias_dummy 301 #endif 302 303 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); 304 is like _GL_CXXALIAS_SYS (func, rettype, parameters); 305 except that the C function is picked among a set of overloaded functions, 306 namely the one with rettype2 and parameters2. Two consecutive casts 307 are used to silence the "cannot find a match" and "invalid conversion" 308 errors that would otherwise occur. */ 309 #if defined __cplusplus && defined GNULIB_NAMESPACE 310 /* The outer cast must be a reinterpret_cast. 311 The inner cast: When the function is defined as a set of overloaded 312 functions, it works as a static_cast<>, choosing the designated variant. 313 When the function is defined as a single variant, it works as a 314 reinterpret_cast<>. The parenthesized cast syntax works both ways. */ 315 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 316 namespace GNULIB_NAMESPACE \ 317 { \ 318 static const struct _gl_ ## func ## _wrapper \ 319 { \ 320 typedef rettype (*type) parameters; \ 321 \ 322 inline operator type () const \ 323 { \ 324 return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \ 325 } \ 326 } func = {}; \ 327 } \ 328 _GL_EXTERN_C int _gl_cxxalias_dummy 329 #else 330 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 331 _GL_EXTERN_C int _gl_cxxalias_dummy 332 #endif 333 334 /* _GL_CXXALIASWARN (func); 335 causes a warning to be emitted when ::func is used but not when 336 GNULIB_NAMESPACE::func is used. func must be defined without overloaded 337 variants. */ 338 #if defined __cplusplus && defined GNULIB_NAMESPACE 339 # define _GL_CXXALIASWARN(func) \ 340 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) 341 # define _GL_CXXALIASWARN_1(func,namespace) \ 342 _GL_CXXALIASWARN_2 (func, namespace) 343 /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 344 we enable the warning only when not optimizing. */ 345 # if !__OPTIMIZE__ 346 # define _GL_CXXALIASWARN_2(func,namespace) \ 347 _GL_WARN_ON_USE (func, \ 348 "The symbol ::" #func " refers to the system function. " \ 349 "Use " #namespace "::" #func " instead.") 350 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 351 # define _GL_CXXALIASWARN_2(func,namespace) \ 352 extern __typeof__ (func) func 353 # else 354 # define _GL_CXXALIASWARN_2(func,namespace) \ 355 _GL_EXTERN_C int _gl_cxxalias_dummy 356 # endif 357 #else 358 # define _GL_CXXALIASWARN(func) \ 359 _GL_EXTERN_C int _gl_cxxalias_dummy 360 #endif 361 362 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); 363 causes a warning to be emitted when the given overloaded variant of ::func 364 is used but not when GNULIB_NAMESPACE::func is used. */ 365 #if defined __cplusplus && defined GNULIB_NAMESPACE 366 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 367 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ 368 GNULIB_NAMESPACE) 369 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ 370 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) 371 /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 372 we enable the warning only when not optimizing. */ 373 # if !__OPTIMIZE__ 374 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 375 _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ 376 "The symbol ::" #func " refers to the system function. " \ 377 "Use " #namespace "::" #func " instead.") 378 # else 379 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 380 _GL_EXTERN_C int _gl_cxxalias_dummy 381 # endif 382 #else 383 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 384 _GL_EXTERN_C int _gl_cxxalias_dummy 385 #endif 386 387 #endif /* _GL_CXXDEFS_H */ 388 389 /* The definition of _GL_ARG_NONNULL is copied here. */ 390 /* A C macro for declaring that specific arguments must not be NULL. 391 Copyright (C) 2009-2020 Free Software Foundation, Inc. 392 393 This program is free software: you can redistribute it and/or modify it 394 under the terms of the GNU General Public License as published 395 by the Free Software Foundation; either version 3 of the License, or 396 (at your option) any later version. 397 398 This program is distributed in the hope that it will be useful, 399 but WITHOUT ANY WARRANTY; without even the implied warranty of 400 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 401 General Public License for more details. 402 403 You should have received a copy of the GNU General Public License 404 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 405 406 /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools 407 that the values passed as arguments n, ..., m must be non-NULL pointers. 408 n = 1 stands for the first argument, n = 2 for the second argument etc. */ 409 #ifndef _GL_ARG_NONNULL 410 # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 411 # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) 412 # else 413 # define _GL_ARG_NONNULL(params) 414 # endif 415 #endif 416 417 /* The definition of _GL_WARN_ON_USE is copied here. */ 418 /* A C macro for emitting warnings if a function is used. 419 Copyright (C) 2010-2020 Free Software Foundation, Inc. 420 421 This program is free software: you can redistribute it and/or modify it 422 under the terms of the GNU General Public License as published 423 by the Free Software Foundation; either version 3 of the License, or 424 (at your option) any later version. 425 426 This program is distributed in the hope that it will be useful, 427 but WITHOUT ANY WARRANTY; without even the implied warranty of 428 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 429 General Public License for more details. 430 431 You should have received a copy of the GNU General Public License 432 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 433 434 /* _GL_WARN_ON_USE (function, "literal string") issues a declaration 435 for FUNCTION which will then trigger a compiler warning containing 436 the text of "literal string" anywhere that function is called, if 437 supported by the compiler. If the compiler does not support this 438 feature, the macro expands to an unused extern declaration. 439 440 _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the 441 attribute used in _GL_WARN_ON_USE. If the compiler does not support 442 this feature, it expands to empty. 443 444 These macros are useful for marking a function as a potential 445 portability trap, with the intent that "literal string" include 446 instructions on the replacement function that should be used 447 instead. 448 _GL_WARN_ON_USE is for functions with 'extern' linkage. 449 _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline' 450 linkage. 451 452 However, one of the reasons that a function is a portability trap is 453 if it has the wrong signature. Declaring FUNCTION with a different 454 signature in C is a compilation error, so this macro must use the 455 same type as any existing declaration so that programs that avoid 456 the problematic FUNCTION do not fail to compile merely because they 457 included a header that poisoned the function. But this implies that 458 _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already 459 have a declaration. Use of this macro implies that there must not 460 be any other macro hiding the declaration of FUNCTION; but 461 undefining FUNCTION first is part of the poisoning process anyway 462 (although for symbols that are provided only via a macro, the result 463 is a compilation error rather than a warning containing 464 "literal string"). Also note that in C++, it is only safe to use if 465 FUNCTION has no overloads. 466 467 For an example, it is possible to poison 'getline' by: 468 - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]], 469 [getline]) in configure.ac, which potentially defines 470 HAVE_RAW_DECL_GETLINE 471 - adding this code to a header that wraps the system <stdio.h>: 472 #undef getline 473 #if HAVE_RAW_DECL_GETLINE 474 _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" 475 "not universally present; use the gnulib module getline"); 476 #endif 477 478 It is not possible to directly poison global variables. But it is 479 possible to write a wrapper accessor function, and poison that 480 (less common usage, like &environ, will cause a compilation error 481 rather than issue the nice warning, but the end result of informing 482 the developer about their portability problem is still achieved): 483 #if HAVE_RAW_DECL_ENVIRON 484 static char *** 485 rpl_environ (void) { return &environ; } 486 _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); 487 # undef environ 488 # define environ (*rpl_environ ()) 489 #endif 490 or better (avoiding contradictory use of 'static' and 'extern'): 491 #if HAVE_RAW_DECL_ENVIRON 492 static char *** 493 _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared") 494 rpl_environ (void) { return &environ; } 495 # undef environ 496 # define environ (*rpl_environ ()) 497 #endif 498 */ 499 #ifndef _GL_WARN_ON_USE 500 501 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 502 /* A compiler attribute is available in gcc versions 4.3.0 and later. */ 503 # define _GL_WARN_ON_USE(function, message) \ 504 extern __typeof__ (function) function __attribute__ ((__warning__ (message))) 505 # define _GL_WARN_ON_USE_ATTRIBUTE(message) \ 506 __attribute__ ((__warning__ (message))) 507 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 508 /* Verify the existence of the function. */ 509 # define _GL_WARN_ON_USE(function, message) \ 510 extern __typeof__ (function) function 511 # define _GL_WARN_ON_USE_ATTRIBUTE(message) 512 # else /* Unsupported. */ 513 # define _GL_WARN_ON_USE(function, message) \ 514 _GL_WARN_EXTERN_C int _gl_warn_on_use 515 # define _GL_WARN_ON_USE_ATTRIBUTE(message) 516 # endif 517 #endif 518 519 /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") 520 is like _GL_WARN_ON_USE (function, "string"), except that in C++ mode the 521 function is declared with the given prototype, consisting of return type, 522 parameters, and attributes. 523 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does 524 not work in this case. */ 525 #ifndef _GL_WARN_ON_USE_CXX 526 # if !defined __cplusplus 527 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 528 _GL_WARN_ON_USE (function, msg) 529 # else 530 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 531 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 532 extern rettype function parameters_and_attributes \ 533 __attribute__ ((__warning__ (msg))) 534 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 535 /* Verify the existence of the function. */ 536 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 537 extern rettype function parameters_and_attributes 538 # else /* Unsupported. */ 539 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 540 _GL_WARN_EXTERN_C int _gl_warn_on_use 541 # endif 542 # endif 543 #endif 544 545 /* _GL_WARN_EXTERN_C declaration; 546 performs the declaration with C linkage. */ 547 #ifndef _GL_WARN_EXTERN_C 548 # if defined __cplusplus 549 # define _GL_WARN_EXTERN_C extern "C" 550 # else 551 # define _GL_WARN_EXTERN_C extern 552 # endif 553 #endif 554 555 /* On AIX, sig_atomic_t already includes volatile. C99 requires that 556 'volatile sig_atomic_t' ignore the extra modifier, but C89 did not. 557 Hence, redefine this to a non-volatile type as needed. */ 558 #if ! 1 559 # if !GNULIB_defined_sig_atomic_t 560 typedef int rpl_sig_atomic_t; 561 # undef sig_atomic_t 562 # define sig_atomic_t rpl_sig_atomic_t 563 # define GNULIB_defined_sig_atomic_t 1 564 # endif 565 #endif 566 567 /* A set or mask of signals. */ 568 #if !1 569 # if !GNULIB_defined_sigset_t 570 typedef unsigned int sigset_t; 571 # define GNULIB_defined_sigset_t 1 572 # endif 573 #endif 574 575 /* Define sighandler_t, the type of signal handlers. A GNU extension. */ 576 #if !0 577 # ifdef __cplusplus 578 extern "C" { 579 # endif 580 # if !GNULIB_defined_sighandler_t 581 typedef void (*sighandler_t) (int); 582 # define GNULIB_defined_sighandler_t 1 583 # endif 584 # ifdef __cplusplus 585 } 586 # endif 587 #endif 588 589 590 #if 0 591 # ifndef SIGPIPE 592 /* Define SIGPIPE to a value that does not overlap with other signals. */ 593 # define SIGPIPE 13 594 # define GNULIB_defined_SIGPIPE 1 595 /* To actually use SIGPIPE, you also need the gnulib modules 'sigprocmask', 596 'write', 'stdio'. */ 597 # endif 598 #endif 599 600 601 /* Maximum signal number + 1. */ 602 #ifndef NSIG 603 # if defined __TANDEM 604 # define NSIG 32 605 # endif 606 #endif 607 608 609 #if 0 610 # if 0 611 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 612 # undef pthread_sigmask 613 # define pthread_sigmask rpl_pthread_sigmask 614 # endif 615 _GL_FUNCDECL_RPL (pthread_sigmask, int, 616 (int how, 617 const sigset_t *restrict new_mask, 618 sigset_t *restrict old_mask)); 619 _GL_CXXALIAS_RPL (pthread_sigmask, int, 620 (int how, 621 const sigset_t *restrict new_mask, 622 sigset_t *restrict old_mask)); 623 # else 624 # if !(1 || defined pthread_sigmask) 625 _GL_FUNCDECL_SYS (pthread_sigmask, int, 626 (int how, 627 const sigset_t *restrict new_mask, 628 sigset_t *restrict old_mask)); 629 # endif 630 _GL_CXXALIAS_SYS (pthread_sigmask, int, 631 (int how, 632 const sigset_t *restrict new_mask, 633 sigset_t *restrict old_mask)); 634 # endif 635 # if __GLIBC__ >= 2 636 _GL_CXXALIASWARN (pthread_sigmask); 637 # endif 638 #elif defined GNULIB_POSIXCHECK 639 # undef pthread_sigmask 640 # if HAVE_RAW_DECL_PTHREAD_SIGMASK 641 _GL_WARN_ON_USE (pthread_sigmask, "pthread_sigmask is not portable - " 642 "use gnulib module pthread_sigmask for portability"); 643 # endif 644 #endif 645 646 647 #if 0 648 # if 0 649 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 650 # undef raise 651 # define raise rpl_raise 652 # endif 653 _GL_FUNCDECL_RPL (raise, int, (int sig)); 654 _GL_CXXALIAS_RPL (raise, int, (int sig)); 655 # else 656 # if !1 657 _GL_FUNCDECL_SYS (raise, int, (int sig)); 658 # endif 659 _GL_CXXALIAS_SYS (raise, int, (int sig)); 660 # endif 661 # if __GLIBC__ >= 2 662 _GL_CXXALIASWARN (raise); 663 # endif 664 #elif defined GNULIB_POSIXCHECK 665 # undef raise 666 /* Assume raise is always declared. */ 667 _GL_WARN_ON_USE (raise, "raise can crash on native Windows - " 668 "use gnulib module raise for portability"); 669 #endif 670 671 672 #if 0 673 # if !1 674 675 # ifndef GNULIB_defined_signal_blocking 676 # define GNULIB_defined_signal_blocking 1 677 # endif 678 679 /* Maximum signal number + 1. */ 680 # ifndef NSIG 681 # define NSIG 32 682 # endif 683 684 /* This code supports only 32 signals. */ 685 # if !GNULIB_defined_verify_NSIG_constraint 686 typedef int verify_NSIG_constraint[NSIG <= 32 ? 1 : -1]; 687 # define GNULIB_defined_verify_NSIG_constraint 1 688 # endif 689 690 # endif 691 692 /* When also using extern inline, suppress the use of static inline in 693 standard headers of problematic Apple configurations, as Libc at 694 least through Libc-825.26 (2013-04-09) mishandles it; see, e.g., 695 <https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html>. 696 Perhaps Apple will fix this some day. */ 697 #if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \ 698 && (defined __i386__ || defined __x86_64__)) 699 # undef sigaddset 700 # undef sigdelset 701 # undef sigemptyset 702 # undef sigfillset 703 # undef sigismember 704 #endif 705 706 /* Test whether a given signal is contained in a signal set. */ 707 # if 1 708 /* This function is defined as a macro on Mac OS X. */ 709 # if defined __cplusplus && defined GNULIB_NAMESPACE 710 # undef sigismember 711 # endif 712 # else 713 _GL_FUNCDECL_SYS (sigismember, int, (const sigset_t *set, int sig) 714 _GL_ARG_NONNULL ((1))); 715 # endif 716 _GL_CXXALIAS_SYS (sigismember, int, (const sigset_t *set, int sig)); 717 _GL_CXXALIASWARN (sigismember); 718 719 /* Initialize a signal set to the empty set. */ 720 # if 1 721 /* This function is defined as a macro on Mac OS X. */ 722 # if defined __cplusplus && defined GNULIB_NAMESPACE 723 # undef sigemptyset 724 # endif 725 # else 726 _GL_FUNCDECL_SYS (sigemptyset, int, (sigset_t *set) _GL_ARG_NONNULL ((1))); 727 # endif 728 _GL_CXXALIAS_SYS (sigemptyset, int, (sigset_t *set)); 729 _GL_CXXALIASWARN (sigemptyset); 730 731 /* Add a signal to a signal set. */ 732 # if 1 733 /* This function is defined as a macro on Mac OS X. */ 734 # if defined __cplusplus && defined GNULIB_NAMESPACE 735 # undef sigaddset 736 # endif 737 # else 738 _GL_FUNCDECL_SYS (sigaddset, int, (sigset_t *set, int sig) 739 _GL_ARG_NONNULL ((1))); 740 # endif 741 _GL_CXXALIAS_SYS (sigaddset, int, (sigset_t *set, int sig)); 742 _GL_CXXALIASWARN (sigaddset); 743 744 /* Remove a signal from a signal set. */ 745 # if 1 746 /* This function is defined as a macro on Mac OS X. */ 747 # if defined __cplusplus && defined GNULIB_NAMESPACE 748 # undef sigdelset 749 # endif 750 # else 751 _GL_FUNCDECL_SYS (sigdelset, int, (sigset_t *set, int sig) 752 _GL_ARG_NONNULL ((1))); 753 # endif 754 _GL_CXXALIAS_SYS (sigdelset, int, (sigset_t *set, int sig)); 755 _GL_CXXALIASWARN (sigdelset); 756 757 /* Fill a signal set with all possible signals. */ 758 # if 1 759 /* This function is defined as a macro on Mac OS X. */ 760 # if defined __cplusplus && defined GNULIB_NAMESPACE 761 # undef sigfillset 762 # endif 763 # else 764 _GL_FUNCDECL_SYS (sigfillset, int, (sigset_t *set) _GL_ARG_NONNULL ((1))); 765 # endif 766 _GL_CXXALIAS_SYS (sigfillset, int, (sigset_t *set)); 767 _GL_CXXALIASWARN (sigfillset); 768 769 /* Return the set of those blocked signals that are pending. */ 770 # if !1 771 _GL_FUNCDECL_SYS (sigpending, int, (sigset_t *set) _GL_ARG_NONNULL ((1))); 772 # endif 773 _GL_CXXALIAS_SYS (sigpending, int, (sigset_t *set)); 774 _GL_CXXALIASWARN (sigpending); 775 776 /* If OLD_SET is not NULL, put the current set of blocked signals in *OLD_SET. 777 Then, if SET is not NULL, affect the current set of blocked signals by 778 combining it with *SET as indicated in OPERATION. 779 In this implementation, you are not allowed to change a signal handler 780 while the signal is blocked. */ 781 # if !1 782 # define SIG_BLOCK 0 /* blocked_set = blocked_set | *set; */ 783 # define SIG_SETMASK 1 /* blocked_set = *set; */ 784 # define SIG_UNBLOCK 2 /* blocked_set = blocked_set & ~*set; */ 785 _GL_FUNCDECL_SYS (sigprocmask, int, 786 (int operation, 787 const sigset_t *restrict set, 788 sigset_t *restrict old_set)); 789 # endif 790 _GL_CXXALIAS_SYS (sigprocmask, int, 791 (int operation, 792 const sigset_t *restrict set, 793 sigset_t *restrict old_set)); 794 _GL_CXXALIASWARN (sigprocmask); 795 796 /* Install the handler FUNC for signal SIG, and return the previous 797 handler. */ 798 # ifdef __cplusplus 799 extern "C" { 800 # endif 801 # if !GNULIB_defined_function_taking_int_returning_void_t 802 typedef void (*_gl_function_taking_int_returning_void_t) (int); 803 # define GNULIB_defined_function_taking_int_returning_void_t 1 804 # endif 805 # ifdef __cplusplus 806 } 807 # endif 808 # if !1 809 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 810 # define signal rpl_signal 811 # endif 812 _GL_FUNCDECL_RPL (signal, _gl_function_taking_int_returning_void_t, 813 (int sig, _gl_function_taking_int_returning_void_t func)); 814 _GL_CXXALIAS_RPL (signal, _gl_function_taking_int_returning_void_t, 815 (int sig, _gl_function_taking_int_returning_void_t func)); 816 # else 817 /* On OpenBSD, the declaration of 'signal' may not be present at this point, 818 because it occurs in <sys/signal.h>, not <signal.h> directly. */ 819 # if defined __OpenBSD__ 820 _GL_FUNCDECL_SYS (signal, _gl_function_taking_int_returning_void_t, 821 (int sig, _gl_function_taking_int_returning_void_t func)); 822 # endif 823 _GL_CXXALIAS_SYS (signal, _gl_function_taking_int_returning_void_t, 824 (int sig, _gl_function_taking_int_returning_void_t func)); 825 # endif 826 # if __GLIBC__ >= 2 827 _GL_CXXALIASWARN (signal); 828 # endif 829 830 # if !1 && GNULIB_defined_SIGPIPE 831 /* Raise signal SIGPIPE. */ 832 _GL_EXTERN_C int _gl_raise_SIGPIPE (void); 833 # endif 834 835 #elif defined GNULIB_POSIXCHECK 836 # undef sigaddset 837 # if HAVE_RAW_DECL_SIGADDSET 838 _GL_WARN_ON_USE (sigaddset, "sigaddset is unportable - " 839 "use the gnulib module sigprocmask for portability"); 840 # endif 841 # undef sigdelset 842 # if HAVE_RAW_DECL_SIGDELSET 843 _GL_WARN_ON_USE (sigdelset, "sigdelset is unportable - " 844 "use the gnulib module sigprocmask for portability"); 845 # endif 846 # undef sigemptyset 847 # if HAVE_RAW_DECL_SIGEMPTYSET 848 _GL_WARN_ON_USE (sigemptyset, "sigemptyset is unportable - " 849 "use the gnulib module sigprocmask for portability"); 850 # endif 851 # undef sigfillset 852 # if HAVE_RAW_DECL_SIGFILLSET 853 _GL_WARN_ON_USE (sigfillset, "sigfillset is unportable - " 854 "use the gnulib module sigprocmask for portability"); 855 # endif 856 # undef sigismember 857 # if HAVE_RAW_DECL_SIGISMEMBER 858 _GL_WARN_ON_USE (sigismember, "sigismember is unportable - " 859 "use the gnulib module sigprocmask for portability"); 860 # endif 861 # undef sigpending 862 # if HAVE_RAW_DECL_SIGPENDING 863 _GL_WARN_ON_USE (sigpending, "sigpending is unportable - " 864 "use the gnulib module sigprocmask for portability"); 865 # endif 866 # undef sigprocmask 867 # if HAVE_RAW_DECL_SIGPROCMASK 868 _GL_WARN_ON_USE (sigprocmask, "sigprocmask is unportable - " 869 "use the gnulib module sigprocmask for portability"); 870 # endif 871 #endif /* 0 */ 872 873 874 #if 0 875 # if !1 876 877 # if !1 878 879 # if !GNULIB_defined_siginfo_types 880 881 /* Present to allow compilation, but unsupported by gnulib. */ 882 union sigval 883 { 884 int sival_int; 885 void *sival_ptr; 886 }; 887 888 /* Present to allow compilation, but unsupported by gnulib. */ 889 struct siginfo_t 890 { 891 int si_signo; 892 int si_code; 893 int si_errno; 894 pid_t si_pid; 895 uid_t si_uid; 896 void *si_addr; 897 int si_status; 898 long si_band; 899 union sigval si_value; 900 }; 901 typedef struct siginfo_t siginfo_t; 902 903 # define GNULIB_defined_siginfo_types 1 904 # endif 905 906 # endif /* !1 */ 907 908 /* We assume that platforms which lack the sigaction() function also lack 909 the 'struct sigaction' type, and vice versa. */ 910 911 # if !GNULIB_defined_struct_sigaction 912 913 struct sigaction 914 { 915 union 916 { 917 void (*_sa_handler) (int); 918 /* Present to allow compilation, but unsupported by gnulib. POSIX 919 says that implementations may, but not must, make sa_sigaction 920 overlap with sa_handler, but we know of no implementation where 921 they do not overlap. */ 922 void (*_sa_sigaction) (int, siginfo_t *, void *); 923 } _sa_func; 924 sigset_t sa_mask; 925 /* Not all POSIX flags are supported. */ 926 int sa_flags; 927 }; 928 # define sa_handler _sa_func._sa_handler 929 # define sa_sigaction _sa_func._sa_sigaction 930 /* Unsupported flags are not present. */ 931 # define SA_RESETHAND 1 932 # define SA_NODEFER 2 933 # define SA_RESTART 4 934 935 # define GNULIB_defined_struct_sigaction 1 936 # endif 937 938 _GL_FUNCDECL_SYS (sigaction, int, (int, const struct sigaction *restrict, 939 struct sigaction *restrict)); 940 941 # elif !1 942 943 # define sa_sigaction sa_handler 944 945 # endif /* !1, !1 */ 946 947 _GL_CXXALIAS_SYS (sigaction, int, (int, const struct sigaction *restrict, 948 struct sigaction *restrict)); 949 _GL_CXXALIASWARN (sigaction); 950 951 #elif defined GNULIB_POSIXCHECK 952 # undef sigaction 953 # if HAVE_RAW_DECL_SIGACTION 954 _GL_WARN_ON_USE (sigaction, "sigaction is unportable - " 955 "use the gnulib module sigaction for portability"); 956 # endif 957 #endif 958 959 /* Some systems don't have SA_NODEFER. */ 960 #ifndef SA_NODEFER 961 # define SA_NODEFER 0 962 #endif 963 964 965 #endif /* _GL_SIGNAL_H */ 966 #endif /* _GL_SIGNAL_H */ 967 #endif 968