about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-05-17 17:25:32 +0000
committerUlrich Drepper <drepper@redhat.com>1999-05-17 17:25:32 +0000
commit9bbd7837b698c0bba325de00cd396c1e970ab281 (patch)
tree44023c4f36e4d1acf2d5107cd9ee2cd368f5d1ca
parent431c33c0bc7cb43231da4364187e0161b0541071 (diff)
downloadglibc-9bbd7837b698c0bba325de00cd396c1e970ab281.tar.gz
glibc-9bbd7837b698c0bba325de00cd396c1e970ab281.tar.xz
glibc-9bbd7837b698c0bba325de00cd396c1e970ab281.zip
Update.
1999-05-17  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* sysdeps/i386/i486/Versions: New file with inline functions from
	sysdeps/i386/i486/bits/string.h for now.

	* sysdeps/i386/Versions: Add inline functions from
	sysdeps/i386/bits/string.h.

	* string/Versions: Add inline functions from <bits/string2.h>.

	* string/Makefile (routines): Add string-inlines.
	* string/string-inlines.c: New file, used for implementation of
	extern inline functions.

	* sysdeps/i386/i486/bits/string.h: Use _FORCE_INLINES to generate
	non inlined versions of functions.
	* string/bits/string2.h: Likewise.
	* sysdeps/i386/bits/string.h: Likewise.

1999-05-17  Ulrich Drepper  <drepper@cygnus.com>

	* inet/arpa/tftp.h: Add second packed attribute.
-rw-r--r--ChangeLog23
-rw-r--r--inet/arpa/tftp.h2
-rw-r--r--string/Makefile2
-rw-r--r--string/Versions6
-rw-r--r--string/bits/string2.h16
-rw-r--r--string/string-inlines.c28
-rw-r--r--sysdeps/i386/Versions5
-rw-r--r--sysdeps/i386/bits/string.h66
-rw-r--r--sysdeps/i386/i486/Versions13
-rw-r--r--sysdeps/i386/i486/bits/string.h35
10 files changed, 153 insertions, 43 deletions
diff --git a/ChangeLog b/ChangeLog
index b4942af87c..e328926e72 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+1999-05-17  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
+	* sysdeps/i386/i486/Versions: New file with inline functions from
+	sysdeps/i386/i486/bits/string.h for now.
+
+	* sysdeps/i386/Versions: Add inline functions from
+	sysdeps/i386/bits/string.h.
+
+	* string/Versions: Add inline functions from <bits/string2.h>.
+
+	* string/Makefile (routines): Add string-inlines.
+	* string/string-inlines.c: New file, used for implementation of
+	extern inline functions.
+
+	* sysdeps/i386/i486/bits/string.h: Use _FORCE_INLINES to generate
+	non inlined versions of functions.
+	* string/bits/string2.h: Likewise.
+	* sysdeps/i386/bits/string.h: Likewise.
+
+1999-05-17  Ulrich Drepper  <drepper@cygnus.com>
+
+	* inet/arpa/tftp.h: Add second packed attribute.
+
 1999-05-16  Wolfram Gloger  <wmglo@dent.med.uni-muenchen.de>
 
 	* malloc/malloc.c: Cleanup to bring in line with released
diff --git a/inet/arpa/tftp.h b/inet/arpa/tftp.h
index 719c31bf7d..15bfc656c2 100644
--- a/inet/arpa/tftp.h
+++ b/inet/arpa/tftp.h
@@ -56,7 +56,7 @@ struct	tftphdr {
 		unsigned short	tu_block;	/* block # */
 		short	tu_code;		/* error code */
 		char	tu_stuff[1];		/* request packet stuff */
-	} th_u;
+	} th_u __attribute__ ((__packed__));
 	char	th_data[1];			/* data or error string */
 } __attribute__ ((__packed__));
 
diff --git a/string/Makefile b/string/Makefile
index d0e3c8e83b..cb6475a1fe 100644
--- a/string/Makefile
+++ b/string/Makefile
@@ -39,7 +39,7 @@ routines	:= strcat strchr strcmp strcoll strcpy strcspn		\
 			             delete extract insert stringify	\
 				     addsep replace)			\
 		   envz basename					\
-		   strcoll_l strxfrm_l
+		   strcoll_l strxfrm_l string-inlines
 
 tests		:= tester inl-tester noinl-tester testcopy test-ffs	\
 		   tst-strlen stratcliff tst-svc tst-inlcall
diff --git a/string/Versions b/string/Versions
index 48562e9e4c..d324e2e2ab 100644
--- a/string/Versions
+++ b/string/Versions
@@ -57,6 +57,12 @@ libc {
     strcasestr; strverscmp;
   }
   GLIBC_2.1.1 {
+    # extern inline functions used by <bits/string2.h>
+    __mempcpy_small; __stpcpy_small; __strcspn_c1; __strcspn_c2; __strcspn_c3;
+    __strcpy_small; __strspn_c1; __strspn_c2; __strspn_c3; __strpbrk_c2; 
+    __strpbrk_c3; __strsep_1c; __strsep_2c; __strsep_3c; __strsep_g; 
+    __strtok_r_1c; 
+
     # s*
     strchrnul; __strverscmp;
   }
diff --git a/string/bits/string2.h b/string/bits/string2.h
index 4d67c57a77..fdfa32dc2c 100644
--- a/string/bits/string2.h
+++ b/string/bits/string2.h
@@ -39,10 +39,12 @@
    We must use here macros instead of inline functions since the
    trick won't work with the later.  */
 
-#ifdef __cplusplus
-# define __STRING_INLINE inline
-#else
-# define __STRING_INLINE extern __inline
+#ifndef __STRING_INLINE
+# ifdef __cplusplus
+#  define __STRING_INLINE inline
+# else
+#  define __STRING_INLINE extern __inline
+# endif
 #endif
 
 #if _STRING_ARCH_unaligned
@@ -939,7 +941,7 @@ __strpbrk_c3 (__const char *__s, char __accept1, char __accept2,
 #endif
 
 
-#ifdef __USE_GNU
+#if defined __USE_GNU && !defined _FORCE_INLINES
 # ifndef _HAVE_STRING_ARCH_strnlen
 __STRING_INLINE size_t strnlen (__const char *__string, size_t __maxlen);
 __STRING_INLINE size_t
@@ -1151,6 +1153,8 @@ __strsep_g (char **__s, __const char *__reject)
 
 #endif /* Use misc. or use GNU.  */
 
-#undef __STRING_INLINE
+#ifndef _FORCE_INLINES
+# undef __STRING_INLINE
+#endif
 
 #endif /* No string inlines.  */
diff --git a/string/string-inlines.c b/string/string-inlines.c
new file mode 100644
index 0000000000..6406ba357f
--- /dev/null
+++ b/string/string-inlines.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 1999 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/*  <bits/string.h> and <bits/string2.h> declare some extern inline
+    functions.  These functions are declared additionally here if
+    inlining is not possible.  */
+
+#define __USE_STRING_INLINES
+#define _FORCE_INLINES
+#define __STRING_INLINE /* empty */
+
+#include <string.h>
+
diff --git a/sysdeps/i386/Versions b/sysdeps/i386/Versions
index a45b00d1e0..57951ebdf6 100644
--- a/sysdeps/i386/Versions
+++ b/sysdeps/i386/Versions
@@ -7,4 +7,9 @@ libc {
     # global variable
     _fp_hw;
   }
+  GLIBC_2.1.1 {
+    # extern inline functions used by <bits/string.h>
+    __memcpy_c; __memset_cc; __memset_cg; __memset_gg; __strchr_c; __strchr_g;
+    __strchrnul_c; __strchrnul_g;
+  }
 }
diff --git a/sysdeps/i386/bits/string.h b/sysdeps/i386/bits/string.h
index 5a67c1b4e1..d67db630f5 100644
--- a/sysdeps/i386/bits/string.h
+++ b/sysdeps/i386/bits/string.h
@@ -30,10 +30,12 @@
 #if !defined __NO_STRING_INLINES && defined __USE_STRING_INLINES \
     && defined __GNUC__ && __GNUC__ >= 2
 
-#ifdef __cplusplus
-# define __STRING_INLINE inline
-#else
-# define __STRING_INLINE extern __inline
+#ifndef __STRING_INLINE
+# ifdef __cplusplus
+#  define __STRING_INLINE inline
+# else
+#  define __STRING_INLINE extern __inline
+# endif
 #endif
 
 
@@ -138,6 +140,7 @@ __memcpy_c (void *__dest, __const void *__src, size_t __n)
 /* Copy N bytes of SRC to DEST, guaranteeing
    correct behavior for overlapping strings.  */
 #define _HAVE_STRING_ARCH_memmove 1
+#ifndef _FORCE_INLINES
 __STRING_INLINE void *
 memmove (void *__dest, __const void *__src, size_t __n)
 {
@@ -162,7 +165,7 @@ memmove (void *__dest, __const void *__src, size_t __n)
        : "memory");
   return __dest;
 }
-
+#endif
 
 /* Set N bytes of S to C.  */
 #define _HAVE_STRING_ARCH_memset 1
@@ -268,6 +271,7 @@ __memset_gg (void *__s, char __c, size_t __n)
 
 /* Search N bytes of S for C.  */
 #define _HAVE_STRING_ARCH_memchr 1
+#ifndef _FORCE_INLINES
 __STRING_INLINE void *
 memchr (__const void *__s, int __c, size_t __n)
 {
@@ -285,10 +289,11 @@ memchr (__const void *__s, int __c, size_t __n)
      : "a" (__c), "0" (__s), "1" (__n));
   return __res - 1;
 }
-
+#endif
 
 /* Return the length of S.  */
 #define _HAVE_STRING_ARCH_strlen 1
+#ifndef _FORCE_INLINES
 __STRING_INLINE size_t
 strlen (__const char *__str)
 {
@@ -303,10 +308,11 @@ strlen (__const char *__str)
      : "cc");
   return __res - 1;
 }
-
+#endif
 
 /* Copy SRC to DEST.  */
 #define _HAVE_STRING_ARCH_strcpy 1
+#ifndef _FORCE_INLINES
 __STRING_INLINE char *
 strcpy (char *__dest, __const char *__src)
 {
@@ -323,10 +329,11 @@ strcpy (char *__dest, __const char *__src)
      : "ax", "memory", "cc");
   return __dest;
 }
-
+#endif
 
 /* Copy no more than N characters of SRC to DEST.  */
 #define _HAVE_STRING_ARCH_strncpy 1
+#ifndef _FORCE_INLINES
 __STRING_INLINE char *
 strncpy (char *__dest, __const char *__src, size_t __n)
 {
@@ -347,10 +354,11 @@ strncpy (char *__dest, __const char *__src, size_t __n)
      : "ax", "memory", "cc");
   return __dest;
 }
-
+#endif
 
 /* Append SRC onto DEST.  */
 #define _HAVE_STRING_ARCH_strcat 1
+#ifndef _FORCE_INLINES
 __STRING_INLINE char *
 strcat (char *__dest, __const char *__src)
 {
@@ -369,10 +377,11 @@ strcat (char *__dest, __const char *__src)
      : "memory", "cc");
   return __dest;
 }
-
+#endif
 
 /* Append no more than N characters from SRC onto DEST.  */
 #define _HAVE_STRING_ARCH_strncat 1
+#ifndef _FORCE_INLINES
 __STRING_INLINE char *
 strncat (char *__dest, __const char *__src, size_t __n)
 {
@@ -399,10 +408,11 @@ strncat (char *__dest, __const char *__src, size_t __n)
      : "memory", "cc");
   return __dest;
 }
-
+#endif
 
 /* Compare S1 and S2.  */
 #define _HAVE_STRING_ARCH_strcmp 1
+#ifndef _FORCE_INLINES
 __STRING_INLINE int
 strcmp (__const char *__s1, __const char *__s2)
 {
@@ -427,10 +437,11 @@ strcmp (__const char *__s1, __const char *__s2)
      : "cc");
   return __res;
 }
-
+#endif
 
 /* Compare N characters of S1 and S2.  */
 #define _HAVE_STRING_ARCH_strncmp 1
+#ifndef _FORCE_INLINES
 __STRING_INLINE int
 strncmp (__const char *__s1, __const char *__s2, size_t __n)
 {
@@ -458,7 +469,7 @@ strncmp (__const char *__s1, __const char *__s2, size_t __n)
      : "cc");
   return __res;
 }
-
+#endif
 
 /* Find the first occurrence of C in S.  */
 #define _HAVE_STRING_ARCH_strchr 1
@@ -580,7 +591,8 @@ __strchrnul_c (__const char *__s, int __c)
 /* Return the length of the initial segment of S which
    consists entirely of characters not in REJECT.  */
 #define _HAVE_STRING_ARCH_strcspn 1
-#ifdef __PIC__
+#ifndef _FORCE_INLINES
+# ifdef __PIC__
 __STRING_INLINE size_t
 strcspn (__const char *__s, __const char *__reject)
 {
@@ -609,7 +621,7 @@ strcspn (__const char *__s, __const char *__reject)
      : "cc");
   return (__res - 1) - __s;
 }
-#else
+# else
 __STRING_INLINE size_t
 strcspn (__const char *__s, __const char *__reject)
 {
@@ -636,13 +648,15 @@ strcspn (__const char *__s, __const char *__reject)
      : "cc");
   return (__res - 1) - __s;
 }
+# endif
 #endif
 
 
 /* Return the length of the initial segment of S which
    consists entirely of characters in ACCEPT.  */
 #define _HAVE_STRING_ARCH_strspn 1
-#ifdef __PIC__
+#ifndef _FORCE_INLINES
+# ifdef __PIC__
 __STRING_INLINE size_t
 strspn (__const char *__s, __const char *__accept)
 {
@@ -671,7 +685,7 @@ strspn (__const char *__s, __const char *__accept)
      : "cc");
   return (__res - 1) - __s;
 }
-#else
+# else
 __STRING_INLINE size_t
 strspn (__const char *__s, __const char *__accept)
 {
@@ -698,12 +712,14 @@ strspn (__const char *__s, __const char *__accept)
      : "cc");
   return (__res - 1) - __s;
 }
+# endif
 #endif
 
 
 /* Find the first occurrence in S of any character in ACCEPT.  */
 #define _HAVE_STRING_ARCH_strpbrk 1
-#ifdef __PIC__
+#ifndef _FORCE_INLINES
+# ifdef __PIC__
 __STRING_INLINE char *
 strpbrk (__const char *__s, __const char *__accept)
 {
@@ -736,7 +752,7 @@ strpbrk (__const char *__s, __const char *__accept)
      : "cc");
   return __res;
 }
-#else
+# else
 __STRING_INLINE char *
 strpbrk (__const char *__s, __const char *__accept)
 {
@@ -767,12 +783,14 @@ strpbrk (__const char *__s, __const char *__accept)
      : "cc");
   return __res;
 }
+# endif
 #endif
 
 
 /* Find the first occurrence of NEEDLE in HAYSTACK.  */
 #define _HAVE_STRING_ARCH_strstr 1
-#ifdef __PIC__
+#ifndef _FORCE_INLINES
+# ifdef __PIC__
 __STRING_INLINE char *
 strstr (__const char *__haystack, __const char *__needle)
 {
@@ -804,7 +822,7 @@ strstr (__const char *__haystack, __const char *__needle)
      : "cc");
   return __res;
 }
-#else
+# else
 __STRING_INLINE char *
 strstr (__const char *__haystack, __const char *__needle)
 {
@@ -834,9 +852,11 @@ strstr (__const char *__haystack, __const char *__needle)
      : "cc");
   return __res;
 }
+# endif
 #endif
 
-
-#undef __STRING_INLINE
+#ifndef _FORCE_INLINES
+# undef __STRING_INLINE
+#endif
 
 #endif	/* use string inlines && GNU CC */
diff --git a/sysdeps/i386/i486/Versions b/sysdeps/i386/i486/Versions
new file mode 100644
index 0000000000..b33fa127a4
--- /dev/null
+++ b/sysdeps/i386/i486/Versions
@@ -0,0 +1,13 @@
+libc {
+  GLIBC_2.1.1 {
+    # extern inline functions used by <bits/string.h>
+    __memcpy_by2; __memcpy_by4; __memcpy_g; __mempcpy_by2; __mempcpy_by4;
+    __mempcpy_byn; __memset_ccn_by2; __memset_ccn_by4; __memset_gcn_by2;
+    __memset_gcn_by4; __stpcpy_g; __strcat_c; __strcat_g; __strchr_c;
+    __strchr_g; __strchrnul_c; __strchrnul_g; __strcmp_gg; __strcpy_g;
+    __strcspn_c1; __strcspn_cg; __strcspn_g; __strlen_g; __strncat_g;
+    __strncmp_g; __strncpy_by2; __strncpy_by4; __strncpy_byn; __strncpy_gg;
+    __strpbrk_cg; __strpbrk_g; __strrchr_c; __strrchr_g; __strspn_c1;
+    __strspn_cg; __strspn_g; __strstr_cg; __strstr_g;
+  }
+}
diff --git a/sysdeps/i386/i486/bits/string.h b/sysdeps/i386/i486/bits/string.h
index e726a340a1..5bf80f0398 100644
--- a/sysdeps/i386/i486/bits/string.h
+++ b/sysdeps/i386/i486/bits/string.h
@@ -30,10 +30,12 @@
 #if !defined __NO_STRING_INLINES && defined __USE_STRING_INLINES \
     && defined __GNUC__ && __GNUC__ >= 2
 
-#ifdef __cplusplus
-# define __STRING_INLINE inline
-#else
-# define __STRING_INLINE extern __inline
+#ifndef __STRING_INLINE
+# ifdef __cplusplus
+#  define __STRING_INLINE inline
+# else
+#  define __STRING_INLINE extern __inline
+# endif
 #endif
 
 /* The macros are used in some of the optimized implementations below.  */
@@ -133,7 +135,8 @@ __memcpy_g (void *__dest, __const void *__src, size_t __n)
   return __dest;
 }
 
-
+#define _HAVE_STRING_ARCH_memmove 1
+#ifndef _FORCE_INLINES
 /* Copy N bytes of SRC to DEST, guaranteeing
    correct behavior for overlapping strings.  */
 __STRING_INLINE void *
@@ -159,11 +162,12 @@ memmove (void *__dest, __const void *__src, size_t __n)
        : "memory");
   return __dest;
 }
-
+#endif
 
 /* Compare N bytes of S1 and S2.  */
 #define _HAVE_STRING_ARCH_memcmp 1
-#ifndef __PIC__
+#ifndef _FORCE_INLINES
+# ifndef __PIC__
 /* gcc has problems to spill registers when using PIC.  */
 __STRING_INLINE int
 memcmp (__const void *__s1, __const void *__s2, size_t __n)
@@ -183,9 +187,9 @@ memcmp (__const void *__s1, __const void *__s2, size_t __n)
      : "cc");
   return __res;
 }
+# endif
 #endif
 
-
 /* Set N bytes of S to C.  */
 #define _HAVE_STRING_ARCH_memset 1
 #define memset(s, c, n) \
@@ -390,6 +394,7 @@ __memset_gcn_by2 (void *__s, int __c, size_t __n)
 
 /* Search N bytes of S for C.  */
 #define _HAVE_STRING_ARCH_memchr 1
+#ifndef _FORCE_INLINES
 __STRING_INLINE void *
 memchr (__const void *__s, int __c, size_t __n)
 {
@@ -421,10 +426,13 @@ memchr (__const void *__s, int __c, size_t __n)
 #endif
   return __res - 1;
 }
-
+#endif
 
 /* Return pointer to C in S.  */
 #define _HAVE_STRING_ARCH_rawmemchr 1
+__STRING_INLINE void *__rawmemchr (const void *__s, int __c); 
+ 
+#ifndef _FORCE_INLINES
 __STRING_INLINE void *
 __rawmemchr (const void *__s, int __c)
 {
@@ -438,13 +446,14 @@ __rawmemchr (const void *__s, int __c)
      : "cc");
   return __res - 1;
 }
-#ifdef __USE_GNU
+#if defined __USE_GNU && !defined _FORCE_INLINES
 __STRING_INLINE void *
 rawmemchr (const void *__s, int __c)
 {
   return __rawmemchr (__s, __c);
 }
-#endif	/* use GNU */
+# endif	/* use GNU */ 
+#endif
 
 
 /* Return the length of S.  */
@@ -1817,6 +1826,8 @@ __strstr_g (__const char *__haystack, __const char *__needle)
 # endif	/* i686 */
 #endif	/* BSD || X/Open */
 
-#undef __STRING_INLINE
+#ifndef _FORCE_INLINES
+# undef __STRING_INLINE
+#endif
 
 #endif	/* use string inlines && GNU CC */