]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - include/string.h
test-container: Fix "unused code" warnings on HURD
[thirdparty/glibc.git] / include / string.h
index d6d859491e9906cba94ef7814ba0352ed0781a92..21f641a413918ff4ae18ab2e85a6f66367a4f96c 100644 (file)
@@ -1,7 +1,10 @@
 #ifndef _STRING_H
 
 #ifndef _ISOMAC
+/* Some of these are defined as macros in the real string.h, so we must
+   prototype them before including it.  */
 #include <sys/types.h>
+#include <locale.h>
 
 extern void *__memccpy (void *__dest, const void *__src,
                        int __c, size_t __n);
@@ -10,6 +13,7 @@ extern size_t __strnlen (const char *__string, size_t __maxlen)
      __attribute_pure__;
 
 extern char *__strsep (char **__stringp, const char *__delim);
+libc_hidden_proto (__strsep)
 
 extern int __strverscmp (const char *__s1, const char *__s2)
      __attribute_pure__;
@@ -41,13 +45,21 @@ extern void *__memrchr (const void *__s, int __c, size_t __n)
 extern void *__memchr (const void *__s, int __c, size_t __n)
      __attribute_pure__;
 
+extern void __bzero (void *__s, size_t __n) __THROW __nonnull ((1));
+
 extern int __ffs (int __i) __attribute__ ((const));
 
 extern char *__strerror_r (int __errnum, char *__buf, size_t __buflen);
+
+extern char *__strerror_l (int __errnum, locale_t __loc);
+
+extern const char *__sigdescr_np (int __errnum);
+libc_hidden_proto (__sigdescr_np)
+
+/* Get _STRING_ARCH_unaligned.  */
+#include <string_private.h>
 #endif
 
-/* Now the real definitions.  We do this here since some of the functions
-   above are defined as macros in the headers.  */
 #include <string/string.h>
 
 #ifndef _ISOMAC
@@ -57,7 +69,7 @@ extern __typeof (strcasecmp_l) __strcasecmp_l;
 extern __typeof (strncasecmp_l) __strncasecmp_l;
 
 /* Alternative version which doesn't pollute glibc's namespace.  */
-#ifndef NOT_IN_libc
+#if IS_IN (libc)
 # undef strndupa
 # define strndupa(s, n)                                                              \
   (__extension__                                                             \
@@ -71,17 +83,27 @@ extern __typeof (strncasecmp_l) __strncasecmp_l;
 #endif
 
 libc_hidden_proto (__mempcpy)
+#ifndef __NO_STRING_INLINES
+# define __mempcpy(dest, src, n) __builtin_mempcpy (dest, src, n)
+#endif
 libc_hidden_proto (__stpcpy)
+#ifndef __NO_STRING_INLINES
+# define __stpcpy(dest, src) __builtin_stpcpy (dest, src)
+#endif
 libc_hidden_proto (__stpncpy)
 libc_hidden_proto (__rawmemchr)
 libc_hidden_proto (__strcasecmp)
 libc_hidden_proto (__strcasecmp_l)
 libc_hidden_proto (__strncasecmp_l)
+extern __typeof (strncat) __strncat;
+libc_hidden_proto (__strncat)
 libc_hidden_proto (__strdup)
 libc_hidden_proto (__strndup)
 libc_hidden_proto (__strerror_r)
 libc_hidden_proto (__strverscmp)
 libc_hidden_proto (basename)
+extern char *__basename (const char *__filename) __THROW __nonnull ((1));
+libc_hidden_proto (__basename)
 libc_hidden_proto (strcoll)
 libc_hidden_proto (__strcoll_l)
 libc_hidden_proto (__strxfrm_l)
@@ -89,7 +111,25 @@ libc_hidden_proto (__strtok_r)
 extern char *__strsep_g (char **__stringp, const char *__delim);
 libc_hidden_proto (__strsep_g)
 libc_hidden_proto (strnlen)
+libc_hidden_proto (__strnlen)
+libc_hidden_proto (__memcmpeq)
 libc_hidden_proto (memmem)
+extern __typeof (memmem) __memmem;
+libc_hidden_proto (__memmem)
+libc_hidden_proto (__ffs)
+libc_hidden_proto (__strerror_l)
+
+#if IS_IN (libc)
+/* Avoid hidden reference to IFUNC symbol __explicit_bzero_chk.  */
+void __explicit_bzero_chk_internal (void *, size_t, size_t)
+  __THROW __nonnull ((1)) attribute_hidden;
+# define explicit_bzero(buf, len) \
+  __explicit_bzero_chk_internal (buf, len, __glibc_objsize0 (buf))
+#elif !IS_IN (nonlib)
+void __explicit_bzero_chk (void *, size_t, size_t) __THROW __nonnull ((1));
+# define explicit_bzero(buf, len) __explicit_bzero_chk (buf, len,            \
+                                                       __glibc_objsize0 (buf))
+#endif
 
 libc_hidden_builtin_proto (memchr)
 libc_hidden_builtin_proto (memcpy)
@@ -112,14 +152,33 @@ libc_hidden_builtin_proto (strspn)
 libc_hidden_builtin_proto (strstr)
 libc_hidden_builtin_proto (ffs)
 
-# ifndef _ISOMAC
-#  ifndef index
-#   define index(s, c) (strchr ((s), (c)))
-#  endif
-#  ifndef rindex
-#   define rindex(s, c)        (strrchr ((s), (c)))
-#  endif
-# endif
+#if IS_IN (rtld)
+extern __typeof (__stpcpy) __stpcpy attribute_hidden;
+extern __typeof (__strdup) __strdup attribute_hidden;
+extern __typeof (__strerror_r) __strerror_r attribute_hidden;
+extern __typeof (__strsep_g) __strsep_g attribute_hidden;
+
+extern __typeof (memchr) memchr attribute_hidden;
+extern __typeof (memcmp) memcmp attribute_hidden;
+extern __typeof (memcpy) memcpy attribute_hidden;
+extern __typeof (memmove) memmove attribute_hidden;
+extern __typeof (memset) memset attribute_hidden;
+extern __typeof (rawmemchr) rawmemchr attribute_hidden;
+extern __typeof (stpcpy) stpcpy attribute_hidden;
+extern __typeof (strchr) strchr attribute_hidden;
+extern __typeof (strcmp) strcmp attribute_hidden;
+extern __typeof (strlen) strlen attribute_hidden;
+extern __typeof (strnlen) strnlen attribute_hidden;
+extern __typeof (strsep) strsep attribute_hidden;
+#endif
+
+#if (!IS_IN (libc) || !defined SHARED) \
+  && !defined NO_MEMPCPY_STPCPY_REDIRECT
+/* Redirect calls to __builtin_mempcpy and __builtin_stpcpy to call
+   __mempcpy and __stpcpy if not inlined.  */
+extern __typeof (mempcpy) mempcpy __asm__ ("__mempcpy");
+extern __typeof (stpcpy) stpcpy __asm__ ("__stpcpy");
+#endif
 
 extern void *__memcpy_chk (void *__restrict __dest,
                           const void *__restrict __src, size_t __len,