1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 2 /* A POSIX <locale.h>. 3 Copyright (C) 2007-2021 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 #if __GNUC__ >= 3 19 #pragma GCC system_header 20 #endif 21 22 23 #if (defined _WIN32 && !defined __CYGWIN__ && defined __need_locale_t) \ 24 || defined _GL_ALREADY_INCLUDING_LOCALE_H 25 26 /* Special invocation convention: 27 - Inside mingw header files, 28 - To handle Solaris header files (through Solaris 10) when combined 29 with gettext's libintl.h. */ 30 31 #include_next <locale.h> 32 33 #else 34 /* Normal invocation convention. */ 35 36 #ifndef _GL_LOCALE_H 37 38 #define _GL_ALREADY_INCLUDING_LOCALE_H 39 40 /* The include_next requires a split double-inclusion guard. */ 41 #include_next <locale.h> 42 43 #undef _GL_ALREADY_INCLUDING_LOCALE_H 44 45 #ifndef _GL_LOCALE_H 46 #define _GL_LOCALE_H 47 48 /* NetBSD 5.0 mis-defines NULL. */ 49 #include <stddef.h> 50 51 /* Mac OS X 10.5 defines the locale_t type in <xlocale.h>. */ 52 #if 0 53 # include <xlocale.h> 54 #endif 55 56 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 57 /* C++ compatible function declaration macros. 58 Copyright (C) 2010-2021 Free Software Foundation, Inc. 59 60 This program is free software: you can redistribute it and/or modify it 61 under the terms of the GNU Lesser General Public License as published 62 by the Free Software Foundation; either version 2 of the License, or 63 (at your option) any later version. 64 65 This program is distributed in the hope that it will be useful, 66 but WITHOUT ANY WARRANTY; without even the implied warranty of 67 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 68 Lesser General Public License for more details. 69 70 You should have received a copy of the GNU Lesser General Public License 71 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 72 73 #ifndef _GL_CXXDEFS_H 74 #define _GL_CXXDEFS_H 75 76 /* Begin/end the GNULIB_NAMESPACE namespace. */ 77 #if defined __cplusplus && defined GNULIB_NAMESPACE 78 # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { 79 # define _GL_END_NAMESPACE } 80 #else 81 # define _GL_BEGIN_NAMESPACE 82 # define _GL_END_NAMESPACE 83 #endif 84 85 /* The three most frequent use cases of these macros are: 86 87 * For providing a substitute for a function that is missing on some 88 platforms, but is declared and works fine on the platforms on which 89 it exists: 90 91 #if @GNULIB_FOO@ 92 # if !@HAVE_FOO@ 93 _GL_FUNCDECL_SYS (foo, ...); 94 # endif 95 _GL_CXXALIAS_SYS (foo, ...); 96 _GL_CXXALIASWARN (foo); 97 #elif defined GNULIB_POSIXCHECK 98 ... 99 #endif 100 101 * For providing a replacement for a function that exists on all platforms, 102 but is broken/insufficient and needs to be replaced on some platforms: 103 104 #if @GNULIB_FOO@ 105 # if @REPLACE_FOO@ 106 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 107 # undef foo 108 # define foo rpl_foo 109 # endif 110 _GL_FUNCDECL_RPL (foo, ...); 111 _GL_CXXALIAS_RPL (foo, ...); 112 # else 113 _GL_CXXALIAS_SYS (foo, ...); 114 # endif 115 _GL_CXXALIASWARN (foo); 116 #elif defined GNULIB_POSIXCHECK 117 ... 118 #endif 119 120 * For providing a replacement for a function that exists on some platforms 121 but is broken/insufficient and needs to be replaced on some of them and 122 is additionally either missing or undeclared on some other platforms: 123 124 #if @GNULIB_FOO@ 125 # if @REPLACE_FOO@ 126 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 127 # undef foo 128 # define foo rpl_foo 129 # endif 130 _GL_FUNCDECL_RPL (foo, ...); 131 _GL_CXXALIAS_RPL (foo, ...); 132 # else 133 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ 134 _GL_FUNCDECL_SYS (foo, ...); 135 # endif 136 _GL_CXXALIAS_SYS (foo, ...); 137 # endif 138 _GL_CXXALIASWARN (foo); 139 #elif defined GNULIB_POSIXCHECK 140 ... 141 #endif 142 */ 143 144 /* _GL_EXTERN_C declaration; 145 performs the declaration with C linkage. */ 146 #if defined __cplusplus 147 # define _GL_EXTERN_C extern "C" 148 #else 149 # define _GL_EXTERN_C extern 150 #endif 151 152 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); 153 declares a replacement function, named rpl_func, with the given prototype, 154 consisting of return type, parameters, and attributes. 155 Example: 156 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) 157 _GL_ARG_NONNULL ((1))); 158 */ 159 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ 160 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) 161 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ 162 _GL_EXTERN_C rettype rpl_func parameters_and_attributes 163 164 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); 165 declares the system function, named func, with the given prototype, 166 consisting of return type, parameters, and attributes. 167 Example: 168 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) 169 _GL_ARG_NONNULL ((1))); 170 */ 171 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ 172 _GL_EXTERN_C rettype func parameters_and_attributes 173 174 /* _GL_CXXALIAS_RPL (func, rettype, parameters); 175 declares a C++ alias called GNULIB_NAMESPACE::func 176 that redirects to rpl_func, if GNULIB_NAMESPACE is defined. 177 Example: 178 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); 179 180 Wrapping rpl_func in an object with an inline conversion operator 181 avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is 182 actually used in the program. */ 183 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ 184 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) 185 #if defined __cplusplus && defined GNULIB_NAMESPACE 186 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 187 namespace GNULIB_NAMESPACE \ 188 { \ 189 static const struct _gl_ ## func ## _wrapper \ 190 { \ 191 typedef rettype (*type) parameters; \ 192 \ 193 inline operator type () const \ 194 { \ 195 return ::rpl_func; \ 196 } \ 197 } func = {}; \ 198 } \ 199 _GL_EXTERN_C int _gl_cxxalias_dummy 200 #else 201 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 202 _GL_EXTERN_C int _gl_cxxalias_dummy 203 #endif 204 205 /* _GL_CXXALIAS_MDA (func, rettype, parameters); 206 is to be used when func is a Microsoft deprecated alias, on native Windows. 207 It declares a C++ alias called GNULIB_NAMESPACE::func 208 that redirects to _func, if GNULIB_NAMESPACE is defined. 209 Example: 210 _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...)); 211 */ 212 #define _GL_CXXALIAS_MDA(func,rettype,parameters) \ 213 _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters) 214 215 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); 216 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); 217 except that the C function rpl_func may have a slightly different 218 declaration. A cast is used to silence the "invalid conversion" error 219 that would otherwise occur. */ 220 #if defined __cplusplus && defined GNULIB_NAMESPACE 221 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 222 namespace GNULIB_NAMESPACE \ 223 { \ 224 static const struct _gl_ ## func ## _wrapper \ 225 { \ 226 typedef rettype (*type) parameters; \ 227 \ 228 inline operator type () const \ 229 { \ 230 return reinterpret_cast<type>(::rpl_func); \ 231 } \ 232 } func = {}; \ 233 } \ 234 _GL_EXTERN_C int _gl_cxxalias_dummy 235 #else 236 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 237 _GL_EXTERN_C int _gl_cxxalias_dummy 238 #endif 239 240 /* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters); 241 is like _GL_CXXALIAS_MDA (func, rettype, parameters); 242 except that the C function func may have a slightly different declaration. 243 A cast is used to silence the "invalid conversion" error that would 244 otherwise occur. */ 245 #define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \ 246 _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters) 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 !(defined __GNUC__ && !defined __clang__ && __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 !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) 374 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 375 _GL_WARN_ON_USE_CXX (func, rettype, 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-2021 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 Lesser General Public License as published 395 by the Free Software Foundation; either version 2 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 Lesser General Public License for more details. 402 403 You should have received a copy of the GNU Lesser 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__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__ 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-2021 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 Lesser General Public License as published 423 by the Free Software Foundation; either version 2 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 Lesser General Public License for more details. 430 431 You should have received a copy of the GNU Lesser 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 __clang_major__ >= 4 508 /* Another compiler attribute is available in clang. */ 509 # define _GL_WARN_ON_USE(function, message) \ 510 extern __typeof__ (function) function \ 511 __attribute__ ((__diagnose_if__ (1, message, "warning"))) 512 # define _GL_WARN_ON_USE_ATTRIBUTE(message) \ 513 __attribute__ ((__diagnose_if__ (1, message, "warning"))) 514 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 515 /* Verify the existence of the function. */ 516 # define _GL_WARN_ON_USE(function, message) \ 517 extern __typeof__ (function) function 518 # define _GL_WARN_ON_USE_ATTRIBUTE(message) 519 # else /* Unsupported. */ 520 # define _GL_WARN_ON_USE(function, message) \ 521 _GL_WARN_EXTERN_C int _gl_warn_on_use 522 # define _GL_WARN_ON_USE_ATTRIBUTE(message) 523 # endif 524 #endif 525 526 /* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message") 527 is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the 528 function is declared with the given prototype, consisting of return type, 529 parameters, and attributes. 530 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does 531 not work in this case. */ 532 #ifndef _GL_WARN_ON_USE_CXX 533 # if !defined __cplusplus 534 # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ 535 _GL_WARN_ON_USE (function, msg) 536 # else 537 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 538 /* A compiler attribute is available in gcc versions 4.3.0 and later. */ 539 # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ 540 extern rettype_gcc function parameters_and_attributes \ 541 __attribute__ ((__warning__ (msg))) 542 # elif __clang_major__ >= 4 543 /* Another compiler attribute is available in clang. */ 544 # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ 545 extern rettype_clang function parameters_and_attributes \ 546 __attribute__ ((__diagnose_if__ (1, msg, "warning"))) 547 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 548 /* Verify the existence of the function. */ 549 # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ 550 extern rettype_gcc function parameters_and_attributes 551 # else /* Unsupported. */ 552 # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ 553 _GL_WARN_EXTERN_C int _gl_warn_on_use 554 # endif 555 # endif 556 #endif 557 558 /* _GL_WARN_EXTERN_C declaration; 559 performs the declaration with C linkage. */ 560 #ifndef _GL_WARN_EXTERN_C 561 # if defined __cplusplus 562 # define _GL_WARN_EXTERN_C extern "C" 563 # else 564 # define _GL_WARN_EXTERN_C extern 565 # endif 566 #endif 567 568 /* The LC_MESSAGES locale category is specified in POSIX, but not in ISO C. 569 On systems that don't define it, use the same value as GNU libintl. */ 570 #if !defined LC_MESSAGES 571 # define LC_MESSAGES 1729 572 #endif 573 574 /* On native Windows with MSVC, 'struct lconv' lacks the members int_p_* and 575 int_n_*. Instead of overriding 'struct lconv', merely define these member 576 names as macros. This avoids trouble in C++ mode. */ 577 #if defined _MSC_VER 578 # define int_p_cs_precedes p_cs_precedes 579 # define int_p_sign_posn p_sign_posn 580 # define int_p_sep_by_space p_sep_by_space 581 # define int_n_cs_precedes n_cs_precedes 582 # define int_n_sign_posn n_sign_posn 583 # define int_n_sep_by_space n_sep_by_space 584 #endif 585 586 /* Bionic libc's 'struct lconv' is just a dummy. */ 587 #if 1 588 # define lconv rpl_lconv 589 struct lconv 590 { 591 /* All 'char *' are actually 'const char *'. */ 592 593 /* Members that depend on the LC_NUMERIC category of the locale. See 594 <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_04> */ 595 596 /* Symbol used as decimal point. */ 597 char *decimal_point; 598 /* Symbol used to separate groups of digits to the left of the decimal 599 point. */ 600 char *thousands_sep; 601 /* Definition of the size of groups of digits to the left of the decimal 602 point. */ 603 char *grouping; 604 605 /* Members that depend on the LC_MONETARY category of the locale. See 606 <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_03> */ 607 608 /* Symbol used as decimal point. */ 609 char *mon_decimal_point; 610 /* Symbol used to separate groups of digits to the left of the decimal 611 point. */ 612 char *mon_thousands_sep; 613 /* Definition of the size of groups of digits to the left of the decimal 614 point. */ 615 char *mon_grouping; 616 /* Sign used to indicate a value >= 0. */ 617 char *positive_sign; 618 /* Sign used to indicate a value < 0. */ 619 char *negative_sign; 620 621 /* For formatting local currency. */ 622 /* Currency symbol (3 characters) followed by separator (1 character). */ 623 char *currency_symbol; 624 /* Number of digits after the decimal point. */ 625 char frac_digits; 626 /* For values >= 0: 1 if the currency symbol precedes the number, 0 if it 627 comes after the number. */ 628 char p_cs_precedes; 629 /* For values >= 0: Position of the sign. */ 630 char p_sign_posn; 631 /* For values >= 0: Placement of spaces between currency symbol, sign, and 632 number. */ 633 char p_sep_by_space; 634 /* For values < 0: 1 if the currency symbol precedes the number, 0 if it 635 comes after the number. */ 636 char n_cs_precedes; 637 /* For values < 0: Position of the sign. */ 638 char n_sign_posn; 639 /* For values < 0: Placement of spaces between currency symbol, sign, and 640 number. */ 641 char n_sep_by_space; 642 643 /* For formatting international currency. */ 644 /* Currency symbol (3 characters) followed by separator (1 character). */ 645 char *int_curr_symbol; 646 /* Number of digits after the decimal point. */ 647 char int_frac_digits; 648 /* For values >= 0: 1 if the currency symbol precedes the number, 0 if it 649 comes after the number. */ 650 char int_p_cs_precedes; 651 /* For values >= 0: Position of the sign. */ 652 char int_p_sign_posn; 653 /* For values >= 0: Placement of spaces between currency symbol, sign, and 654 number. */ 655 char int_p_sep_by_space; 656 /* For values < 0: 1 if the currency symbol precedes the number, 0 if it 657 comes after the number. */ 658 char int_n_cs_precedes; 659 /* For values < 0: Position of the sign. */ 660 char int_n_sign_posn; 661 /* For values < 0: Placement of spaces between currency symbol, sign, and 662 number. */ 663 char int_n_sep_by_space; 664 }; 665 #endif 666 667 #if 1 668 # if 1 669 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 670 # undef localeconv 671 # define localeconv rpl_localeconv 672 # endif 673 _GL_FUNCDECL_RPL (localeconv, struct lconv *, (void)); 674 _GL_CXXALIAS_RPL (localeconv, struct lconv *, (void)); 675 # else 676 _GL_CXXALIAS_SYS (localeconv, struct lconv *, (void)); 677 # endif 678 # if __GLIBC__ >= 2 679 _GL_CXXALIASWARN (localeconv); 680 # endif 681 #elif 1 682 # undef localeconv 683 # define localeconv localeconv_used_without_requesting_gnulib_module_localeconv 684 #elif defined GNULIB_POSIXCHECK 685 # undef localeconv 686 # if HAVE_RAW_DECL_LOCALECONV 687 _GL_WARN_ON_USE (localeconv, 688 "localeconv returns too few information on some platforms - " 689 "use gnulib module localeconv for portability"); 690 # endif 691 #endif 692 693 #if 0 694 # if 0 695 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 696 # undef setlocale 697 # define setlocale rpl_setlocale 698 # define GNULIB_defined_setlocale 1 699 # endif 700 _GL_FUNCDECL_RPL (setlocale, char *, (int category, const char *locale)); 701 _GL_CXXALIAS_RPL (setlocale, char *, (int category, const char *locale)); 702 # else 703 _GL_CXXALIAS_SYS (setlocale, char *, (int category, const char *locale)); 704 # endif 705 # if __GLIBC__ >= 2 706 _GL_CXXALIASWARN (setlocale); 707 # endif 708 #elif defined GNULIB_POSIXCHECK 709 # undef setlocale 710 # if HAVE_RAW_DECL_SETLOCALE 711 _GL_WARN_ON_USE (setlocale, "setlocale works differently on native Windows - " 712 "use gnulib module setlocale for portability"); 713 # endif 714 #endif 715 716 #if 1 717 /* Included here for convenience. */ 718 # include "setlocale_null.h" 719 #endif 720 721 #if /*@GNULIB_NEWLOCALE@ ||*/ (0 && 0 && 1) 722 # if 0 723 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 724 # undef newlocale 725 # define newlocale rpl_newlocale 726 # define GNULIB_defined_newlocale 1 727 # endif 728 _GL_FUNCDECL_RPL (newlocale, locale_t, 729 (int category_mask, const char *name, locale_t base) 730 _GL_ARG_NONNULL ((2))); 731 _GL_CXXALIAS_RPL (newlocale, locale_t, 732 (int category_mask, const char *name, locale_t base)); 733 # else 734 # if 1 735 _GL_CXXALIAS_SYS (newlocale, locale_t, 736 (int category_mask, const char *name, locale_t base)); 737 # endif 738 # endif 739 # if 1 740 _GL_CXXALIASWARN (newlocale); 741 # endif 742 # if 1 || 0 743 # ifndef HAVE_WORKING_NEWLOCALE 744 # define HAVE_WORKING_NEWLOCALE 1 745 # endif 746 # endif 747 #elif defined GNULIB_POSIXCHECK 748 # undef newlocale 749 # if HAVE_RAW_DECL_NEWLOCALE 750 _GL_WARN_ON_USE (newlocale, "newlocale is not portable"); 751 # endif 752 #endif 753 754 #if 0 || (0 && 0 && 1) 755 # if 0 756 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 757 # undef duplocale 758 # define duplocale rpl_duplocale 759 # define GNULIB_defined_duplocale 1 760 # endif 761 _GL_FUNCDECL_RPL (duplocale, locale_t, (locale_t locale) _GL_ARG_NONNULL ((1))); 762 _GL_CXXALIAS_RPL (duplocale, locale_t, (locale_t locale)); 763 # else 764 # if 1 765 _GL_CXXALIAS_SYS (duplocale, locale_t, (locale_t locale)); 766 # endif 767 # endif 768 # if 1 769 _GL_CXXALIASWARN (duplocale); 770 # endif 771 # if 1 || 0 772 # ifndef HAVE_WORKING_DUPLOCALE 773 # define HAVE_WORKING_DUPLOCALE 1 774 # endif 775 # endif 776 #elif defined GNULIB_POSIXCHECK 777 # undef duplocale 778 # if HAVE_RAW_DECL_DUPLOCALE 779 _GL_WARN_ON_USE (duplocale, "duplocale is buggy on some glibc systems - " 780 "use gnulib module duplocale for portability"); 781 # endif 782 #endif 783 784 #if /*@GNULIB_FREELOCALE@ ||*/ (0 && 0 && 1) 785 # if 0 786 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 787 # undef freelocale 788 # define freelocale rpl_freelocale 789 # define GNULIB_defined_freelocale 1 790 # endif 791 _GL_FUNCDECL_RPL (freelocale, void, (locale_t locale) _GL_ARG_NONNULL ((1))); 792 _GL_CXXALIAS_RPL (freelocale, void, (locale_t locale)); 793 # else 794 # if 1 795 /* Need to cast, because on FreeBSD and Mac OS X 10.13, the return type is 796 int. */ 797 _GL_CXXALIAS_SYS_CAST (freelocale, void, (locale_t locale)); 798 # endif 799 # endif 800 # if 1 801 _GL_CXXALIASWARN (freelocale); 802 # endif 803 #elif defined GNULIB_POSIXCHECK 804 # undef freelocale 805 # if HAVE_RAW_DECL_FREELOCALE 806 _GL_WARN_ON_USE (freelocale, "freelocale is not portable"); 807 # endif 808 #endif 809 810 #endif /* _GL_LOCALE_H */ 811 #endif /* _GL_LOCALE_H */ 812 #endif /* !(__need_locale_t || _GL_ALREADY_INCLUDING_LOCALE_H) */ 813