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