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