1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 #if __GNUC__ >= 3
19 @PRAGMA_SYSTEM_HEADER@
20 #endif
21 @PRAGMA_COLUMNS@
22
23 #if defined _GL_ALREADY_INCLUDING_STRING_H
24
25
26
27
28
29
30 #@INCLUDE_NEXT@ @NEXT_STRING_H@
31
32 #else
33
34
35 #ifndef _@GUARD_PREFIX@_STRING_H
36
37 #define _GL_ALREADY_INCLUDING_STRING_H
38
39
40 #@INCLUDE_NEXT@ @NEXT_STRING_H@
41
42 #undef _GL_ALREADY_INCLUDING_STRING_H
43
44 #ifndef _@GUARD_PREFIX@_STRING_H
45 #define _@GUARD_PREFIX@_STRING_H
46
47
48 #include <stddef.h>
49
50
51 #if @GNULIB_MBSLEN@ && defined __MirBSD__
52 # include <wchar.h>
53 #endif
54
55
56
57 #if (@GNULIB_STRSIGNAL@ || defined GNULIB_POSIXCHECK) && defined __NetBSD__ \
58 && ! defined __GLIBC__
59 # include <unistd.h>
60 #endif
61
62
63
64 #if ((@GNULIB_FFSL@ || @GNULIB_FFSLL@ || defined GNULIB_POSIXCHECK) \
65 && defined _AIX) \
66 && ! defined __GLIBC__
67 # include <strings.h>
68 #endif
69
70
71
72
73 #ifndef _GL_ATTRIBUTE_DEALLOC
74 # if __GNUC__ >= 11
75 # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
76 # else
77 # define _GL_ATTRIBUTE_DEALLOC(f, i)
78 # endif
79 #endif
80
81
82
83
84 #ifndef _GL_ATTRIBUTE_DEALLOC_FREE
85 # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (free, 1)
86 #endif
87
88
89
90
91 #ifndef _GL_ATTRIBUTE_MALLOC
92 # if __GNUC__ >= 3 || defined __clang__
93 # define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
94 # else
95 # define _GL_ATTRIBUTE_MALLOC
96 # endif
97 #endif
98
99
100
101 #ifndef _GL_ATTRIBUTE_PURE
102 # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
103 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
104 # else
105 # define _GL_ATTRIBUTE_PURE
106 # endif
107 #endif
108
109
110
111
112
113
114
115
116
117 #if @GNULIB_FREE_POSIX@
118 # if (@REPLACE_FREE@ && !defined free \
119 && !(defined __cplusplus && defined GNULIB_NAMESPACE))
120
121 _GL_EXTERN_C void rpl_free (void *);
122 # undef _GL_ATTRIBUTE_DEALLOC_FREE
123 # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1)
124 # else
125 # if defined _MSC_VER && !defined free
126 _GL_EXTERN_C
127 # if defined _DLL
128 __declspec (dllimport)
129 # endif
130 void __cdecl free (void *);
131 # else
132 # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
133 _GL_EXTERN_C void free (void *) throw ();
134 # else
135 _GL_EXTERN_C void free (void *);
136 # endif
137 # endif
138 # endif
139 #else
140 # if defined _MSC_VER && !defined free
141 _GL_EXTERN_C
142 # if defined _DLL
143 __declspec (dllimport)
144 # endif
145 void __cdecl free (void *);
146 # else
147 # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
148 _GL_EXTERN_C void free (void *) throw ();
149 # else
150 _GL_EXTERN_C void free (void *);
151 # endif
152 # endif
153 #endif
154
155
156
157 #if @GNULIB_EXPLICIT_BZERO@
158 # if ! @HAVE_EXPLICIT_BZERO@
159 _GL_FUNCDECL_SYS (explicit_bzero, void,
160 (void *__dest, size_t __n) _GL_ARG_NONNULL ((1)));
161 # endif
162 _GL_CXXALIAS_SYS (explicit_bzero, void, (void *__dest, size_t __n));
163 _GL_CXXALIASWARN (explicit_bzero);
164 #elif defined GNULIB_POSIXCHECK
165 # undef explicit_bzero
166 # if HAVE_RAW_DECL_EXPLICIT_BZERO
167 _GL_WARN_ON_USE (explicit_bzero, "explicit_bzero is unportable - "
168 "use gnulib module explicit_bzero for portability");
169 # endif
170 #endif
171
172
173 #if @GNULIB_FFSL@
174 # if !@HAVE_FFSL@
175 _GL_FUNCDECL_SYS (ffsl, int, (long int i));
176 # endif
177 _GL_CXXALIAS_SYS (ffsl, int, (long int i));
178 _GL_CXXALIASWARN (ffsl);
179 #elif defined GNULIB_POSIXCHECK
180 # undef ffsl
181 # if HAVE_RAW_DECL_FFSL
182 _GL_WARN_ON_USE (ffsl, "ffsl is not portable - use the ffsl module");
183 # endif
184 #endif
185
186
187
188 #if @GNULIB_FFSLL@
189 # if @REPLACE_FFSLL@
190 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
191 # define ffsll rpl_ffsll
192 # endif
193 _GL_FUNCDECL_RPL (ffsll, int, (long long int i));
194 _GL_CXXALIAS_RPL (ffsll, int, (long long int i));
195 # else
196 # if !@HAVE_FFSLL@
197 _GL_FUNCDECL_SYS (ffsll, int, (long long int i));
198 # endif
199 _GL_CXXALIAS_SYS (ffsll, int, (long long int i));
200 # endif
201 _GL_CXXALIASWARN (ffsll);
202 #elif defined GNULIB_POSIXCHECK
203 # undef ffsll
204 # if HAVE_RAW_DECL_FFSLL
205 _GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the ffsll module");
206 # endif
207 #endif
208
209
210 #if @GNULIB_MDA_MEMCCPY@
211
212
213
214 # if defined _WIN32 && !defined __CYGWIN__
215 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
216 # undef memccpy
217 # define memccpy _memccpy
218 # endif
219 _GL_CXXALIAS_MDA (memccpy, void *,
220 (void *dest, const void *src, int c, size_t n));
221 # else
222 _GL_CXXALIAS_SYS (memccpy, void *,
223 (void *dest, const void *src, int c, size_t n));
224 # endif
225 _GL_CXXALIASWARN (memccpy);
226 #endif
227
228
229
230 #if @GNULIB_MEMCHR@
231 # if @REPLACE_MEMCHR@
232 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
233 # undef memchr
234 # define memchr rpl_memchr
235 # endif
236 _GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n)
237 _GL_ATTRIBUTE_PURE
238 _GL_ARG_NONNULL ((1)));
239 _GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n));
240 # else
241
242
243
244 _GL_CXXALIAS_SYS_CAST2 (memchr,
245 void *, (void const *__s, int __c, size_t __n),
246 void const *, (void const *__s, int __c, size_t __n));
247 # endif
248 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
249 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
250 || defined __clang__)
251 _GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n) throw ());
252 _GL_CXXALIASWARN1 (memchr, void const *,
253 (void const *__s, int __c, size_t __n) throw ());
254 # elif __GLIBC__ >= 2
255 _GL_CXXALIASWARN (memchr);
256 # endif
257 #elif defined GNULIB_POSIXCHECK
258 # undef memchr
259
260 _GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - "
261 "use gnulib module memchr for portability" );
262 #endif
263
264
265 #if @GNULIB_MEMMEM@
266 # if @REPLACE_MEMMEM@
267 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
268 # define memmem rpl_memmem
269 # endif
270 _GL_FUNCDECL_RPL (memmem, void *,
271 (void const *__haystack, size_t __haystack_len,
272 void const *__needle, size_t __needle_len)
273 _GL_ATTRIBUTE_PURE
274 _GL_ARG_NONNULL ((1, 3)));
275 _GL_CXXALIAS_RPL (memmem, void *,
276 (void const *__haystack, size_t __haystack_len,
277 void const *__needle, size_t __needle_len));
278 # else
279 # if ! @HAVE_DECL_MEMMEM@
280 _GL_FUNCDECL_SYS (memmem, void *,
281 (void const *__haystack, size_t __haystack_len,
282 void const *__needle, size_t __needle_len)
283 _GL_ATTRIBUTE_PURE
284 _GL_ARG_NONNULL ((1, 3)));
285 # endif
286 _GL_CXXALIAS_SYS (memmem, void *,
287 (void const *__haystack, size_t __haystack_len,
288 void const *__needle, size_t __needle_len));
289 # endif
290 _GL_CXXALIASWARN (memmem);
291 #elif defined GNULIB_POSIXCHECK
292 # undef memmem
293 # if HAVE_RAW_DECL_MEMMEM
294 _GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - "
295 "use gnulib module memmem-simple for portability, "
296 "and module memmem for speed" );
297 # endif
298 #endif
299
300
301
302 #if @GNULIB_MEMPCPY@
303 # if ! @HAVE_MEMPCPY@
304 _GL_FUNCDECL_SYS (mempcpy, void *,
305 (void *restrict __dest, void const *restrict __src,
306 size_t __n)
307 _GL_ARG_NONNULL ((1, 2)));
308 # endif
309 _GL_CXXALIAS_SYS (mempcpy, void *,
310 (void *restrict __dest, void const *restrict __src,
311 size_t __n));
312 _GL_CXXALIASWARN (mempcpy);
313 #elif defined GNULIB_POSIXCHECK
314 # undef mempcpy
315 # if HAVE_RAW_DECL_MEMPCPY
316 _GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - "
317 "use gnulib module mempcpy for portability");
318 # endif
319 #endif
320
321
322 #if @GNULIB_MEMRCHR@
323 # if ! @HAVE_DECL_MEMRCHR@
324 _GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t)
325 _GL_ATTRIBUTE_PURE
326 _GL_ARG_NONNULL ((1)));
327 # endif
328
329
330
331 _GL_CXXALIAS_SYS_CAST2 (memrchr,
332 void *, (void const *, int, size_t),
333 void const *, (void const *, int, size_t));
334 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
335 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
336 || defined __clang__)
337 _GL_CXXALIASWARN1 (memrchr, void *, (void *, int, size_t) throw ());
338 _GL_CXXALIASWARN1 (memrchr, void const *, (void const *, int, size_t) throw ());
339 # else
340 _GL_CXXALIASWARN (memrchr);
341 # endif
342 #elif defined GNULIB_POSIXCHECK
343 # undef memrchr
344 # if HAVE_RAW_DECL_MEMRCHR
345 _GL_WARN_ON_USE (memrchr, "memrchr is unportable - "
346 "use gnulib module memrchr for portability");
347 # endif
348 #endif
349
350
351
352
353 #if @GNULIB_RAWMEMCHR@
354 # if ! @HAVE_RAWMEMCHR@
355 _GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in)
356 _GL_ATTRIBUTE_PURE
357 _GL_ARG_NONNULL ((1)));
358 # endif
359
360
361
362 _GL_CXXALIAS_SYS_CAST2 (rawmemchr,
363 void *, (void const *__s, int __c_in),
364 void const *, (void const *__s, int __c_in));
365 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
366 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
367 || defined __clang__)
368 _GL_CXXALIASWARN1 (rawmemchr, void *, (void *__s, int __c_in) throw ());
369 _GL_CXXALIASWARN1 (rawmemchr, void const *,
370 (void const *__s, int __c_in) throw ());
371 # else
372 _GL_CXXALIASWARN (rawmemchr);
373 # endif
374 #elif defined GNULIB_POSIXCHECK
375 # undef rawmemchr
376 # if HAVE_RAW_DECL_RAWMEMCHR
377 _GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - "
378 "use gnulib module rawmemchr for portability");
379 # endif
380 #endif
381
382
383 #if @GNULIB_STPCPY@
384 # if ! @HAVE_STPCPY@
385 _GL_FUNCDECL_SYS (stpcpy, char *,
386 (char *restrict __dst, char const *restrict __src)
387 _GL_ARG_NONNULL ((1, 2)));
388 # endif
389 _GL_CXXALIAS_SYS (stpcpy, char *,
390 (char *restrict __dst, char const *restrict __src));
391 _GL_CXXALIASWARN (stpcpy);
392 #elif defined GNULIB_POSIXCHECK
393 # undef stpcpy
394 # if HAVE_RAW_DECL_STPCPY
395 _GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - "
396 "use gnulib module stpcpy for portability");
397 # endif
398 #endif
399
400
401
402 #if @GNULIB_STPNCPY@
403 # if @REPLACE_STPNCPY@
404 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
405 # undef stpncpy
406 # define stpncpy rpl_stpncpy
407 # endif
408 _GL_FUNCDECL_RPL (stpncpy, char *,
409 (char *restrict __dst, char const *restrict __src,
410 size_t __n)
411 _GL_ARG_NONNULL ((1, 2)));
412 _GL_CXXALIAS_RPL (stpncpy, char *,
413 (char *restrict __dst, char const *restrict __src,
414 size_t __n));
415 # else
416 # if ! @HAVE_STPNCPY@
417 _GL_FUNCDECL_SYS (stpncpy, char *,
418 (char *restrict __dst, char const *restrict __src,
419 size_t __n)
420 _GL_ARG_NONNULL ((1, 2)));
421 # endif
422 _GL_CXXALIAS_SYS (stpncpy, char *,
423 (char *restrict __dst, char const *restrict __src,
424 size_t __n));
425 # endif
426 _GL_CXXALIASWARN (stpncpy);
427 #elif defined GNULIB_POSIXCHECK
428 # undef stpncpy
429 # if HAVE_RAW_DECL_STPNCPY
430 _GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - "
431 "use gnulib module stpncpy for portability");
432 # endif
433 #endif
434
435 #if defined GNULIB_POSIXCHECK
436
437
438 # undef strchr
439
440 _GL_WARN_ON_USE_CXX (strchr,
441 const char *, char *, (const char *, int),
442 "strchr cannot work correctly on character strings "
443 "in some multibyte locales - "
444 "use mbschr if you care about internationalization");
445 #endif
446
447
448 #if @GNULIB_STRCHRNUL@
449 # if @REPLACE_STRCHRNUL@
450 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
451 # define strchrnul rpl_strchrnul
452 # endif
453 _GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in)
454 _GL_ATTRIBUTE_PURE
455 _GL_ARG_NONNULL ((1)));
456 _GL_CXXALIAS_RPL (strchrnul, char *,
457 (const char *str, int ch));
458 # else
459 # if ! @HAVE_STRCHRNUL@
460 _GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in)
461 _GL_ATTRIBUTE_PURE
462 _GL_ARG_NONNULL ((1)));
463 # endif
464
465
466
467 _GL_CXXALIAS_SYS_CAST2 (strchrnul,
468 char *, (char const *__s, int __c_in),
469 char const *, (char const *__s, int __c_in));
470 # endif
471 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
472 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
473 || defined __clang__)
474 _GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in) throw ());
475 _GL_CXXALIASWARN1 (strchrnul, char const *,
476 (char const *__s, int __c_in) throw ());
477 # else
478 _GL_CXXALIASWARN (strchrnul);
479 # endif
480 #elif defined GNULIB_POSIXCHECK
481 # undef strchrnul
482 # if HAVE_RAW_DECL_STRCHRNUL
483 _GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - "
484 "use gnulib module strchrnul for portability");
485 # endif
486 #endif
487
488
489 #if @GNULIB_STRDUP@
490 # if @REPLACE_STRDUP@
491 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
492 # undef strdup
493 # define strdup rpl_strdup
494 # endif
495 _GL_FUNCDECL_RPL (strdup, char *,
496 (char const *__s)
497 _GL_ARG_NONNULL ((1))
498 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
499 _GL_CXXALIAS_RPL (strdup, char *, (char const *__s));
500 # elif defined _WIN32 && !defined __CYGWIN__
501 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
502 # undef strdup
503 # define strdup _strdup
504 # endif
505 _GL_CXXALIAS_MDA (strdup, char *, (char const *__s));
506 # else
507 # if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup
508
509 # undef strdup
510 # endif
511 # if (!@HAVE_DECL_STRDUP@ || __GNUC__ >= 11) && !defined strdup
512 _GL_FUNCDECL_SYS (strdup, char *,
513 (char const *__s)
514 _GL_ARG_NONNULL ((1))
515 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
516 # endif
517 _GL_CXXALIAS_SYS (strdup, char *, (char const *__s));
518 # endif
519 _GL_CXXALIASWARN (strdup);
520 #else
521 # if __GNUC__ >= 11 && !defined strdup
522
523 _GL_FUNCDECL_SYS (strdup, char *,
524 (char const *__s)
525 _GL_ARG_NONNULL ((1))
526 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
527 # endif
528 # if defined GNULIB_POSIXCHECK
529 # undef strdup
530 # if HAVE_RAW_DECL_STRDUP
531 _GL_WARN_ON_USE (strdup, "strdup is unportable - "
532 "use gnulib module strdup for portability");
533 # endif
534 # elif @GNULIB_MDA_STRDUP@
535
536
537
538 # if defined _WIN32 && !defined __CYGWIN__
539 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
540 # undef strdup
541 # define strdup _strdup
542 # endif
543 _GL_CXXALIAS_MDA (strdup, char *, (char const *__s));
544 # else
545 # if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup
546 # undef strdup
547 # endif
548 _GL_CXXALIAS_SYS (strdup, char *, (char const *__s));
549 # endif
550 _GL_CXXALIASWARN (strdup);
551 # endif
552 #endif
553
554
555 #if @GNULIB_STRNCAT@
556 # if @REPLACE_STRNCAT@
557 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
558 # undef strncat
559 # define strncat rpl_strncat
560 # endif
561 _GL_FUNCDECL_RPL (strncat, char *,
562 (char *restrict dest, const char *restrict src, size_t n)
563 _GL_ARG_NONNULL ((1, 2)));
564 _GL_CXXALIAS_RPL (strncat, char *,
565 (char *restrict dest, const char *restrict src, size_t n));
566 # else
567 _GL_CXXALIAS_SYS (strncat, char *,
568 (char *restrict dest, const char *restrict src, size_t n));
569 # endif
570 # if __GLIBC__ >= 2
571 _GL_CXXALIASWARN (strncat);
572 # endif
573 #elif defined GNULIB_POSIXCHECK
574 # undef strncat
575 # if HAVE_RAW_DECL_STRNCAT
576 _GL_WARN_ON_USE (strncat, "strncat is unportable - "
577 "use gnulib module strncat for portability");
578 # endif
579 #endif
580
581
582 #if @GNULIB_STRNDUP@
583 # if @REPLACE_STRNDUP@
584 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
585 # undef strndup
586 # define strndup rpl_strndup
587 # endif
588 _GL_FUNCDECL_RPL (strndup, char *,
589 (char const *__s, size_t __n)
590 _GL_ARG_NONNULL ((1))
591 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
592 _GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n));
593 # else
594 # if !@HAVE_DECL_STRNDUP@ || (__GNUC__ >= 11 && !defined strndup)
595 _GL_FUNCDECL_SYS (strndup, char *,
596 (char const *__s, size_t __n)
597 _GL_ARG_NONNULL ((1))
598 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
599 # endif
600 _GL_CXXALIAS_SYS (strndup, char *, (char const *__s, size_t __n));
601 # endif
602 _GL_CXXALIASWARN (strndup);
603 #else
604 # if __GNUC__ >= 11 && !defined strndup
605
606 _GL_FUNCDECL_SYS (strndup, char *,
607 (char const *__s, size_t __n)
608 _GL_ARG_NONNULL ((1))
609 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
610 # endif
611 # if defined GNULIB_POSIXCHECK
612 # undef strndup
613 # if HAVE_RAW_DECL_STRNDUP
614 _GL_WARN_ON_USE (strndup, "strndup is unportable - "
615 "use gnulib module strndup for portability");
616 # endif
617 # endif
618 #endif
619
620
621
622
623 #if @GNULIB_STRNLEN@
624 # if @REPLACE_STRNLEN@
625 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
626 # undef strnlen
627 # define strnlen rpl_strnlen
628 # endif
629 _GL_FUNCDECL_RPL (strnlen, size_t, (char const *__s, size_t __maxlen)
630 _GL_ATTRIBUTE_PURE
631 _GL_ARG_NONNULL ((1)));
632 _GL_CXXALIAS_RPL (strnlen, size_t, (char const *__s, size_t __maxlen));
633 # else
634 # if ! @HAVE_DECL_STRNLEN@
635 _GL_FUNCDECL_SYS (strnlen, size_t, (char const *__s, size_t __maxlen)
636 _GL_ATTRIBUTE_PURE
637 _GL_ARG_NONNULL ((1)));
638 # endif
639 _GL_CXXALIAS_SYS (strnlen, size_t, (char const *__s, size_t __maxlen));
640 # endif
641 _GL_CXXALIASWARN (strnlen);
642 #elif defined GNULIB_POSIXCHECK
643 # undef strnlen
644 # if HAVE_RAW_DECL_STRNLEN
645 _GL_WARN_ON_USE (strnlen, "strnlen is unportable - "
646 "use gnulib module strnlen for portability");
647 # endif
648 #endif
649
650 #if defined GNULIB_POSIXCHECK
651
652
653
654
655 # undef strcspn
656
657 _GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings "
658 "in multibyte locales - "
659 "use mbscspn if you care about internationalization");
660 #endif
661
662
663 #if @GNULIB_STRPBRK@
664 # if ! @HAVE_STRPBRK@
665 _GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept)
666 _GL_ATTRIBUTE_PURE
667 _GL_ARG_NONNULL ((1, 2)));
668 # endif
669
670
671
672 _GL_CXXALIAS_SYS_CAST2 (strpbrk,
673 char *, (char const *__s, char const *__accept),
674 const char *, (char const *__s, char const *__accept));
675 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
676 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
677 || defined __clang__)
678 _GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept) throw ());
679 _GL_CXXALIASWARN1 (strpbrk, char const *,
680 (char const *__s, char const *__accept) throw ());
681 # elif __GLIBC__ >= 2
682 _GL_CXXALIASWARN (strpbrk);
683 # endif
684 # if defined GNULIB_POSIXCHECK
685
686
687
688
689 # undef strpbrk
690 _GL_WARN_ON_USE_CXX (strpbrk,
691 const char *, char *, (const char *, const char *),
692 "strpbrk cannot work correctly on character strings "
693 "in multibyte locales - "
694 "use mbspbrk if you care about internationalization");
695 # endif
696 #elif defined GNULIB_POSIXCHECK
697 # undef strpbrk
698 # if HAVE_RAW_DECL_STRPBRK
699 _GL_WARN_ON_USE_CXX (strpbrk,
700 const char *, char *, (const char *, const char *),
701 "strpbrk is unportable - "
702 "use gnulib module strpbrk for portability");
703 # endif
704 #endif
705
706 #if defined GNULIB_POSIXCHECK
707
708
709 # undef strspn
710
711 _GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings "
712 "in multibyte locales - "
713 "use mbsspn if you care about internationalization");
714 #endif
715
716 #if defined GNULIB_POSIXCHECK
717
718
719 # undef strrchr
720
721 _GL_WARN_ON_USE_CXX (strrchr,
722 const char *, char *, (const char *, int),
723 "strrchr cannot work correctly on character strings "
724 "in some multibyte locales - "
725 "use mbsrchr if you care about internationalization");
726 #endif
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744 #if @GNULIB_STRSEP@
745 # if ! @HAVE_STRSEP@
746 _GL_FUNCDECL_SYS (strsep, char *,
747 (char **restrict __stringp, char const *restrict __delim)
748 _GL_ARG_NONNULL ((1, 2)));
749 # endif
750 _GL_CXXALIAS_SYS (strsep, char *,
751 (char **restrict __stringp, char const *restrict __delim));
752 _GL_CXXALIASWARN (strsep);
753 # if defined GNULIB_POSIXCHECK
754 # undef strsep
755 _GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings "
756 "in multibyte locales - "
757 "use mbssep if you care about internationalization");
758 # endif
759 #elif defined GNULIB_POSIXCHECK
760 # undef strsep
761 # if HAVE_RAW_DECL_STRSEP
762 _GL_WARN_ON_USE (strsep, "strsep is unportable - "
763 "use gnulib module strsep for portability");
764 # endif
765 #endif
766
767 #if @GNULIB_STRSTR@
768 # if @REPLACE_STRSTR@
769 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
770 # define strstr rpl_strstr
771 # endif
772 _GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle)
773 _GL_ATTRIBUTE_PURE
774 _GL_ARG_NONNULL ((1, 2)));
775 _GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle));
776 # else
777
778
779
780 _GL_CXXALIAS_SYS_CAST2 (strstr,
781 char *, (const char *haystack, const char *needle),
782 const char *, (const char *haystack, const char *needle));
783 # endif
784 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
785 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
786 || defined __clang__)
787 _GL_CXXALIASWARN1 (strstr, char *,
788 (char *haystack, const char *needle) throw ());
789 _GL_CXXALIASWARN1 (strstr, const char *,
790 (const char *haystack, const char *needle) throw ());
791 # elif __GLIBC__ >= 2
792 _GL_CXXALIASWARN (strstr);
793 # endif
794 #elif defined GNULIB_POSIXCHECK
795
796
797
798
799 # undef strstr
800
801 _GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot "
802 "work correctly on character strings in most "
803 "multibyte locales - "
804 "use mbsstr if you care about internationalization, "
805 "or use strstr if you care about speed");
806 #endif
807
808
809
810 #if @GNULIB_STRCASESTR@
811 # if @REPLACE_STRCASESTR@
812 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
813 # define strcasestr rpl_strcasestr
814 # endif
815 _GL_FUNCDECL_RPL (strcasestr, char *,
816 (const char *haystack, const char *needle)
817 _GL_ATTRIBUTE_PURE
818 _GL_ARG_NONNULL ((1, 2)));
819 _GL_CXXALIAS_RPL (strcasestr, char *,
820 (const char *haystack, const char *needle));
821 # else
822 # if ! @HAVE_STRCASESTR@
823 _GL_FUNCDECL_SYS (strcasestr, char *,
824 (const char *haystack, const char *needle)
825 _GL_ATTRIBUTE_PURE
826 _GL_ARG_NONNULL ((1, 2)));
827 # endif
828
829
830
831 _GL_CXXALIAS_SYS_CAST2 (strcasestr,
832 char *, (const char *haystack, const char *needle),
833 const char *, (const char *haystack, const char *needle));
834 # endif
835 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
836 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
837 || defined __clang__)
838 _GL_CXXALIASWARN1 (strcasestr, char *,
839 (char *haystack, const char *needle) throw ());
840 _GL_CXXALIASWARN1 (strcasestr, const char *,
841 (const char *haystack, const char *needle) throw ());
842 # else
843 _GL_CXXALIASWARN (strcasestr);
844 # endif
845 #elif defined GNULIB_POSIXCHECK
846
847
848
849 # undef strcasestr
850 # if HAVE_RAW_DECL_STRCASESTR
851 _GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character "
852 "strings in multibyte locales - "
853 "use mbscasestr if you care about "
854 "internationalization, or use c-strcasestr if you want "
855 "a locale independent function");
856 # endif
857 #endif
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881 #if @GNULIB_STRTOK_R@
882 # if @REPLACE_STRTOK_R@
883 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
884 # undef strtok_r
885 # define strtok_r rpl_strtok_r
886 # endif
887 _GL_FUNCDECL_RPL (strtok_r, char *,
888 (char *restrict s, char const *restrict delim,
889 char **restrict save_ptr)
890 _GL_ARG_NONNULL ((2, 3)));
891 _GL_CXXALIAS_RPL (strtok_r, char *,
892 (char *restrict s, char const *restrict delim,
893 char **restrict save_ptr));
894 # else
895 # if @UNDEFINE_STRTOK_R@ || defined GNULIB_POSIXCHECK
896 # undef strtok_r
897 # endif
898 # if ! @HAVE_DECL_STRTOK_R@
899 _GL_FUNCDECL_SYS (strtok_r, char *,
900 (char *restrict s, char const *restrict delim,
901 char **restrict save_ptr)
902 _GL_ARG_NONNULL ((2, 3)));
903 # endif
904 _GL_CXXALIAS_SYS (strtok_r, char *,
905 (char *restrict s, char const *restrict delim,
906 char **restrict save_ptr));
907 # endif
908 _GL_CXXALIASWARN (strtok_r);
909 # if defined GNULIB_POSIXCHECK
910 _GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character "
911 "strings in multibyte locales - "
912 "use mbstok_r if you care about internationalization");
913 # endif
914 #elif defined GNULIB_POSIXCHECK
915 # undef strtok_r
916 # if HAVE_RAW_DECL_STRTOK_R
917 _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
918 "use gnulib module strtok_r for portability");
919 # endif
920 #endif
921
922
923
924
925
926 #if @GNULIB_MBSLEN@
927
928
929 # ifdef __MirBSD__
930 # undef mbslen
931 # endif
932 # if @HAVE_MBSLEN@
933 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
934 # define mbslen rpl_mbslen
935 # endif
936 _GL_FUNCDECL_RPL (mbslen, size_t, (const char *string)
937 _GL_ATTRIBUTE_PURE
938 _GL_ARG_NONNULL ((1)));
939 _GL_CXXALIAS_RPL (mbslen, size_t, (const char *string));
940 # else
941 _GL_FUNCDECL_SYS (mbslen, size_t, (const char *string)
942 _GL_ATTRIBUTE_PURE
943 _GL_ARG_NONNULL ((1)));
944 _GL_CXXALIAS_SYS (mbslen, size_t, (const char *string));
945 # endif
946 # if __GLIBC__ >= 2
947 _GL_CXXALIASWARN (mbslen);
948 # endif
949 #endif
950
951 #if @GNULIB_MBSNLEN@
952
953
954 _GL_EXTERN_C size_t mbsnlen (const char *string, size_t len)
955 _GL_ATTRIBUTE_PURE
956 _GL_ARG_NONNULL ((1));
957 #endif
958
959 #if @GNULIB_MBSCHR@
960
961
962
963
964 # if defined __hpux
965 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
966 # define mbschr rpl_mbschr
967 # endif
968 _GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c)
969 _GL_ATTRIBUTE_PURE
970 _GL_ARG_NONNULL ((1)));
971 _GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c));
972 # else
973 _GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c)
974 _GL_ATTRIBUTE_PURE
975 _GL_ARG_NONNULL ((1)));
976 _GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c));
977 # endif
978 _GL_CXXALIASWARN (mbschr);
979 #endif
980
981 #if @GNULIB_MBSRCHR@
982
983
984
985
986 # if defined __hpux || defined __INTERIX
987 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
988 # define mbsrchr rpl_mbsrchr
989 # endif
990 _GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c)
991 _GL_ATTRIBUTE_PURE
992 _GL_ARG_NONNULL ((1)));
993 _GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c));
994 # else
995 _GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c)
996 _GL_ATTRIBUTE_PURE
997 _GL_ARG_NONNULL ((1)));
998 _GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c));
999 # endif
1000 _GL_CXXALIASWARN (mbsrchr);
1001 #endif
1002
1003 #if @GNULIB_MBSSTR@
1004
1005
1006
1007
1008 _GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle)
1009 _GL_ATTRIBUTE_PURE
1010 _GL_ARG_NONNULL ((1, 2));
1011 #endif
1012
1013 #if @GNULIB_MBSCASECMP@
1014
1015
1016
1017
1018
1019
1020 _GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2)
1021 _GL_ATTRIBUTE_PURE
1022 _GL_ARG_NONNULL ((1, 2));
1023 #endif
1024
1025 #if @GNULIB_MBSNCASECMP@
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035 _GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n)
1036 _GL_ATTRIBUTE_PURE
1037 _GL_ARG_NONNULL ((1, 2));
1038 #endif
1039
1040 #if @GNULIB_MBSPCASECMP@
1041
1042
1043
1044
1045
1046
1047
1048
1049 _GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
1050 _GL_ATTRIBUTE_PURE
1051 _GL_ARG_NONNULL ((1, 2));
1052 #endif
1053
1054 #if @GNULIB_MBSCASESTR@
1055
1056
1057
1058
1059
1060 _GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle)
1061 _GL_ATTRIBUTE_PURE
1062 _GL_ARG_NONNULL ((1, 2));
1063 #endif
1064
1065 #if @GNULIB_MBSCSPN@
1066
1067
1068
1069
1070
1071 _GL_EXTERN_C size_t mbscspn (const char *string, const char *accept)
1072 _GL_ATTRIBUTE_PURE
1073 _GL_ARG_NONNULL ((1, 2));
1074 #endif
1075
1076 #if @GNULIB_MBSPBRK@
1077
1078
1079
1080
1081 # if defined __hpux
1082 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1083 # define mbspbrk rpl_mbspbrk
1084 # endif
1085 _GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept)
1086 _GL_ATTRIBUTE_PURE
1087 _GL_ARG_NONNULL ((1, 2)));
1088 _GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept));
1089 # else
1090 _GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept)
1091 _GL_ATTRIBUTE_PURE
1092 _GL_ARG_NONNULL ((1, 2)));
1093 _GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept));
1094 # endif
1095 _GL_CXXALIASWARN (mbspbrk);
1096 #endif
1097
1098 #if @GNULIB_MBSSPN@
1099
1100
1101
1102
1103
1104 _GL_EXTERN_C size_t mbsspn (const char *string, const char *reject)
1105 _GL_ATTRIBUTE_PURE
1106 _GL_ARG_NONNULL ((1, 2));
1107 #endif
1108
1109 #if @GNULIB_MBSSEP@
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124 _GL_EXTERN_C char * mbssep (char **stringp, const char *delim)
1125 _GL_ARG_NONNULL ((1, 2));
1126 #endif
1127
1128 #if @GNULIB_MBSTOK_R@
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145 _GL_EXTERN_C char * mbstok_r (char *restrict string, const char *delim,
1146 char **save_ptr)
1147 _GL_ARG_NONNULL ((2, 3));
1148 #endif
1149
1150
1151 #if @GNULIB_STRERROR@
1152 # if @REPLACE_STRERROR@
1153 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1154 # undef strerror
1155 # define strerror rpl_strerror
1156 # endif
1157 _GL_FUNCDECL_RPL (strerror, char *, (int));
1158 _GL_CXXALIAS_RPL (strerror, char *, (int));
1159 # else
1160 _GL_CXXALIAS_SYS (strerror, char *, (int));
1161 # endif
1162 # if __GLIBC__ >= 2
1163 _GL_CXXALIASWARN (strerror);
1164 # endif
1165 #elif defined GNULIB_POSIXCHECK
1166 # undef strerror
1167
1168 _GL_WARN_ON_USE (strerror, "strerror is unportable - "
1169 "use gnulib module strerror to guarantee non-NULL result");
1170 #endif
1171
1172
1173
1174 #if @GNULIB_STRERROR_R@
1175 # if @REPLACE_STRERROR_R@
1176 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1177 # undef strerror_r
1178 # define strerror_r rpl_strerror_r
1179 # endif
1180 _GL_FUNCDECL_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen)
1181 _GL_ARG_NONNULL ((2)));
1182 _GL_CXXALIAS_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen));
1183 # else
1184 # if !@HAVE_DECL_STRERROR_R@
1185 _GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen)
1186 _GL_ARG_NONNULL ((2)));
1187 # endif
1188 _GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen));
1189 # endif
1190 # if @HAVE_DECL_STRERROR_R@
1191 _GL_CXXALIASWARN (strerror_r);
1192 # endif
1193 #elif defined GNULIB_POSIXCHECK
1194 # undef strerror_r
1195 # if HAVE_RAW_DECL_STRERROR_R
1196 _GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - "
1197 "use gnulib module strerror_r-posix for portability");
1198 # endif
1199 #endif
1200
1201
1202 #if @GNULIB_STRERRORNAME_NP@
1203 # if @REPLACE_STRERRORNAME_NP@
1204 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1205 # undef strerrorname_np
1206 # define strerrorname_np rpl_strerrorname_np
1207 # endif
1208 _GL_FUNCDECL_RPL (strerrorname_np, const char *, (int errnum));
1209 _GL_CXXALIAS_RPL (strerrorname_np, const char *, (int errnum));
1210 # else
1211 # if !@HAVE_STRERRORNAME_NP@
1212 _GL_FUNCDECL_SYS (strerrorname_np, const char *, (int errnum));
1213 # endif
1214 _GL_CXXALIAS_SYS (strerrorname_np, const char *, (int errnum));
1215 # endif
1216 _GL_CXXALIASWARN (strerrorname_np);
1217 #elif defined GNULIB_POSIXCHECK
1218 # undef strerrorname_np
1219 # if HAVE_RAW_DECL_STRERRORNAME_NP
1220 _GL_WARN_ON_USE (strerrorname_np, "strerrorname_np is unportable - "
1221 "use gnulib module strerrorname_np for portability");
1222 # endif
1223 #endif
1224
1225
1226 #if @GNULIB_SIGABBREV_NP@
1227 # if ! @HAVE_SIGABBREV_NP@
1228 _GL_FUNCDECL_SYS (sigabbrev_np, const char *, (int sig));
1229 # endif
1230 _GL_CXXALIAS_SYS (sigabbrev_np, const char *, (int sig));
1231 _GL_CXXALIASWARN (sigabbrev_np);
1232 #elif defined GNULIB_POSIXCHECK
1233 # undef sigabbrev_np
1234 # if HAVE_RAW_DECL_SIGABBREV_NP
1235 _GL_WARN_ON_USE (sigabbrev_np, "sigabbrev_np is unportable - "
1236 "use gnulib module sigabbrev_np for portability");
1237 # endif
1238 #endif
1239
1240
1241 #if @GNULIB_SIGDESCR_NP@
1242 # if ! @HAVE_SIGDESCR_NP@
1243 _GL_FUNCDECL_SYS (sigdescr_np, const char *, (int sig));
1244 # endif
1245 _GL_CXXALIAS_SYS (sigdescr_np, const char *, (int sig));
1246 _GL_CXXALIASWARN (sigdescr_np);
1247 #elif defined GNULIB_POSIXCHECK
1248 # undef sigdescr_np
1249 # if HAVE_RAW_DECL_SIGDESCR_NP
1250 _GL_WARN_ON_USE (sigdescr_np, "sigdescr_np is unportable - "
1251 "use gnulib module sigdescr_np for portability");
1252 # endif
1253 #endif
1254
1255 #if @GNULIB_STRSIGNAL@
1256 # if @REPLACE_STRSIGNAL@
1257 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1258 # define strsignal rpl_strsignal
1259 # endif
1260 _GL_FUNCDECL_RPL (strsignal, char *, (int __sig));
1261 _GL_CXXALIAS_RPL (strsignal, char *, (int __sig));
1262 # else
1263 # if ! @HAVE_DECL_STRSIGNAL@
1264 _GL_FUNCDECL_SYS (strsignal, char *, (int __sig));
1265 # endif
1266
1267
1268 _GL_CXXALIAS_SYS_CAST (strsignal, char *, (int __sig));
1269 # endif
1270 _GL_CXXALIASWARN (strsignal);
1271 #elif defined GNULIB_POSIXCHECK
1272 # undef strsignal
1273 # if HAVE_RAW_DECL_STRSIGNAL
1274 _GL_WARN_ON_USE (strsignal, "strsignal is unportable - "
1275 "use gnulib module strsignal for portability");
1276 # endif
1277 #endif
1278
1279 #if @GNULIB_STRVERSCMP@
1280 # if !@HAVE_STRVERSCMP@
1281 _GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *)
1282 _GL_ATTRIBUTE_PURE
1283 _GL_ARG_NONNULL ((1, 2)));
1284 # endif
1285 _GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *));
1286 _GL_CXXALIASWARN (strverscmp);
1287 #elif defined GNULIB_POSIXCHECK
1288 # undef strverscmp
1289 # if HAVE_RAW_DECL_STRVERSCMP
1290 _GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - "
1291 "use gnulib module strverscmp for portability");
1292 # endif
1293 #endif
1294
1295
1296 #endif
1297 #endif
1298 #endif