1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 2 /* A GNU-like <string.h>. 3 4 Copyright (C) 1995-1996, 2001-2021 Free Software Foundation, Inc. 5 6 This file is free software: you can redistribute it and/or modify 7 it under the terms of the GNU Lesser General Public License as 8 published by the Free Software Foundation; either version 2.1 of the 9 License, or (at your option) any later version. 10 11 This file is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU Lesser General Public License for more details. 15 16 You should have received a copy of the GNU Lesser General Public License 17 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 18 19 #if __GNUC__ >= 3 20 #pragma GCC system_header 21 #endif 22 23 24 #if defined _GL_ALREADY_INCLUDING_STRING_H 25 /* Special invocation convention: 26 - On OS X/NetBSD we have a sequence of nested includes 27 <string.h> -> <strings.h> -> "string.h" 28 In this situation system _chk variants due to -D_FORTIFY_SOURCE 29 might be used after any replacements defined here. */ 30 31 #include_next <string.h> 32 33 #else 34 /* Normal invocation convention. */ 35 36 #ifndef _GL_STRING_H 37 38 #define _GL_ALREADY_INCLUDING_STRING_H 39 40 /* The include_next requires a split double-inclusion guard. */ 41 #include_next <string.h> 42 43 #undef _GL_ALREADY_INCLUDING_STRING_H 44 45 #ifndef _GL_STRING_H 46 #define _GL_STRING_H 47 48 /* NetBSD 5.0 mis-defines NULL. */ 49 #include <stddef.h> 50 51 /* MirBSD defines mbslen as a macro. */ 52 #if 0 && defined __MirBSD__ 53 # include <wchar.h> 54 #endif 55 56 /* The __attribute__ feature is available in gcc versions 2.5 and later. 57 The attribute __pure__ was added in gcc 2.96. */ 58 #ifndef _GL_ATTRIBUTE_PURE 59 # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__ 60 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) 61 # else 62 # define _GL_ATTRIBUTE_PURE /* empty */ 63 # endif 64 #endif 65 66 /* NetBSD 5.0 declares strsignal in <unistd.h>, not in <string.h>. */ 67 /* But in any case avoid namespace pollution on glibc systems. */ 68 #if (0 || defined GNULIB_POSIXCHECK) && defined __NetBSD__ \ 69 && ! defined __GLIBC__ 70 # include <unistd.h> 71 #endif 72 73 /* AIX 7.2 declares ffsl and ffsll in <strings.h>, not in <string.h>. */ 74 /* But in any case avoid namespace pollution on glibc systems. */ 75 #if ((0 || 0 || defined GNULIB_POSIXCHECK) \ 76 && defined _AIX) \ 77 && ! defined __GLIBC__ 78 # include <strings.h> 79 #endif 80 81 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 82 /* C++ compatible function declaration macros. 83 Copyright (C) 2010-2021 Free Software Foundation, Inc. 84 85 This program is free software: you can redistribute it and/or modify it 86 under the terms of the GNU Lesser General Public License as published 87 by the Free Software Foundation; either version 2 of the License, or 88 (at your option) any later version. 89 90 This program is distributed in the hope that it will be useful, 91 but WITHOUT ANY WARRANTY; without even the implied warranty of 92 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 93 Lesser General Public License for more details. 94 95 You should have received a copy of the GNU Lesser General Public License 96 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 97 98 #ifndef _GL_CXXDEFS_H 99 #define _GL_CXXDEFS_H 100 101 /* Begin/end the GNULIB_NAMESPACE namespace. */ 102 #if defined __cplusplus && defined GNULIB_NAMESPACE 103 # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { 104 # define _GL_END_NAMESPACE } 105 #else 106 # define _GL_BEGIN_NAMESPACE 107 # define _GL_END_NAMESPACE 108 #endif 109 110 /* The three most frequent use cases of these macros are: 111 112 * For providing a substitute for a function that is missing on some 113 platforms, but is declared and works fine on the platforms on which 114 it exists: 115 116 #if @GNULIB_FOO@ 117 # if !@HAVE_FOO@ 118 _GL_FUNCDECL_SYS (foo, ...); 119 # endif 120 _GL_CXXALIAS_SYS (foo, ...); 121 _GL_CXXALIASWARN (foo); 122 #elif defined GNULIB_POSIXCHECK 123 ... 124 #endif 125 126 * For providing a replacement for a function that exists on all platforms, 127 but is broken/insufficient and needs to be replaced on some platforms: 128 129 #if @GNULIB_FOO@ 130 # if @REPLACE_FOO@ 131 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 132 # undef foo 133 # define foo rpl_foo 134 # endif 135 _GL_FUNCDECL_RPL (foo, ...); 136 _GL_CXXALIAS_RPL (foo, ...); 137 # else 138 _GL_CXXALIAS_SYS (foo, ...); 139 # endif 140 _GL_CXXALIASWARN (foo); 141 #elif defined GNULIB_POSIXCHECK 142 ... 143 #endif 144 145 * For providing a replacement for a function that exists on some platforms 146 but is broken/insufficient and needs to be replaced on some of them and 147 is additionally either missing or undeclared on some other platforms: 148 149 #if @GNULIB_FOO@ 150 # if @REPLACE_FOO@ 151 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 152 # undef foo 153 # define foo rpl_foo 154 # endif 155 _GL_FUNCDECL_RPL (foo, ...); 156 _GL_CXXALIAS_RPL (foo, ...); 157 # else 158 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ 159 _GL_FUNCDECL_SYS (foo, ...); 160 # endif 161 _GL_CXXALIAS_SYS (foo, ...); 162 # endif 163 _GL_CXXALIASWARN (foo); 164 #elif defined GNULIB_POSIXCHECK 165 ... 166 #endif 167 */ 168 169 /* _GL_EXTERN_C declaration; 170 performs the declaration with C linkage. */ 171 #if defined __cplusplus 172 # define _GL_EXTERN_C extern "C" 173 #else 174 # define _GL_EXTERN_C extern 175 #endif 176 177 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); 178 declares a replacement function, named rpl_func, with the given prototype, 179 consisting of return type, parameters, and attributes. 180 Example: 181 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) 182 _GL_ARG_NONNULL ((1))); 183 */ 184 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ 185 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) 186 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ 187 _GL_EXTERN_C rettype rpl_func parameters_and_attributes 188 189 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); 190 declares the system function, named func, with the given prototype, 191 consisting of return type, parameters, and attributes. 192 Example: 193 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) 194 _GL_ARG_NONNULL ((1))); 195 */ 196 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ 197 _GL_EXTERN_C rettype func parameters_and_attributes 198 199 /* _GL_CXXALIAS_RPL (func, rettype, parameters); 200 declares a C++ alias called GNULIB_NAMESPACE::func 201 that redirects to rpl_func, if GNULIB_NAMESPACE is defined. 202 Example: 203 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); 204 205 Wrapping rpl_func in an object with an inline conversion operator 206 avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is 207 actually used in the program. */ 208 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ 209 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) 210 #if defined __cplusplus && defined GNULIB_NAMESPACE 211 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 212 namespace GNULIB_NAMESPACE \ 213 { \ 214 static const struct _gl_ ## func ## _wrapper \ 215 { \ 216 typedef rettype (*type) parameters; \ 217 \ 218 inline operator type () const \ 219 { \ 220 return ::rpl_func; \ 221 } \ 222 } func = {}; \ 223 } \ 224 _GL_EXTERN_C int _gl_cxxalias_dummy 225 #else 226 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 227 _GL_EXTERN_C int _gl_cxxalias_dummy 228 #endif 229 230 /* _GL_CXXALIAS_MDA (func, rettype, parameters); 231 is to be used when func is a Microsoft deprecated alias, on native Windows. 232 It declares a C++ alias called GNULIB_NAMESPACE::func 233 that redirects to _func, if GNULIB_NAMESPACE is defined. 234 Example: 235 _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...)); 236 */ 237 #define _GL_CXXALIAS_MDA(func,rettype,parameters) \ 238 _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters) 239 240 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); 241 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); 242 except that the C function rpl_func may have a slightly different 243 declaration. A cast is used to silence the "invalid conversion" error 244 that would otherwise occur. */ 245 #if defined __cplusplus && defined GNULIB_NAMESPACE 246 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 247 namespace GNULIB_NAMESPACE \ 248 { \ 249 static const struct _gl_ ## func ## _wrapper \ 250 { \ 251 typedef rettype (*type) parameters; \ 252 \ 253 inline operator type () const \ 254 { \ 255 return reinterpret_cast<type>(::rpl_func); \ 256 } \ 257 } func = {}; \ 258 } \ 259 _GL_EXTERN_C int _gl_cxxalias_dummy 260 #else 261 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 262 _GL_EXTERN_C int _gl_cxxalias_dummy 263 #endif 264 265 /* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters); 266 is like _GL_CXXALIAS_MDA (func, rettype, parameters); 267 except that the C function func may have a slightly different declaration. 268 A cast is used to silence the "invalid conversion" error that would 269 otherwise occur. */ 270 #define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \ 271 _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters) 272 273 /* _GL_CXXALIAS_SYS (func, rettype, parameters); 274 declares a C++ alias called GNULIB_NAMESPACE::func 275 that redirects to the system provided function func, if GNULIB_NAMESPACE 276 is defined. 277 Example: 278 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); 279 280 Wrapping func in an object with an inline conversion operator 281 avoids a reference to func unless GNULIB_NAMESPACE::func is 282 actually used in the program. */ 283 #if defined __cplusplus && defined GNULIB_NAMESPACE 284 # define _GL_CXXALIAS_SYS(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 ::func; \ 294 } \ 295 } func = {}; \ 296 } \ 297 _GL_EXTERN_C int _gl_cxxalias_dummy 298 #else 299 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 300 _GL_EXTERN_C int _gl_cxxalias_dummy 301 #endif 302 303 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); 304 is like _GL_CXXALIAS_SYS (func, rettype, parameters); 305 except that the C function func may have a slightly different declaration. 306 A cast is used to silence the "invalid conversion" error that would 307 otherwise occur. */ 308 #if defined __cplusplus && defined GNULIB_NAMESPACE 309 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 310 namespace GNULIB_NAMESPACE \ 311 { \ 312 static const struct _gl_ ## func ## _wrapper \ 313 { \ 314 typedef rettype (*type) parameters; \ 315 \ 316 inline operator type () const \ 317 { \ 318 return reinterpret_cast<type>(::func); \ 319 } \ 320 } func = {}; \ 321 } \ 322 _GL_EXTERN_C int _gl_cxxalias_dummy 323 #else 324 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 325 _GL_EXTERN_C int _gl_cxxalias_dummy 326 #endif 327 328 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); 329 is like _GL_CXXALIAS_SYS (func, rettype, parameters); 330 except that the C function is picked among a set of overloaded functions, 331 namely the one with rettype2 and parameters2. Two consecutive casts 332 are used to silence the "cannot find a match" and "invalid conversion" 333 errors that would otherwise occur. */ 334 #if defined __cplusplus && defined GNULIB_NAMESPACE 335 /* The outer cast must be a reinterpret_cast. 336 The inner cast: When the function is defined as a set of overloaded 337 functions, it works as a static_cast<>, choosing the designated variant. 338 When the function is defined as a single variant, it works as a 339 reinterpret_cast<>. The parenthesized cast syntax works both ways. */ 340 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 341 namespace GNULIB_NAMESPACE \ 342 { \ 343 static const struct _gl_ ## func ## _wrapper \ 344 { \ 345 typedef rettype (*type) parameters; \ 346 \ 347 inline operator type () const \ 348 { \ 349 return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \ 350 } \ 351 } func = {}; \ 352 } \ 353 _GL_EXTERN_C int _gl_cxxalias_dummy 354 #else 355 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 356 _GL_EXTERN_C int _gl_cxxalias_dummy 357 #endif 358 359 /* _GL_CXXALIASWARN (func); 360 causes a warning to be emitted when ::func is used but not when 361 GNULIB_NAMESPACE::func is used. func must be defined without overloaded 362 variants. */ 363 #if defined __cplusplus && defined GNULIB_NAMESPACE 364 # define _GL_CXXALIASWARN(func) \ 365 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) 366 # define _GL_CXXALIASWARN_1(func,namespace) \ 367 _GL_CXXALIASWARN_2 (func, namespace) 368 /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 369 we enable the warning only when not optimizing. */ 370 # if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) 371 # define _GL_CXXALIASWARN_2(func,namespace) \ 372 _GL_WARN_ON_USE (func, \ 373 "The symbol ::" #func " refers to the system function. " \ 374 "Use " #namespace "::" #func " instead.") 375 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 376 # define _GL_CXXALIASWARN_2(func,namespace) \ 377 extern __typeof__ (func) func 378 # else 379 # define _GL_CXXALIASWARN_2(func,namespace) \ 380 _GL_EXTERN_C int _gl_cxxalias_dummy 381 # endif 382 #else 383 # define _GL_CXXALIASWARN(func) \ 384 _GL_EXTERN_C int _gl_cxxalias_dummy 385 #endif 386 387 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); 388 causes a warning to be emitted when the given overloaded variant of ::func 389 is used but not when GNULIB_NAMESPACE::func is used. */ 390 #if defined __cplusplus && defined GNULIB_NAMESPACE 391 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 392 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ 393 GNULIB_NAMESPACE) 394 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ 395 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) 396 /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 397 we enable the warning only when not optimizing. */ 398 # if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) 399 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 400 _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \ 401 "The symbol ::" #func " refers to the system function. " \ 402 "Use " #namespace "::" #func " instead.") 403 # else 404 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 405 _GL_EXTERN_C int _gl_cxxalias_dummy 406 # endif 407 #else 408 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 409 _GL_EXTERN_C int _gl_cxxalias_dummy 410 #endif 411 412 #endif /* _GL_CXXDEFS_H */ 413 414 /* The definition of _GL_ARG_NONNULL is copied here. */ 415 /* A C macro for declaring that specific arguments must not be NULL. 416 Copyright (C) 2009-2021 Free Software Foundation, Inc. 417 418 This program is free software: you can redistribute it and/or modify it 419 under the terms of the GNU Lesser General Public License as published 420 by the Free Software Foundation; either version 2 of the License, or 421 (at your option) any later version. 422 423 This program is distributed in the hope that it will be useful, 424 but WITHOUT ANY WARRANTY; without even the implied warranty of 425 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 426 Lesser General Public License for more details. 427 428 You should have received a copy of the GNU Lesser General Public License 429 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 430 431 /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools 432 that the values passed as arguments n, ..., m must be non-NULL pointers. 433 n = 1 stands for the first argument, n = 2 for the second argument etc. */ 434 #ifndef _GL_ARG_NONNULL 435 # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__ 436 # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) 437 # else 438 # define _GL_ARG_NONNULL(params) 439 # endif 440 #endif 441 442 /* The definition of _GL_WARN_ON_USE is copied here. */ 443 /* A C macro for emitting warnings if a function is used. 444 Copyright (C) 2010-2021 Free Software Foundation, Inc. 445 446 This program is free software: you can redistribute it and/or modify it 447 under the terms of the GNU Lesser General Public License as published 448 by the Free Software Foundation; either version 2 of the License, or 449 (at your option) any later version. 450 451 This program is distributed in the hope that it will be useful, 452 but WITHOUT ANY WARRANTY; without even the implied warranty of 453 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 454 Lesser General Public License for more details. 455 456 You should have received a copy of the GNU Lesser General Public License 457 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 458 459 /* _GL_WARN_ON_USE (function, "literal string") issues a declaration 460 for FUNCTION which will then trigger a compiler warning containing 461 the text of "literal string" anywhere that function is called, if 462 supported by the compiler. If the compiler does not support this 463 feature, the macro expands to an unused extern declaration. 464 465 _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the 466 attribute used in _GL_WARN_ON_USE. If the compiler does not support 467 this feature, it expands to empty. 468 469 These macros are useful for marking a function as a potential 470 portability trap, with the intent that "literal string" include 471 instructions on the replacement function that should be used 472 instead. 473 _GL_WARN_ON_USE is for functions with 'extern' linkage. 474 _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline' 475 linkage. 476 477 However, one of the reasons that a function is a portability trap is 478 if it has the wrong signature. Declaring FUNCTION with a different 479 signature in C is a compilation error, so this macro must use the 480 same type as any existing declaration so that programs that avoid 481 the problematic FUNCTION do not fail to compile merely because they 482 included a header that poisoned the function. But this implies that 483 _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already 484 have a declaration. Use of this macro implies that there must not 485 be any other macro hiding the declaration of FUNCTION; but 486 undefining FUNCTION first is part of the poisoning process anyway 487 (although for symbols that are provided only via a macro, the result 488 is a compilation error rather than a warning containing 489 "literal string"). Also note that in C++, it is only safe to use if 490 FUNCTION has no overloads. 491 492 For an example, it is possible to poison 'getline' by: 493 - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]], 494 [getline]) in configure.ac, which potentially defines 495 HAVE_RAW_DECL_GETLINE 496 - adding this code to a header that wraps the system <stdio.h>: 497 #undef getline 498 #if HAVE_RAW_DECL_GETLINE 499 _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" 500 "not universally present; use the gnulib module getline"); 501 #endif 502 503 It is not possible to directly poison global variables. But it is 504 possible to write a wrapper accessor function, and poison that 505 (less common usage, like &environ, will cause a compilation error 506 rather than issue the nice warning, but the end result of informing 507 the developer about their portability problem is still achieved): 508 #if HAVE_RAW_DECL_ENVIRON 509 static char *** 510 rpl_environ (void) { return &environ; } 511 _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); 512 # undef environ 513 # define environ (*rpl_environ ()) 514 #endif 515 or better (avoiding contradictory use of 'static' and 'extern'): 516 #if HAVE_RAW_DECL_ENVIRON 517 static char *** 518 _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared") 519 rpl_environ (void) { return &environ; } 520 # undef environ 521 # define environ (*rpl_environ ()) 522 #endif 523 */ 524 #ifndef _GL_WARN_ON_USE 525 526 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 527 /* A compiler attribute is available in gcc versions 4.3.0 and later. */ 528 # define _GL_WARN_ON_USE(function, message) \ 529 extern __typeof__ (function) function __attribute__ ((__warning__ (message))) 530 # define _GL_WARN_ON_USE_ATTRIBUTE(message) \ 531 __attribute__ ((__warning__ (message))) 532 # elif __clang_major__ >= 4 533 /* Another compiler attribute is available in clang. */ 534 # define _GL_WARN_ON_USE(function, message) \ 535 extern __typeof__ (function) function \ 536 __attribute__ ((__diagnose_if__ (1, message, "warning"))) 537 # define _GL_WARN_ON_USE_ATTRIBUTE(message) \ 538 __attribute__ ((__diagnose_if__ (1, message, "warning"))) 539 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 540 /* Verify the existence of the function. */ 541 # define _GL_WARN_ON_USE(function, message) \ 542 extern __typeof__ (function) function 543 # define _GL_WARN_ON_USE_ATTRIBUTE(message) 544 # else /* Unsupported. */ 545 # define _GL_WARN_ON_USE(function, message) \ 546 _GL_WARN_EXTERN_C int _gl_warn_on_use 547 # define _GL_WARN_ON_USE_ATTRIBUTE(message) 548 # endif 549 #endif 550 551 /* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message") 552 is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the 553 function is declared with the given prototype, consisting of return type, 554 parameters, and attributes. 555 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does 556 not work in this case. */ 557 #ifndef _GL_WARN_ON_USE_CXX 558 # if !defined __cplusplus 559 # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ 560 _GL_WARN_ON_USE (function, msg) 561 # else 562 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 563 /* A compiler attribute is available in gcc versions 4.3.0 and later. */ 564 # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ 565 extern rettype_gcc function parameters_and_attributes \ 566 __attribute__ ((__warning__ (msg))) 567 # elif __clang_major__ >= 4 568 /* Another compiler attribute is available in clang. */ 569 # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ 570 extern rettype_clang function parameters_and_attributes \ 571 __attribute__ ((__diagnose_if__ (1, msg, "warning"))) 572 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 573 /* Verify the existence of the function. */ 574 # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ 575 extern rettype_gcc function parameters_and_attributes 576 # else /* Unsupported. */ 577 # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ 578 _GL_WARN_EXTERN_C int _gl_warn_on_use 579 # endif 580 # endif 581 #endif 582 583 /* _GL_WARN_EXTERN_C declaration; 584 performs the declaration with C linkage. */ 585 #ifndef _GL_WARN_EXTERN_C 586 # if defined __cplusplus 587 # define _GL_WARN_EXTERN_C extern "C" 588 # else 589 # define _GL_WARN_EXTERN_C extern 590 # endif 591 #endif 592 593 594 /* Clear a block of memory. The compiler will not delete a call to 595 this function, even if the block is dead after the call. */ 596 #if 0 597 # if ! 1 598 _GL_FUNCDECL_SYS (explicit_bzero, void, 599 (void *__dest, size_t __n) _GL_ARG_NONNULL ((1))); 600 # endif 601 _GL_CXXALIAS_SYS (explicit_bzero, void, (void *__dest, size_t __n)); 602 _GL_CXXALIASWARN (explicit_bzero); 603 #elif defined GNULIB_POSIXCHECK 604 # undef explicit_bzero 605 # if HAVE_RAW_DECL_EXPLICIT_BZERO 606 _GL_WARN_ON_USE (explicit_bzero, "explicit_bzero is unportable - " 607 "use gnulib module explicit_bzero for portability"); 608 # endif 609 #endif 610 611 /* Find the index of the least-significant set bit. */ 612 #if 0 613 # if !1 614 _GL_FUNCDECL_SYS (ffsl, int, (long int i)); 615 # endif 616 _GL_CXXALIAS_SYS (ffsl, int, (long int i)); 617 _GL_CXXALIASWARN (ffsl); 618 #elif defined GNULIB_POSIXCHECK 619 # undef ffsl 620 # if HAVE_RAW_DECL_FFSL 621 _GL_WARN_ON_USE (ffsl, "ffsl is not portable - use the ffsl module"); 622 # endif 623 #endif 624 625 626 /* Find the index of the least-significant set bit. */ 627 #if 0 628 # if 0 629 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 630 # define ffsll rpl_ffsll 631 # endif 632 _GL_FUNCDECL_RPL (ffsll, int, (long long int i)); 633 _GL_CXXALIAS_RPL (ffsll, int, (long long int i)); 634 # else 635 # if !1 636 _GL_FUNCDECL_SYS (ffsll, int, (long long int i)); 637 # endif 638 _GL_CXXALIAS_SYS (ffsll, int, (long long int i)); 639 # endif 640 _GL_CXXALIASWARN (ffsll); 641 #elif defined GNULIB_POSIXCHECK 642 # undef ffsll 643 # if HAVE_RAW_DECL_FFSLL 644 _GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the ffsll module"); 645 # endif 646 #endif 647 648 649 #if 1 650 /* On native Windows, map 'memccpy' to '_memccpy', so that -loldnames is not 651 required. In C++ with GNULIB_NAMESPACE, avoid differences between 652 platforms by defining GNULIB_NAMESPACE::memccpy always. */ 653 # if defined _WIN32 && !defined __CYGWIN__ 654 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 655 # undef memccpy 656 # define memccpy _memccpy 657 # endif 658 _GL_CXXALIAS_MDA (memccpy, void *, 659 (void *dest, const void *src, int c, size_t n)); 660 # else 661 _GL_CXXALIAS_SYS (memccpy, void *, 662 (void *dest, const void *src, int c, size_t n)); 663 # endif 664 _GL_CXXALIASWARN (memccpy); 665 #endif 666 667 668 /* Return the first instance of C within N bytes of S, or NULL. */ 669 #if 1 670 # if 0 671 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 672 # undef memchr 673 # define memchr rpl_memchr 674 # endif 675 _GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n) 676 _GL_ATTRIBUTE_PURE 677 _GL_ARG_NONNULL ((1))); 678 _GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n)); 679 # else 680 /* On some systems, this function is defined as an overloaded function: 681 extern "C" { const void * std::memchr (const void *, int, size_t); } 682 extern "C++" { void * std::memchr (void *, int, size_t); } */ 683 _GL_CXXALIAS_SYS_CAST2 (memchr, 684 void *, (void const *__s, int __c, size_t __n), 685 void const *, (void const *__s, int __c, size_t __n)); 686 # endif 687 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 688 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 689 _GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n)); 690 _GL_CXXALIASWARN1 (memchr, void const *, 691 (void const *__s, int __c, size_t __n)); 692 # elif __GLIBC__ >= 2 693 _GL_CXXALIASWARN (memchr); 694 # endif 695 #elif defined GNULIB_POSIXCHECK 696 # undef memchr 697 /* Assume memchr is always declared. */ 698 _GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - " 699 "use gnulib module memchr for portability" ); 700 #endif 701 702 /* Return the first occurrence of NEEDLE in HAYSTACK. */ 703 #if 0 704 # if 0 705 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 706 # define memmem rpl_memmem 707 # endif 708 _GL_FUNCDECL_RPL (memmem, void *, 709 (void const *__haystack, size_t __haystack_len, 710 void const *__needle, size_t __needle_len) 711 _GL_ATTRIBUTE_PURE 712 _GL_ARG_NONNULL ((1, 3))); 713 _GL_CXXALIAS_RPL (memmem, void *, 714 (void const *__haystack, size_t __haystack_len, 715 void const *__needle, size_t __needle_len)); 716 # else 717 # if ! 1 718 _GL_FUNCDECL_SYS (memmem, void *, 719 (void const *__haystack, size_t __haystack_len, 720 void const *__needle, size_t __needle_len) 721 _GL_ATTRIBUTE_PURE 722 _GL_ARG_NONNULL ((1, 3))); 723 # endif 724 _GL_CXXALIAS_SYS (memmem, void *, 725 (void const *__haystack, size_t __haystack_len, 726 void const *__needle, size_t __needle_len)); 727 # endif 728 _GL_CXXALIASWARN (memmem); 729 #elif defined GNULIB_POSIXCHECK 730 # undef memmem 731 # if HAVE_RAW_DECL_MEMMEM 732 _GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - " 733 "use gnulib module memmem-simple for portability, " 734 "and module memmem for speed" ); 735 # endif 736 #endif 737 738 /* Copy N bytes of SRC to DEST, return pointer to bytes after the 739 last written byte. */ 740 #if 1 741 # if ! 0 742 _GL_FUNCDECL_SYS (mempcpy, void *, 743 (void *restrict __dest, void const *restrict __src, 744 size_t __n) 745 _GL_ARG_NONNULL ((1, 2))); 746 # endif 747 _GL_CXXALIAS_SYS (mempcpy, void *, 748 (void *restrict __dest, void const *restrict __src, 749 size_t __n)); 750 _GL_CXXALIASWARN (mempcpy); 751 #elif defined GNULIB_POSIXCHECK 752 # undef mempcpy 753 # if HAVE_RAW_DECL_MEMPCPY 754 _GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - " 755 "use gnulib module mempcpy for portability"); 756 # endif 757 #endif 758 759 /* Search backwards through a block for a byte (specified as an int). */ 760 #if 0 761 # if ! 1 762 _GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t) 763 _GL_ATTRIBUTE_PURE 764 _GL_ARG_NONNULL ((1))); 765 # endif 766 /* On some systems, this function is defined as an overloaded function: 767 extern "C++" { const void * std::memrchr (const void *, int, size_t); } 768 extern "C++" { void * std::memrchr (void *, int, size_t); } */ 769 _GL_CXXALIAS_SYS_CAST2 (memrchr, 770 void *, (void const *, int, size_t), 771 void const *, (void const *, int, size_t)); 772 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 773 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 774 _GL_CXXALIASWARN1 (memrchr, void *, (void *, int, size_t)); 775 _GL_CXXALIASWARN1 (memrchr, void const *, (void const *, int, size_t)); 776 # else 777 _GL_CXXALIASWARN (memrchr); 778 # endif 779 #elif defined GNULIB_POSIXCHECK 780 # undef memrchr 781 # if HAVE_RAW_DECL_MEMRCHR 782 _GL_WARN_ON_USE (memrchr, "memrchr is unportable - " 783 "use gnulib module memrchr for portability"); 784 # endif 785 #endif 786 787 /* Find the first occurrence of C in S. More efficient than 788 memchr(S,C,N), at the expense of undefined behavior if C does not 789 occur within N bytes. */ 790 #if 0 791 # if ! 1 792 _GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in) 793 _GL_ATTRIBUTE_PURE 794 _GL_ARG_NONNULL ((1))); 795 # endif 796 /* On some systems, this function is defined as an overloaded function: 797 extern "C++" { const void * std::rawmemchr (const void *, int); } 798 extern "C++" { void * std::rawmemchr (void *, int); } */ 799 _GL_CXXALIAS_SYS_CAST2 (rawmemchr, 800 void *, (void const *__s, int __c_in), 801 void const *, (void const *__s, int __c_in)); 802 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 803 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 804 _GL_CXXALIASWARN1 (rawmemchr, void *, (void *__s, int __c_in)); 805 _GL_CXXALIASWARN1 (rawmemchr, void const *, (void const *__s, int __c_in)); 806 # else 807 _GL_CXXALIASWARN (rawmemchr); 808 # endif 809 #elif defined GNULIB_POSIXCHECK 810 # undef rawmemchr 811 # if HAVE_RAW_DECL_RAWMEMCHR 812 _GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - " 813 "use gnulib module rawmemchr for portability"); 814 # endif 815 #endif 816 817 /* Copy SRC to DST, returning the address of the terminating '\0' in DST. */ 818 #if 0 819 # if ! 1 820 _GL_FUNCDECL_SYS (stpcpy, char *, 821 (char *restrict __dst, char const *restrict __src) 822 _GL_ARG_NONNULL ((1, 2))); 823 # endif 824 _GL_CXXALIAS_SYS (stpcpy, char *, 825 (char *restrict __dst, char const *restrict __src)); 826 _GL_CXXALIASWARN (stpcpy); 827 #elif defined GNULIB_POSIXCHECK 828 # undef stpcpy 829 # if HAVE_RAW_DECL_STPCPY 830 _GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - " 831 "use gnulib module stpcpy for portability"); 832 # endif 833 #endif 834 835 /* Copy no more than N bytes of SRC to DST, returning a pointer past the 836 last non-NUL byte written into DST. */ 837 #if 0 838 # if 0 839 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 840 # undef stpncpy 841 # define stpncpy rpl_stpncpy 842 # endif 843 _GL_FUNCDECL_RPL (stpncpy, char *, 844 (char *restrict __dst, char const *restrict __src, 845 size_t __n) 846 _GL_ARG_NONNULL ((1, 2))); 847 _GL_CXXALIAS_RPL (stpncpy, char *, 848 (char *restrict __dst, char const *restrict __src, 849 size_t __n)); 850 # else 851 # if ! 1 852 _GL_FUNCDECL_SYS (stpncpy, char *, 853 (char *restrict __dst, char const *restrict __src, 854 size_t __n) 855 _GL_ARG_NONNULL ((1, 2))); 856 # endif 857 _GL_CXXALIAS_SYS (stpncpy, char *, 858 (char *restrict __dst, char const *restrict __src, 859 size_t __n)); 860 # endif 861 _GL_CXXALIASWARN (stpncpy); 862 #elif defined GNULIB_POSIXCHECK 863 # undef stpncpy 864 # if HAVE_RAW_DECL_STPNCPY 865 _GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - " 866 "use gnulib module stpncpy for portability"); 867 # endif 868 #endif 869 870 #if defined GNULIB_POSIXCHECK 871 /* strchr() does not work with multibyte strings if the locale encoding is 872 GB18030 and the character to be searched is a digit. */ 873 # undef strchr 874 /* Assume strchr is always declared. */ 875 _GL_WARN_ON_USE_CXX (strchr, 876 const char *, char *, (const char *, int), 877 "strchr cannot work correctly on character strings " 878 "in some multibyte locales - " 879 "use mbschr if you care about internationalization"); 880 #endif 881 882 /* Find the first occurrence of C in S or the final NUL byte. */ 883 #if 0 884 # if 0 885 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 886 # define strchrnul rpl_strchrnul 887 # endif 888 _GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in) 889 _GL_ATTRIBUTE_PURE 890 _GL_ARG_NONNULL ((1))); 891 _GL_CXXALIAS_RPL (strchrnul, char *, 892 (const char *str, int ch)); 893 # else 894 # if ! 1 895 _GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in) 896 _GL_ATTRIBUTE_PURE 897 _GL_ARG_NONNULL ((1))); 898 # endif 899 /* On some systems, this function is defined as an overloaded function: 900 extern "C++" { const char * std::strchrnul (const char *, int); } 901 extern "C++" { char * std::strchrnul (char *, int); } */ 902 _GL_CXXALIAS_SYS_CAST2 (strchrnul, 903 char *, (char const *__s, int __c_in), 904 char const *, (char const *__s, int __c_in)); 905 # endif 906 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 907 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 908 _GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in)); 909 _GL_CXXALIASWARN1 (strchrnul, char const *, (char const *__s, int __c_in)); 910 # else 911 _GL_CXXALIASWARN (strchrnul); 912 # endif 913 #elif defined GNULIB_POSIXCHECK 914 # undef strchrnul 915 # if HAVE_RAW_DECL_STRCHRNUL 916 _GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - " 917 "use gnulib module strchrnul for portability"); 918 # endif 919 #endif 920 921 /* Duplicate S, returning an identical malloc'd string. */ 922 #if 0 923 # if 0 924 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 925 # undef strdup 926 # define strdup rpl_strdup 927 # endif 928 _GL_FUNCDECL_RPL (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1))); 929 _GL_CXXALIAS_RPL (strdup, char *, (char const *__s)); 930 # elif defined _WIN32 && !defined __CYGWIN__ 931 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 932 # undef strdup 933 # define strdup _strdup 934 # endif 935 _GL_CXXALIAS_MDA (strdup, char *, (char const *__s)); 936 # else 937 # if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup 938 /* strdup exists as a function and as a macro. Get rid of the macro. */ 939 # undef strdup 940 # endif 941 # if !(1 || defined strdup) 942 _GL_FUNCDECL_SYS (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1))); 943 # endif 944 _GL_CXXALIAS_SYS (strdup, char *, (char const *__s)); 945 # endif 946 _GL_CXXALIASWARN (strdup); 947 #elif defined GNULIB_POSIXCHECK 948 # undef strdup 949 # if HAVE_RAW_DECL_STRDUP 950 _GL_WARN_ON_USE (strdup, "strdup is unportable - " 951 "use gnulib module strdup for portability"); 952 # endif 953 #elif 1 954 /* On native Windows, map 'creat' to '_creat', so that -loldnames is not 955 required. In C++ with GNULIB_NAMESPACE, avoid differences between 956 platforms by defining GNULIB_NAMESPACE::strdup always. */ 957 # if defined _WIN32 && !defined __CYGWIN__ 958 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 959 # undef strdup 960 # define strdup _strdup 961 # endif 962 _GL_CXXALIAS_MDA (strdup, char *, (char const *__s)); 963 # else 964 # if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup 965 # undef strdup 966 # endif 967 _GL_CXXALIAS_SYS (strdup, char *, (char const *__s)); 968 # endif 969 _GL_CXXALIASWARN (strdup); 970 #endif 971 972 /* Append no more than N characters from SRC onto DEST. */ 973 #if 0 974 # if 0 975 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 976 # undef strncat 977 # define strncat rpl_strncat 978 # endif 979 _GL_FUNCDECL_RPL (strncat, char *, 980 (char *restrict dest, const char *restrict src, size_t n) 981 _GL_ARG_NONNULL ((1, 2))); 982 _GL_CXXALIAS_RPL (strncat, char *, 983 (char *restrict dest, const char *restrict src, size_t n)); 984 # else 985 _GL_CXXALIAS_SYS (strncat, char *, 986 (char *restrict dest, const char *restrict src, size_t n)); 987 # endif 988 # if __GLIBC__ >= 2 989 _GL_CXXALIASWARN (strncat); 990 # endif 991 #elif defined GNULIB_POSIXCHECK 992 # undef strncat 993 # if HAVE_RAW_DECL_STRNCAT 994 _GL_WARN_ON_USE (strncat, "strncat is unportable - " 995 "use gnulib module strncat for portability"); 996 # endif 997 #endif 998 999 /* Return a newly allocated copy of at most N bytes of STRING. */ 1000 #if 0 1001 # if 0 1002 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1003 # undef strndup 1004 # define strndup rpl_strndup 1005 # endif 1006 _GL_FUNCDECL_RPL (strndup, char *, (char const *__s, size_t __n) 1007 _GL_ARG_NONNULL ((1))); 1008 _GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n)); 1009 # else 1010 # if ! 1 1011 _GL_FUNCDECL_SYS (strndup, char *, (char const *__s, size_t __n) 1012 _GL_ARG_NONNULL ((1))); 1013 # endif 1014 _GL_CXXALIAS_SYS (strndup, char *, (char const *__s, size_t __n)); 1015 # endif 1016 _GL_CXXALIASWARN (strndup); 1017 #elif defined GNULIB_POSIXCHECK 1018 # undef strndup 1019 # if HAVE_RAW_DECL_STRNDUP 1020 _GL_WARN_ON_USE (strndup, "strndup is unportable - " 1021 "use gnulib module strndup for portability"); 1022 # endif 1023 #endif 1024 1025 /* Find the length (number of bytes) of STRING, but scan at most 1026 MAXLEN bytes. If no '\0' terminator is found in that many bytes, 1027 return MAXLEN. */ 1028 #if 1 1029 # if 0 1030 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1031 # undef strnlen 1032 # define strnlen rpl_strnlen 1033 # endif 1034 _GL_FUNCDECL_RPL (strnlen, size_t, (char const *__s, size_t __maxlen) 1035 _GL_ATTRIBUTE_PURE 1036 _GL_ARG_NONNULL ((1))); 1037 _GL_CXXALIAS_RPL (strnlen, size_t, (char const *__s, size_t __maxlen)); 1038 # else 1039 # if ! 0 1040 _GL_FUNCDECL_SYS (strnlen, size_t, (char const *__s, size_t __maxlen) 1041 _GL_ATTRIBUTE_PURE 1042 _GL_ARG_NONNULL ((1))); 1043 # endif 1044 _GL_CXXALIAS_SYS (strnlen, size_t, (char const *__s, size_t __maxlen)); 1045 # endif 1046 _GL_CXXALIASWARN (strnlen); 1047 #elif defined GNULIB_POSIXCHECK 1048 # undef strnlen 1049 # if HAVE_RAW_DECL_STRNLEN 1050 _GL_WARN_ON_USE (strnlen, "strnlen is unportable - " 1051 "use gnulib module strnlen for portability"); 1052 # endif 1053 #endif 1054 1055 #if defined GNULIB_POSIXCHECK 1056 /* strcspn() assumes the second argument is a list of single-byte characters. 1057 Even in this simple case, it does not work with multibyte strings if the 1058 locale encoding is GB18030 and one of the characters to be searched is a 1059 digit. */ 1060 # undef strcspn 1061 /* Assume strcspn is always declared. */ 1062 _GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings " 1063 "in multibyte locales - " 1064 "use mbscspn if you care about internationalization"); 1065 #endif 1066 1067 /* Find the first occurrence in S of any character in ACCEPT. */ 1068 #if 0 1069 # if ! 1 1070 _GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept) 1071 _GL_ATTRIBUTE_PURE 1072 _GL_ARG_NONNULL ((1, 2))); 1073 # endif 1074 /* On some systems, this function is defined as an overloaded function: 1075 extern "C" { const char * strpbrk (const char *, const char *); } 1076 extern "C++" { char * strpbrk (char *, const char *); } */ 1077 _GL_CXXALIAS_SYS_CAST2 (strpbrk, 1078 char *, (char const *__s, char const *__accept), 1079 const char *, (char const *__s, char const *__accept)); 1080 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 1081 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 1082 _GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept)); 1083 _GL_CXXALIASWARN1 (strpbrk, char const *, 1084 (char const *__s, char const *__accept)); 1085 # elif __GLIBC__ >= 2 1086 _GL_CXXALIASWARN (strpbrk); 1087 # endif 1088 # if defined GNULIB_POSIXCHECK 1089 /* strpbrk() assumes the second argument is a list of single-byte characters. 1090 Even in this simple case, it does not work with multibyte strings if the 1091 locale encoding is GB18030 and one of the characters to be searched is a 1092 digit. */ 1093 # undef strpbrk 1094 _GL_WARN_ON_USE_CXX (strpbrk, 1095 const char *, char *, (const char *, const char *), 1096 "strpbrk cannot work correctly on character strings " 1097 "in multibyte locales - " 1098 "use mbspbrk if you care about internationalization"); 1099 # endif 1100 #elif defined GNULIB_POSIXCHECK 1101 # undef strpbrk 1102 # if HAVE_RAW_DECL_STRPBRK 1103 _GL_WARN_ON_USE_CXX (strpbrk, 1104 const char *, char *, (const char *, const char *), 1105 "strpbrk is unportable - " 1106 "use gnulib module strpbrk for portability"); 1107 # endif 1108 #endif 1109 1110 #if defined GNULIB_POSIXCHECK 1111 /* strspn() assumes the second argument is a list of single-byte characters. 1112 Even in this simple case, it cannot work with multibyte strings. */ 1113 # undef strspn 1114 /* Assume strspn is always declared. */ 1115 _GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings " 1116 "in multibyte locales - " 1117 "use mbsspn if you care about internationalization"); 1118 #endif 1119 1120 #if defined GNULIB_POSIXCHECK 1121 /* strrchr() does not work with multibyte strings if the locale encoding is 1122 GB18030 and the character to be searched is a digit. */ 1123 # undef strrchr 1124 /* Assume strrchr is always declared. */ 1125 _GL_WARN_ON_USE_CXX (strrchr, 1126 const char *, char *, (const char *, int), 1127 "strrchr cannot work correctly on character strings " 1128 "in some multibyte locales - " 1129 "use mbsrchr if you care about internationalization"); 1130 #endif 1131 1132 /* Search the next delimiter (char listed in DELIM) starting at *STRINGP. 1133 If one is found, overwrite it with a NUL, and advance *STRINGP 1134 to point to the next char after it. Otherwise, set *STRINGP to NULL. 1135 If *STRINGP was already NULL, nothing happens. 1136 Return the old value of *STRINGP. 1137 1138 This is a variant of strtok() that is multithread-safe and supports 1139 empty fields. 1140 1141 Caveat: It modifies the original string. 1142 Caveat: These functions cannot be used on constant strings. 1143 Caveat: The identity of the delimiting character is lost. 1144 Caveat: It doesn't work with multibyte strings unless all of the delimiter 1145 characters are ASCII characters < 0x30. 1146 1147 See also strtok_r(). */ 1148 #if 0 1149 # if ! 1 1150 _GL_FUNCDECL_SYS (strsep, char *, 1151 (char **restrict __stringp, char const *restrict __delim) 1152 _GL_ARG_NONNULL ((1, 2))); 1153 # endif 1154 _GL_CXXALIAS_SYS (strsep, char *, 1155 (char **restrict __stringp, char const *restrict __delim)); 1156 _GL_CXXALIASWARN (strsep); 1157 # if defined GNULIB_POSIXCHECK 1158 # undef strsep 1159 _GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings " 1160 "in multibyte locales - " 1161 "use mbssep if you care about internationalization"); 1162 # endif 1163 #elif defined GNULIB_POSIXCHECK 1164 # undef strsep 1165 # if HAVE_RAW_DECL_STRSEP 1166 _GL_WARN_ON_USE (strsep, "strsep is unportable - " 1167 "use gnulib module strsep for portability"); 1168 # endif 1169 #endif 1170 1171 #if 0 1172 # if 0 1173 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1174 # define strstr rpl_strstr 1175 # endif 1176 _GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle) 1177 _GL_ATTRIBUTE_PURE 1178 _GL_ARG_NONNULL ((1, 2))); 1179 _GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle)); 1180 # else 1181 /* On some systems, this function is defined as an overloaded function: 1182 extern "C++" { const char * strstr (const char *, const char *); } 1183 extern "C++" { char * strstr (char *, const char *); } */ 1184 _GL_CXXALIAS_SYS_CAST2 (strstr, 1185 char *, (const char *haystack, const char *needle), 1186 const char *, (const char *haystack, const char *needle)); 1187 # endif 1188 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 1189 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 1190 _GL_CXXALIASWARN1 (strstr, char *, (char *haystack, const char *needle)); 1191 _GL_CXXALIASWARN1 (strstr, const char *, 1192 (const char *haystack, const char *needle)); 1193 # elif __GLIBC__ >= 2 1194 _GL_CXXALIASWARN (strstr); 1195 # endif 1196 #elif defined GNULIB_POSIXCHECK 1197 /* strstr() does not work with multibyte strings if the locale encoding is 1198 different from UTF-8: 1199 POSIX says that it operates on "strings", and "string" in POSIX is defined 1200 as a sequence of bytes, not of characters. */ 1201 # undef strstr 1202 /* Assume strstr is always declared. */ 1203 _GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot " 1204 "work correctly on character strings in most " 1205 "multibyte locales - " 1206 "use mbsstr if you care about internationalization, " 1207 "or use strstr if you care about speed"); 1208 #endif 1209 1210 /* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive 1211 comparison. */ 1212 #if 0 1213 # if 0 1214 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1215 # define strcasestr rpl_strcasestr 1216 # endif 1217 _GL_FUNCDECL_RPL (strcasestr, char *, 1218 (const char *haystack, const char *needle) 1219 _GL_ATTRIBUTE_PURE 1220 _GL_ARG_NONNULL ((1, 2))); 1221 _GL_CXXALIAS_RPL (strcasestr, char *, 1222 (const char *haystack, const char *needle)); 1223 # else 1224 # if ! 1 1225 _GL_FUNCDECL_SYS (strcasestr, char *, 1226 (const char *haystack, const char *needle) 1227 _GL_ATTRIBUTE_PURE 1228 _GL_ARG_NONNULL ((1, 2))); 1229 # endif 1230 /* On some systems, this function is defined as an overloaded function: 1231 extern "C++" { const char * strcasestr (const char *, const char *); } 1232 extern "C++" { char * strcasestr (char *, const char *); } */ 1233 _GL_CXXALIAS_SYS_CAST2 (strcasestr, 1234 char *, (const char *haystack, const char *needle), 1235 const char *, (const char *haystack, const char *needle)); 1236 # endif 1237 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 1238 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 1239 _GL_CXXALIASWARN1 (strcasestr, char *, (char *haystack, const char *needle)); 1240 _GL_CXXALIASWARN1 (strcasestr, const char *, 1241 (const char *haystack, const char *needle)); 1242 # else 1243 _GL_CXXALIASWARN (strcasestr); 1244 # endif 1245 #elif defined GNULIB_POSIXCHECK 1246 /* strcasestr() does not work with multibyte strings: 1247 It is a glibc extension, and glibc implements it only for unibyte 1248 locales. */ 1249 # undef strcasestr 1250 # if HAVE_RAW_DECL_STRCASESTR 1251 _GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character " 1252 "strings in multibyte locales - " 1253 "use mbscasestr if you care about " 1254 "internationalization, or use c-strcasestr if you want " 1255 "a locale independent function"); 1256 # endif 1257 #endif 1258 1259 /* Parse S into tokens separated by characters in DELIM. 1260 If S is NULL, the saved pointer in SAVE_PTR is used as 1261 the next starting point. For example: 1262 char s[] = "-abc-=-def"; 1263 char *sp; 1264 x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def" 1265 x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL 1266 x = strtok_r(NULL, "=", &sp); // x = NULL 1267 // s = "abc\0-def\0" 1268 1269 This is a variant of strtok() that is multithread-safe. 1270 1271 For the POSIX documentation for this function, see: 1272 https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtok.html 1273 1274 Caveat: It modifies the original string. 1275 Caveat: These functions cannot be used on constant strings. 1276 Caveat: The identity of the delimiting character is lost. 1277 Caveat: It doesn't work with multibyte strings unless all of the delimiter 1278 characters are ASCII characters < 0x30. 1279 1280 See also strsep(). */ 1281 #if 0 1282 # if 0 1283 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1284 # undef strtok_r 1285 # define strtok_r rpl_strtok_r 1286 # endif 1287 _GL_FUNCDECL_RPL (strtok_r, char *, 1288 (char *restrict s, char const *restrict delim, 1289 char **restrict save_ptr) 1290 _GL_ARG_NONNULL ((2, 3))); 1291 _GL_CXXALIAS_RPL (strtok_r, char *, 1292 (char *restrict s, char const *restrict delim, 1293 char **restrict save_ptr)); 1294 # else 1295 # if 0 || defined GNULIB_POSIXCHECK 1296 # undef strtok_r 1297 # endif 1298 # if ! 1 1299 _GL_FUNCDECL_SYS (strtok_r, char *, 1300 (char *restrict s, char const *restrict delim, 1301 char **restrict save_ptr) 1302 _GL_ARG_NONNULL ((2, 3))); 1303 # endif 1304 _GL_CXXALIAS_SYS (strtok_r, char *, 1305 (char *restrict s, char const *restrict delim, 1306 char **restrict save_ptr)); 1307 # endif 1308 _GL_CXXALIASWARN (strtok_r); 1309 # if defined GNULIB_POSIXCHECK 1310 _GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character " 1311 "strings in multibyte locales - " 1312 "use mbstok_r if you care about internationalization"); 1313 # endif 1314 #elif defined GNULIB_POSIXCHECK 1315 # undef strtok_r 1316 # if HAVE_RAW_DECL_STRTOK_R 1317 _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - " 1318 "use gnulib module strtok_r for portability"); 1319 # endif 1320 #endif 1321 1322 1323 /* The following functions are not specified by POSIX. They are gnulib 1324 extensions. */ 1325 1326 #if 0 1327 /* Return the number of multibyte characters in the character string STRING. 1328 This considers multibyte characters, unlike strlen, which counts bytes. */ 1329 # ifdef __MirBSD__ /* MirBSD defines mbslen as a macro. Override it. */ 1330 # undef mbslen 1331 # endif 1332 # if 0 /* AIX, OSF/1, MirBSD define mbslen already in libc. */ 1333 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1334 # define mbslen rpl_mbslen 1335 # endif 1336 _GL_FUNCDECL_RPL (mbslen, size_t, (const char *string) 1337 _GL_ATTRIBUTE_PURE 1338 _GL_ARG_NONNULL ((1))); 1339 _GL_CXXALIAS_RPL (mbslen, size_t, (const char *string)); 1340 # else 1341 _GL_FUNCDECL_SYS (mbslen, size_t, (const char *string) 1342 _GL_ATTRIBUTE_PURE 1343 _GL_ARG_NONNULL ((1))); 1344 _GL_CXXALIAS_SYS (mbslen, size_t, (const char *string)); 1345 # endif 1346 _GL_CXXALIASWARN (mbslen); 1347 #endif 1348 1349 #if 0 1350 /* Return the number of multibyte characters in the character string starting 1351 at STRING and ending at STRING + LEN. */ 1352 _GL_EXTERN_C size_t mbsnlen (const char *string, size_t len) 1353 _GL_ATTRIBUTE_PURE 1354 _GL_ARG_NONNULL ((1)); 1355 #endif 1356 1357 #if 0 1358 /* Locate the first single-byte character C in the character string STRING, 1359 and return a pointer to it. Return NULL if C is not found in STRING. 1360 Unlike strchr(), this function works correctly in multibyte locales with 1361 encodings such as GB18030. */ 1362 # if defined __hpux 1363 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1364 # define mbschr rpl_mbschr /* avoid collision with HP-UX function */ 1365 # endif 1366 _GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c) 1367 _GL_ATTRIBUTE_PURE 1368 _GL_ARG_NONNULL ((1))); 1369 _GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c)); 1370 # else 1371 _GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c) 1372 _GL_ATTRIBUTE_PURE 1373 _GL_ARG_NONNULL ((1))); 1374 _GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c)); 1375 # endif 1376 _GL_CXXALIASWARN (mbschr); 1377 #endif 1378 1379 #if 0 1380 /* Locate the last single-byte character C in the character string STRING, 1381 and return a pointer to it. Return NULL if C is not found in STRING. 1382 Unlike strrchr(), this function works correctly in multibyte locales with 1383 encodings such as GB18030. */ 1384 # if defined __hpux || defined __INTERIX 1385 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1386 # define mbsrchr rpl_mbsrchr /* avoid collision with system function */ 1387 # endif 1388 _GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c) 1389 _GL_ATTRIBUTE_PURE 1390 _GL_ARG_NONNULL ((1))); 1391 _GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c)); 1392 # else 1393 _GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c) 1394 _GL_ATTRIBUTE_PURE 1395 _GL_ARG_NONNULL ((1))); 1396 _GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c)); 1397 # endif 1398 _GL_CXXALIASWARN (mbsrchr); 1399 #endif 1400 1401 #if 0 1402 /* Find the first occurrence of the character string NEEDLE in the character 1403 string HAYSTACK. Return NULL if NEEDLE is not found in HAYSTACK. 1404 Unlike strstr(), this function works correctly in multibyte locales with 1405 encodings different from UTF-8. */ 1406 _GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle) 1407 _GL_ATTRIBUTE_PURE 1408 _GL_ARG_NONNULL ((1, 2)); 1409 #endif 1410 1411 #if 0 1412 /* Compare the character strings S1 and S2, ignoring case, returning less than, 1413 equal to or greater than zero if S1 is lexicographically less than, equal to 1414 or greater than S2. 1415 Note: This function may, in multibyte locales, return 0 for strings of 1416 different lengths! 1417 Unlike strcasecmp(), this function works correctly in multibyte locales. */ 1418 _GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2) 1419 _GL_ATTRIBUTE_PURE 1420 _GL_ARG_NONNULL ((1, 2)); 1421 #endif 1422 1423 #if 0 1424 /* Compare the initial segment of the character string S1 consisting of at most 1425 N characters with the initial segment of the character string S2 consisting 1426 of at most N characters, ignoring case, returning less than, equal to or 1427 greater than zero if the initial segment of S1 is lexicographically less 1428 than, equal to or greater than the initial segment of S2. 1429 Note: This function may, in multibyte locales, return 0 for initial segments 1430 of different lengths! 1431 Unlike strncasecmp(), this function works correctly in multibyte locales. 1432 But beware that N is not a byte count but a character count! */ 1433 _GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n) 1434 _GL_ATTRIBUTE_PURE 1435 _GL_ARG_NONNULL ((1, 2)); 1436 #endif 1437 1438 #if 0 1439 /* Compare the initial segment of the character string STRING consisting of 1440 at most mbslen (PREFIX) characters with the character string PREFIX, 1441 ignoring case. If the two match, return a pointer to the first byte 1442 after this prefix in STRING. Otherwise, return NULL. 1443 Note: This function may, in multibyte locales, return non-NULL if STRING 1444 is of smaller length than PREFIX! 1445 Unlike strncasecmp(), this function works correctly in multibyte 1446 locales. */ 1447 _GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix) 1448 _GL_ATTRIBUTE_PURE 1449 _GL_ARG_NONNULL ((1, 2)); 1450 #endif 1451 1452 #if 0 1453 /* Find the first occurrence of the character string NEEDLE in the character 1454 string HAYSTACK, using case-insensitive comparison. 1455 Note: This function may, in multibyte locales, return success even if 1456 strlen (haystack) < strlen (needle) ! 1457 Unlike strcasestr(), this function works correctly in multibyte locales. */ 1458 _GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle) 1459 _GL_ATTRIBUTE_PURE 1460 _GL_ARG_NONNULL ((1, 2)); 1461 #endif 1462 1463 #if 0 1464 /* Find the first occurrence in the character string STRING of any character 1465 in the character string ACCEPT. Return the number of bytes from the 1466 beginning of the string to this occurrence, or to the end of the string 1467 if none exists. 1468 Unlike strcspn(), this function works correctly in multibyte locales. */ 1469 _GL_EXTERN_C size_t mbscspn (const char *string, const char *accept) 1470 _GL_ATTRIBUTE_PURE 1471 _GL_ARG_NONNULL ((1, 2)); 1472 #endif 1473 1474 #if 0 1475 /* Find the first occurrence in the character string STRING of any character 1476 in the character string ACCEPT. Return the pointer to it, or NULL if none 1477 exists. 1478 Unlike strpbrk(), this function works correctly in multibyte locales. */ 1479 # if defined __hpux 1480 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1481 # define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */ 1482 # endif 1483 _GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept) 1484 _GL_ATTRIBUTE_PURE 1485 _GL_ARG_NONNULL ((1, 2))); 1486 _GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept)); 1487 # else 1488 _GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept) 1489 _GL_ATTRIBUTE_PURE 1490 _GL_ARG_NONNULL ((1, 2))); 1491 _GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept)); 1492 # endif 1493 _GL_CXXALIASWARN (mbspbrk); 1494 #endif 1495 1496 #if 0 1497 /* Find the first occurrence in the character string STRING of any character 1498 not in the character string REJECT. Return the number of bytes from the 1499 beginning of the string to this occurrence, or to the end of the string 1500 if none exists. 1501 Unlike strspn(), this function works correctly in multibyte locales. */ 1502 _GL_EXTERN_C size_t mbsspn (const char *string, const char *reject) 1503 _GL_ATTRIBUTE_PURE 1504 _GL_ARG_NONNULL ((1, 2)); 1505 #endif 1506 1507 #if 0 1508 /* Search the next delimiter (multibyte character listed in the character 1509 string DELIM) starting at the character string *STRINGP. 1510 If one is found, overwrite it with a NUL, and advance *STRINGP to point 1511 to the next multibyte character after it. Otherwise, set *STRINGP to NULL. 1512 If *STRINGP was already NULL, nothing happens. 1513 Return the old value of *STRINGP. 1514 1515 This is a variant of mbstok_r() that supports empty fields. 1516 1517 Caveat: It modifies the original string. 1518 Caveat: These functions cannot be used on constant strings. 1519 Caveat: The identity of the delimiting character is lost. 1520 1521 See also mbstok_r(). */ 1522 _GL_EXTERN_C char * mbssep (char **stringp, const char *delim) 1523 _GL_ARG_NONNULL ((1, 2)); 1524 #endif 1525 1526 #if 0 1527 /* Parse the character string STRING into tokens separated by characters in 1528 the character string DELIM. 1529 If STRING is NULL, the saved pointer in SAVE_PTR is used as 1530 the next starting point. For example: 1531 char s[] = "-abc-=-def"; 1532 char *sp; 1533 x = mbstok_r(s, "-", &sp); // x = "abc", sp = "=-def" 1534 x = mbstok_r(NULL, "-=", &sp); // x = "def", sp = NULL 1535 x = mbstok_r(NULL, "=", &sp); // x = NULL 1536 // s = "abc\0-def\0" 1537 1538 Caveat: It modifies the original string. 1539 Caveat: These functions cannot be used on constant strings. 1540 Caveat: The identity of the delimiting character is lost. 1541 1542 See also mbssep(). */ 1543 _GL_EXTERN_C char * mbstok_r (char *restrict string, const char *delim, 1544 char **save_ptr) 1545 _GL_ARG_NONNULL ((2, 3)); 1546 #endif 1547 1548 /* Map any int, typically from errno, into an error message. */ 1549 #if 0 1550 # if 0 1551 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1552 # undef strerror 1553 # define strerror rpl_strerror 1554 # endif 1555 _GL_FUNCDECL_RPL (strerror, char *, (int)); 1556 _GL_CXXALIAS_RPL (strerror, char *, (int)); 1557 # else 1558 _GL_CXXALIAS_SYS (strerror, char *, (int)); 1559 # endif 1560 # if __GLIBC__ >= 2 1561 _GL_CXXALIASWARN (strerror); 1562 # endif 1563 #elif defined GNULIB_POSIXCHECK 1564 # undef strerror 1565 /* Assume strerror is always declared. */ 1566 _GL_WARN_ON_USE (strerror, "strerror is unportable - " 1567 "use gnulib module strerror to guarantee non-NULL result"); 1568 #endif 1569 1570 /* Map any int, typically from errno, into an error message. Multithread-safe. 1571 Uses the POSIX declaration, not the glibc declaration. */ 1572 #if 0 1573 # if 0 1574 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1575 # undef strerror_r 1576 # define strerror_r rpl_strerror_r 1577 # endif 1578 _GL_FUNCDECL_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen) 1579 _GL_ARG_NONNULL ((2))); 1580 _GL_CXXALIAS_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen)); 1581 # else 1582 # if !1 1583 _GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen) 1584 _GL_ARG_NONNULL ((2))); 1585 # endif 1586 _GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen)); 1587 # endif 1588 # if 1 1589 _GL_CXXALIASWARN (strerror_r); 1590 # endif 1591 #elif defined GNULIB_POSIXCHECK 1592 # undef strerror_r 1593 # if HAVE_RAW_DECL_STRERROR_R 1594 _GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - " 1595 "use gnulib module strerror_r-posix for portability"); 1596 # endif 1597 #endif 1598 1599 /* Return the name of the system error code ERRNUM. */ 1600 #if 0 1601 # if 0 1602 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1603 # undef strerrorname_np 1604 # define strerrorname_np rpl_strerrorname_np 1605 # endif 1606 _GL_FUNCDECL_RPL (strerrorname_np, const char *, (int errnum)); 1607 _GL_CXXALIAS_RPL (strerrorname_np, const char *, (int errnum)); 1608 # else 1609 # if !1 1610 _GL_FUNCDECL_SYS (strerrorname_np, const char *, (int errnum)); 1611 # endif 1612 _GL_CXXALIAS_SYS (strerrorname_np, const char *, (int errnum)); 1613 # endif 1614 _GL_CXXALIASWARN (strerrorname_np); 1615 #elif defined GNULIB_POSIXCHECK 1616 # undef strerrorname_np 1617 # if HAVE_RAW_DECL_STRERRORNAME_NP 1618 _GL_WARN_ON_USE (strerrorname_np, "strerrorname_np is unportable - " 1619 "use gnulib module strerrorname_np for portability"); 1620 # endif 1621 #endif 1622 1623 /* Return an abbreviation string for the signal number SIG. */ 1624 #if 0 1625 # if ! 1 1626 _GL_FUNCDECL_SYS (sigabbrev_np, const char *, (int sig)); 1627 # endif 1628 _GL_CXXALIAS_SYS (sigabbrev_np, const char *, (int sig)); 1629 _GL_CXXALIASWARN (sigabbrev_np); 1630 #elif defined GNULIB_POSIXCHECK 1631 # undef sigabbrev_np 1632 # if HAVE_RAW_DECL_SIGABBREV_NP 1633 _GL_WARN_ON_USE (sigabbrev_np, "sigabbrev_np is unportable - " 1634 "use gnulib module sigabbrev_np for portability"); 1635 # endif 1636 #endif 1637 1638 /* Return an English description string for the signal number SIG. */ 1639 #if 0 1640 # if ! 1 1641 _GL_FUNCDECL_SYS (sigdescr_np, const char *, (int sig)); 1642 # endif 1643 _GL_CXXALIAS_SYS (sigdescr_np, const char *, (int sig)); 1644 _GL_CXXALIASWARN (sigdescr_np); 1645 #elif defined GNULIB_POSIXCHECK 1646 # undef sigdescr_np 1647 # if HAVE_RAW_DECL_SIGDESCR_NP 1648 _GL_WARN_ON_USE (sigdescr_np, "sigdescr_np is unportable - " 1649 "use gnulib module sigdescr_np for portability"); 1650 # endif 1651 #endif 1652 1653 #if 0 1654 # if 0 1655 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1656 # define strsignal rpl_strsignal 1657 # endif 1658 _GL_FUNCDECL_RPL (strsignal, char *, (int __sig)); 1659 _GL_CXXALIAS_RPL (strsignal, char *, (int __sig)); 1660 # else 1661 # if ! 1 1662 _GL_FUNCDECL_SYS (strsignal, char *, (int __sig)); 1663 # endif 1664 /* Need to cast, because on Cygwin 1.5.x systems, the return type is 1665 'const char *'. */ 1666 _GL_CXXALIAS_SYS_CAST (strsignal, char *, (int __sig)); 1667 # endif 1668 _GL_CXXALIASWARN (strsignal); 1669 #elif defined GNULIB_POSIXCHECK 1670 # undef strsignal 1671 # if HAVE_RAW_DECL_STRSIGNAL 1672 _GL_WARN_ON_USE (strsignal, "strsignal is unportable - " 1673 "use gnulib module strsignal for portability"); 1674 # endif 1675 #endif 1676 1677 #if 0 1678 # if !1 1679 _GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *) 1680 _GL_ATTRIBUTE_PURE 1681 _GL_ARG_NONNULL ((1, 2))); 1682 # endif 1683 _GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *)); 1684 _GL_CXXALIASWARN (strverscmp); 1685 #elif defined GNULIB_POSIXCHECK 1686 # undef strverscmp 1687 # if HAVE_RAW_DECL_STRVERSCMP 1688 _GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - " 1689 "use gnulib module strverscmp for portability"); 1690 # endif 1691 #endif 1692 1693 1694 #endif /* _GL_STRING_H */ 1695 #endif /* _GL_STRING_H */ 1696 #endif 1697