powerpc: Fix ifuncmain6pie failure with GCC 4.9
[platform/upstream/glibc.git] / string / string.h
1 /* Copyright (C) 1991-2015 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3
4    The GNU C Library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Lesser General Public
6    License as published by the Free Software Foundation; either
7    version 2.1 of the License, or (at your option) any later version.
8
9    The GNU C Library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Lesser General Public License for more details.
13
14    You should have received a copy of the GNU Lesser General Public
15    License along with the GNU C Library; if not, see
16    <http://www.gnu.org/licenses/>.  */
17
18 /*
19  *      ISO C99 Standard: 7.21 String handling  <string.h>
20  */
21
22 #ifndef _STRING_H
23 #define _STRING_H       1
24
25 #include <features.h>
26
27 __BEGIN_DECLS
28
29 /* Get size_t and NULL from <stddef.h>.  */
30 #define __need_size_t
31 #define __need_NULL
32 #include <stddef.h>
33
34 /* Provide correct C++ prototypes, and indicate this to the caller.  This
35    requires a compatible C++ standard library.  As a heuristic, we provide
36    these when the compiler indicates full conformance with C++98 or later,
37    and for older GCC versions that are known to provide a compatible
38    libstdc++.  */
39 #if defined __cplusplus && (__cplusplus >= 199711L || __GNUC_PREREQ (4, 4))
40 # define __CORRECT_ISO_CPP_STRING_H_PROTO
41 #endif
42
43
44 __BEGIN_NAMESPACE_STD
45 /* Copy N bytes of SRC to DEST.  */
46 extern void *memcpy (void *__restrict __dest, const void *__restrict __src,
47                      size_t __n) __THROW __nonnull ((1, 2));
48 /* Copy N bytes of SRC to DEST, guaranteeing
49    correct behavior for overlapping strings.  */
50 extern void *memmove (void *__dest, const void *__src, size_t __n)
51      __THROW __nonnull ((1, 2));
52 __END_NAMESPACE_STD
53
54 /* Copy no more than N bytes of SRC to DEST, stopping when C is found.
55    Return the position in DEST one byte past where C was copied,
56    or NULL if C was not found in the first N bytes of SRC.  */
57 #if defined __USE_MISC || defined __USE_XOPEN
58 extern void *memccpy (void *__restrict __dest, const void *__restrict __src,
59                       int __c, size_t __n)
60      __THROW __nonnull ((1, 2));
61 #endif /* Misc || X/Open.  */
62
63
64 __BEGIN_NAMESPACE_STD
65 /* Set N bytes of S to C.  */
66 extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
67
68 /* Compare N bytes of S1 and S2.  */
69 extern int memcmp (const void *__s1, const void *__s2, size_t __n)
70      __THROW __attribute_pure__ __nonnull ((1, 2));
71
72 /* Search N bytes of S for C.  */
73 #ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
74 extern "C++"
75 {
76 extern void *memchr (void *__s, int __c, size_t __n)
77       __THROW __asm ("memchr") __attribute_pure__ __nonnull ((1));
78 extern const void *memchr (const void *__s, int __c, size_t __n)
79       __THROW __asm ("memchr") __attribute_pure__ __nonnull ((1));
80
81 # ifdef __OPTIMIZE__
82 __extern_always_inline void *
83 memchr (void *__s, int __c, size_t __n) __THROW
84 {
85   return __builtin_memchr (__s, __c, __n);
86 }
87
88 __extern_always_inline const void *
89 memchr (const void *__s, int __c, size_t __n) __THROW
90 {
91   return __builtin_memchr (__s, __c, __n);
92 }
93 # endif
94 }
95 #else
96 extern void *memchr (const void *__s, int __c, size_t __n)
97       __THROW __attribute_pure__ __nonnull ((1));
98 #endif
99 __END_NAMESPACE_STD
100
101 #ifdef __USE_GNU
102 /* Search in S for C.  This is similar to `memchr' but there is no
103    length limit.  */
104 # ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
105 extern "C++" void *rawmemchr (void *__s, int __c)
106      __THROW __asm ("rawmemchr") __attribute_pure__ __nonnull ((1));
107 extern "C++" const void *rawmemchr (const void *__s, int __c)
108      __THROW __asm ("rawmemchr") __attribute_pure__ __nonnull ((1));
109 # else
110 extern void *rawmemchr (const void *__s, int __c)
111      __THROW __attribute_pure__ __nonnull ((1));
112 # endif
113
114 /* Search N bytes of S for the final occurrence of C.  */
115 # ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
116 extern "C++" void *memrchr (void *__s, int __c, size_t __n)
117       __THROW __asm ("memrchr") __attribute_pure__ __nonnull ((1));
118 extern "C++" const void *memrchr (const void *__s, int __c, size_t __n)
119       __THROW __asm ("memrchr") __attribute_pure__ __nonnull ((1));
120 # else
121 extern void *memrchr (const void *__s, int __c, size_t __n)
122       __THROW __attribute_pure__ __nonnull ((1));
123 # endif
124 #endif
125
126
127 __BEGIN_NAMESPACE_STD
128 /* Copy SRC to DEST.  */
129 extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
130      __THROW __nonnull ((1, 2));
131 /* Copy no more than N characters of SRC to DEST.  */
132 extern char *strncpy (char *__restrict __dest,
133                       const char *__restrict __src, size_t __n)
134      __THROW __nonnull ((1, 2));
135
136 /* Append SRC onto DEST.  */
137 extern char *strcat (char *__restrict __dest, const char *__restrict __src)
138      __THROW __nonnull ((1, 2));
139 /* Append no more than N characters from SRC onto DEST.  */
140 extern char *strncat (char *__restrict __dest, const char *__restrict __src,
141                       size_t __n) __THROW __nonnull ((1, 2));
142
143 /* Compare S1 and S2.  */
144 extern int strcmp (const char *__s1, const char *__s2)
145      __THROW __attribute_pure__ __nonnull ((1, 2));
146 /* Compare N characters of S1 and S2.  */
147 extern int strncmp (const char *__s1, const char *__s2, size_t __n)
148      __THROW __attribute_pure__ __nonnull ((1, 2));
149
150 /* Compare the collated forms of S1 and S2.  */
151 extern int strcoll (const char *__s1, const char *__s2)
152      __THROW __attribute_pure__ __nonnull ((1, 2));
153 /* Put a transformation of SRC into no more than N bytes of DEST.  */
154 extern size_t strxfrm (char *__restrict __dest,
155                        const char *__restrict __src, size_t __n)
156      __THROW __nonnull ((2));
157 __END_NAMESPACE_STD
158
159 #ifdef __USE_XOPEN2K8
160 /* The following functions are equivalent to the both above but they
161    take the locale they use for the collation as an extra argument.
162    This is not standardsized but something like will come.  */
163 # include <xlocale.h>
164
165 /* Compare the collated forms of S1 and S2 using rules from L.  */
166 extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l)
167      __THROW __attribute_pure__ __nonnull ((1, 2, 3));
168 /* Put a transformation of SRC into no more than N bytes of DEST.  */
169 extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n,
170                          __locale_t __l) __THROW __nonnull ((2, 4));
171 #endif
172
173 #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
174 /* Duplicate S, returning an identical malloc'd string.  */
175 extern char *strdup (const char *__s)
176      __THROW __attribute_malloc__ __nonnull ((1));
177 #endif
178
179 /* Return a malloc'd copy of at most N bytes of STRING.  The
180    resultant string is terminated even if no null terminator
181    appears before STRING[N].  */
182 #if defined __USE_XOPEN2K8
183 extern char *strndup (const char *__string, size_t __n)
184      __THROW __attribute_malloc__ __nonnull ((1));
185 #endif
186
187 #if defined __USE_GNU && defined __GNUC__
188 /* Duplicate S, returning an identical alloca'd string.  */
189 # define strdupa(s)                                                           \
190   (__extension__                                                              \
191     ({                                                                        \
192       const char *__old = (s);                                                \
193       size_t __len = strlen (__old) + 1;                                      \
194       char *__new = (char *) __builtin_alloca (__len);                        \
195       (char *) memcpy (__new, __old, __len);                                  \
196     }))
197
198 /* Return an alloca'd copy of at most N bytes of string.  */
199 # define strndupa(s, n)                                                       \
200   (__extension__                                                              \
201     ({                                                                        \
202       const char *__old = (s);                                                \
203       size_t __len = strnlen (__old, (n));                                    \
204       char *__new = (char *) __builtin_alloca (__len + 1);                    \
205       __new[__len] = '\0';                                                    \
206       (char *) memcpy (__new, __old, __len);                                  \
207     }))
208 #endif
209
210 __BEGIN_NAMESPACE_STD
211 /* Find the first occurrence of C in S.  */
212 #ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
213 extern "C++"
214 {
215 extern char *strchr (char *__s, int __c)
216      __THROW __asm ("strchr") __attribute_pure__ __nonnull ((1));
217 extern const char *strchr (const char *__s, int __c)
218      __THROW __asm ("strchr") __attribute_pure__ __nonnull ((1));
219
220 # ifdef __OPTIMIZE__
221 __extern_always_inline char *
222 strchr (char *__s, int __c) __THROW
223 {
224   return __builtin_strchr (__s, __c);
225 }
226
227 __extern_always_inline const char *
228 strchr (const char *__s, int __c) __THROW
229 {
230   return __builtin_strchr (__s, __c);
231 }
232 # endif
233 }
234 #else
235 extern char *strchr (const char *__s, int __c)
236      __THROW __attribute_pure__ __nonnull ((1));
237 #endif
238 /* Find the last occurrence of C in S.  */
239 #ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
240 extern "C++"
241 {
242 extern char *strrchr (char *__s, int __c)
243      __THROW __asm ("strrchr") __attribute_pure__ __nonnull ((1));
244 extern const char *strrchr (const char *__s, int __c)
245      __THROW __asm ("strrchr") __attribute_pure__ __nonnull ((1));
246
247 # ifdef __OPTIMIZE__
248 __extern_always_inline char *
249 strrchr (char *__s, int __c) __THROW
250 {
251   return __builtin_strrchr (__s, __c);
252 }
253
254 __extern_always_inline const char *
255 strrchr (const char *__s, int __c) __THROW
256 {
257   return __builtin_strrchr (__s, __c);
258 }
259 # endif
260 }
261 #else
262 extern char *strrchr (const char *__s, int __c)
263      __THROW __attribute_pure__ __nonnull ((1));
264 #endif
265 __END_NAMESPACE_STD
266
267 #ifdef __USE_GNU
268 /* This function is similar to `strchr'.  But it returns a pointer to
269    the closing NUL byte in case C is not found in S.  */
270 # ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
271 extern "C++" char *strchrnul (char *__s, int __c)
272      __THROW __asm ("strchrnul") __attribute_pure__ __nonnull ((1));
273 extern "C++" const char *strchrnul (const char *__s, int __c)
274      __THROW __asm ("strchrnul") __attribute_pure__ __nonnull ((1));
275 # else
276 extern char *strchrnul (const char *__s, int __c)
277      __THROW __attribute_pure__ __nonnull ((1));
278 # endif
279 #endif
280
281 __BEGIN_NAMESPACE_STD
282 /* Return the length of the initial segment of S which
283    consists entirely of characters not in REJECT.  */
284 extern size_t strcspn (const char *__s, const char *__reject)
285      __THROW __attribute_pure__ __nonnull ((1, 2));
286 /* Return the length of the initial segment of S which
287    consists entirely of characters in ACCEPT.  */
288 extern size_t strspn (const char *__s, const char *__accept)
289      __THROW __attribute_pure__ __nonnull ((1, 2));
290 /* Find the first occurrence in S of any character in ACCEPT.  */
291 #ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
292 extern "C++"
293 {
294 extern char *strpbrk (char *__s, const char *__accept)
295      __THROW __asm ("strpbrk") __attribute_pure__ __nonnull ((1, 2));
296 extern const char *strpbrk (const char *__s, const char *__accept)
297      __THROW __asm ("strpbrk") __attribute_pure__ __nonnull ((1, 2));
298
299 # ifdef __OPTIMIZE__
300 __extern_always_inline char *
301 strpbrk (char *__s, const char *__accept) __THROW
302 {
303   return __builtin_strpbrk (__s, __accept);
304 }
305
306 __extern_always_inline const char *
307 strpbrk (const char *__s, const char *__accept) __THROW
308 {
309   return __builtin_strpbrk (__s, __accept);
310 }
311 # endif
312 }
313 #else
314 extern char *strpbrk (const char *__s, const char *__accept)
315      __THROW __attribute_pure__ __nonnull ((1, 2));
316 #endif
317 /* Find the first occurrence of NEEDLE in HAYSTACK.  */
318 #ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
319 extern "C++"
320 {
321 extern char *strstr (char *__haystack, const char *__needle)
322      __THROW __asm ("strstr") __attribute_pure__ __nonnull ((1, 2));
323 extern const char *strstr (const char *__haystack, const char *__needle)
324      __THROW __asm ("strstr") __attribute_pure__ __nonnull ((1, 2));
325
326 # ifdef __OPTIMIZE__
327 __extern_always_inline char *
328 strstr (char *__haystack, const char *__needle) __THROW
329 {
330   return __builtin_strstr (__haystack, __needle);
331 }
332
333 __extern_always_inline const char *
334 strstr (const char *__haystack, const char *__needle) __THROW
335 {
336   return __builtin_strstr (__haystack, __needle);
337 }
338 # endif
339 }
340 #else
341 extern char *strstr (const char *__haystack, const char *__needle)
342      __THROW __attribute_pure__ __nonnull ((1, 2));
343 #endif
344
345
346 /* Divide S into tokens separated by characters in DELIM.  */
347 extern char *strtok (char *__restrict __s, const char *__restrict __delim)
348      __THROW __nonnull ((2));
349 __END_NAMESPACE_STD
350
351 /* Divide S into tokens separated by characters in DELIM.  Information
352    passed between calls are stored in SAVE_PTR.  */
353 extern char *__strtok_r (char *__restrict __s,
354                          const char *__restrict __delim,
355                          char **__restrict __save_ptr)
356      __THROW __nonnull ((2, 3));
357 #ifdef __USE_POSIX
358 extern char *strtok_r (char *__restrict __s, const char *__restrict __delim,
359                        char **__restrict __save_ptr)
360      __THROW __nonnull ((2, 3));
361 #endif
362
363 #ifdef __USE_GNU
364 /* Similar to `strstr' but this function ignores the case of both strings.  */
365 # ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
366 extern "C++" char *strcasestr (char *__haystack, const char *__needle)
367      __THROW __asm ("strcasestr") __attribute_pure__ __nonnull ((1, 2));
368 extern "C++" const char *strcasestr (const char *__haystack,
369                                      const char *__needle)
370      __THROW __asm ("strcasestr") __attribute_pure__ __nonnull ((1, 2));
371 # else
372 extern char *strcasestr (const char *__haystack, const char *__needle)
373      __THROW __attribute_pure__ __nonnull ((1, 2));
374 # endif
375 #endif
376
377 #ifdef __USE_GNU
378 /* Find the first occurrence of NEEDLE in HAYSTACK.
379    NEEDLE is NEEDLELEN bytes long;
380    HAYSTACK is HAYSTACKLEN bytes long.  */
381 extern void *memmem (const void *__haystack, size_t __haystacklen,
382                      const void *__needle, size_t __needlelen)
383      __THROW __attribute_pure__ __nonnull ((1, 3));
384
385 /* Copy N bytes of SRC to DEST, return pointer to bytes after the
386    last written byte.  */
387 extern void *__mempcpy (void *__restrict __dest,
388                         const void *__restrict __src, size_t __n)
389      __THROW __nonnull ((1, 2));
390 extern void *mempcpy (void *__restrict __dest,
391                       const void *__restrict __src, size_t __n)
392      __THROW __nonnull ((1, 2));
393 #endif
394
395
396 __BEGIN_NAMESPACE_STD
397 /* Return the length of S.  */
398 extern size_t strlen (const char *__s)
399      __THROW __attribute_pure__ __nonnull ((1));
400 __END_NAMESPACE_STD
401
402 #ifdef  __USE_XOPEN2K8
403 /* Find the length of STRING, but scan at most MAXLEN characters.
404    If no '\0' terminator is found in that many characters, return MAXLEN.  */
405 extern size_t strnlen (const char *__string, size_t __maxlen)
406      __THROW __attribute_pure__ __nonnull ((1));
407 #endif
408
409
410 __BEGIN_NAMESPACE_STD
411 /* Return a string describing the meaning of the `errno' code in ERRNUM.  */
412 extern char *strerror (int __errnum) __THROW;
413 __END_NAMESPACE_STD
414 #ifdef __USE_XOPEN2K
415 /* Reentrant version of `strerror'.
416    There are 2 flavors of `strerror_r', GNU which returns the string
417    and may or may not use the supplied temporary buffer and POSIX one
418    which fills the string into the buffer.
419    To use the POSIX version, -D_XOPEN_SOURCE=600 or -D_POSIX_C_SOURCE=200112L
420    without -D_GNU_SOURCE is needed, otherwise the GNU version is
421    preferred.  */
422 # if defined __USE_XOPEN2K && !defined __USE_GNU
423 /* Fill BUF with a string describing the meaning of the `errno' code in
424    ERRNUM.  */
425 #  ifdef __REDIRECT_NTH
426 extern int __REDIRECT_NTH (strerror_r,
427                            (int __errnum, char *__buf, size_t __buflen),
428                            __xpg_strerror_r) __nonnull ((2));
429 #  else
430 extern int __xpg_strerror_r (int __errnum, char *__buf, size_t __buflen)
431      __THROW __nonnull ((2));
432 #   define strerror_r __xpg_strerror_r
433 #  endif
434 # else
435 /* If a temporary buffer is required, at most BUFLEN bytes of BUF will be
436    used.  */
437 extern char *strerror_r (int __errnum, char *__buf, size_t __buflen)
438      __THROW __nonnull ((2)) __wur;
439 # endif
440 #endif
441
442 #ifdef __USE_XOPEN2K8
443 /* Translate error number to string according to the locale L.  */
444 extern char *strerror_l (int __errnum, __locale_t __l) __THROW;
445 #endif
446
447
448 /* We define this function always since `bzero' is sometimes needed when
449    the namespace rules does not allow this.  */
450 extern void __bzero (void *__s, size_t __n) __THROW __nonnull ((1));
451
452 #ifdef __USE_MISC
453 /* Copy N bytes of SRC to DEST (like memmove, but args reversed).  */
454 extern void bcopy (const void *__src, void *__dest, size_t __n)
455      __THROW __nonnull ((1, 2));
456
457 /* Set N bytes of S to 0.  */
458 extern void bzero (void *__s, size_t __n) __THROW __nonnull ((1));
459
460 /* Compare N bytes of S1 and S2 (same as memcmp).  */
461 extern int bcmp (const void *__s1, const void *__s2, size_t __n)
462      __THROW __attribute_pure__ __nonnull ((1, 2));
463
464 /* Find the first occurrence of C in S (same as strchr).  */
465 # ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
466 extern "C++"
467 {
468 extern char *index (char *__s, int __c)
469      __THROW __asm ("index") __attribute_pure__ __nonnull ((1));
470 extern const char *index (const char *__s, int __c)
471      __THROW __asm ("index") __attribute_pure__ __nonnull ((1));
472
473 #  if defined __OPTIMIZE__ && !defined __CORRECT_ISO_CPP_STRINGS_H_PROTO
474 __extern_always_inline char *
475 index (char *__s, int __c) __THROW
476 {
477   return __builtin_index (__s, __c);
478 }
479
480 __extern_always_inline const char *
481 index (const char *__s, int __c) __THROW
482 {
483   return __builtin_index (__s, __c);
484 }
485 #  endif
486 }
487 # else
488 extern char *index (const char *__s, int __c)
489      __THROW __attribute_pure__ __nonnull ((1));
490 # endif
491
492 /* Find the last occurrence of C in S (same as strrchr).  */
493 # ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
494 extern "C++"
495 {
496 extern char *rindex (char *__s, int __c)
497      __THROW __asm ("rindex") __attribute_pure__ __nonnull ((1));
498 extern const char *rindex (const char *__s, int __c)
499      __THROW __asm ("rindex") __attribute_pure__ __nonnull ((1));
500
501 #  if defined __OPTIMIZE__ && !defined __CORRECT_ISO_CPP_STRINGS_H_PROTO
502 __extern_always_inline char *
503 rindex (char *__s, int __c) __THROW
504 {
505   return __builtin_rindex (__s, __c);
506 }
507
508 __extern_always_inline const char *
509 rindex (const char *__s, int __c) __THROW
510 {
511   return __builtin_rindex (__s, __c);
512 }
513 #endif
514 }
515 # else
516 extern char *rindex (const char *__s, int __c)
517      __THROW __attribute_pure__ __nonnull ((1));
518 # endif
519
520 /* Return the position of the first bit set in I, or 0 if none are set.
521    The least-significant bit is position 1, the most-significant 32.  */
522 extern int ffs (int __i) __THROW __attribute__ ((__const__));
523
524 /* The following two functions are non-standard but necessary for non-32 bit
525    platforms.  */
526 # ifdef __USE_GNU
527 extern int ffsl (long int __l) __THROW __attribute__ ((__const__));
528 __extension__ extern int ffsll (long long int __ll)
529      __THROW __attribute__ ((__const__));
530 # endif
531
532 /* Compare S1 and S2, ignoring case.  */
533 extern int strcasecmp (const char *__s1, const char *__s2)
534      __THROW __attribute_pure__ __nonnull ((1, 2));
535
536 /* Compare no more than N chars of S1 and S2, ignoring case.  */
537 extern int strncasecmp (const char *__s1, const char *__s2, size_t __n)
538      __THROW __attribute_pure__ __nonnull ((1, 2));
539 #endif /* Use misc.  */
540
541 #ifdef  __USE_GNU
542 /* Again versions of a few functions which use the given locale instead
543    of the global one.  */
544 extern int strcasecmp_l (const char *__s1, const char *__s2,
545                          __locale_t __loc)
546      __THROW __attribute_pure__ __nonnull ((1, 2, 3));
547
548 extern int strncasecmp_l (const char *__s1, const char *__s2,
549                           size_t __n, __locale_t __loc)
550      __THROW __attribute_pure__ __nonnull ((1, 2, 4));
551 #endif
552
553 #ifdef  __USE_MISC
554 /* Return the next DELIM-delimited token from *STRINGP,
555    terminating it with a '\0', and update *STRINGP to point past it.  */
556 extern char *strsep (char **__restrict __stringp,
557                      const char *__restrict __delim)
558      __THROW __nonnull ((1, 2));
559 #endif
560
561 #ifdef  __USE_XOPEN2K8
562 /* Return a string describing the meaning of the signal number in SIG.  */
563 extern char *strsignal (int __sig) __THROW;
564
565 /* Copy SRC to DEST, returning the address of the terminating '\0' in DEST.  */
566 extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src)
567      __THROW __nonnull ((1, 2));
568 extern char *stpcpy (char *__restrict __dest, const char *__restrict __src)
569      __THROW __nonnull ((1, 2));
570
571 /* Copy no more than N characters of SRC to DEST, returning the address of
572    the last character written into DEST.  */
573 extern char *__stpncpy (char *__restrict __dest,
574                         const char *__restrict __src, size_t __n)
575      __THROW __nonnull ((1, 2));
576 extern char *stpncpy (char *__restrict __dest,
577                       const char *__restrict __src, size_t __n)
578      __THROW __nonnull ((1, 2));
579 #endif
580
581 #ifdef  __USE_GNU
582 /* Compare S1 and S2 as strings holding name & indices/version numbers.  */
583 extern int strverscmp (const char *__s1, const char *__s2)
584      __THROW __attribute_pure__ __nonnull ((1, 2));
585
586 /* Sautee STRING briskly.  */
587 extern char *strfry (char *__string) __THROW __nonnull ((1));
588
589 /* Frobnicate N bytes of S.  */
590 extern void *memfrob (void *__s, size_t __n) __THROW __nonnull ((1));
591
592 # ifndef basename
593 /* Return the file name within directory of FILENAME.  We don't
594    declare the function if the `basename' macro is available (defined
595    in <libgen.h>) which makes the XPG version of this function
596    available.  */
597 #  ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
598 extern "C++" char *basename (char *__filename)
599      __THROW __asm ("basename") __nonnull ((1));
600 extern "C++" const char *basename (const char *__filename)
601      __THROW __asm ("basename") __nonnull ((1));
602 #  else
603 extern char *basename (const char *__filename) __THROW __nonnull ((1));
604 #  endif
605 # endif
606 #endif
607
608
609 #if defined __GNUC__ && __GNUC__ >= 2
610 # if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ \
611      && !defined __NO_INLINE__ && !defined __cplusplus
612 /* When using GNU CC we provide some optimized versions of selected
613    functions from this header.  There are two kinds of optimizations:
614
615    - machine-dependent optimizations, most probably using inline
616      assembler code; these might be quite expensive since the code
617      size can increase significantly.
618      These optimizations are not used unless the symbol
619         __USE_STRING_INLINES
620      is defined before including this header.
621
622    - machine-independent optimizations which do not increase the
623      code size significantly and which optimize mainly situations
624      where one or more arguments are compile-time constants.
625      These optimizations are used always when the compiler is
626      taught to optimize.
627
628    One can inhibit all optimizations by defining __NO_STRING_INLINES.  */
629
630 /* Get the machine-dependent optimizations (if any).  */
631 #  include <bits/string.h>
632
633 /* These are generic optimizations which do not add too much inline code.  */
634 #  include <bits/string2.h>
635 # endif
636
637 # if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
638 /* Functions with security checks.  */
639 #  include <bits/string3.h>
640 # endif
641 #endif
642
643 __END_DECLS
644
645 #endif /* string.h  */