This is the mail archive of the libc-hacker@sourceware.org mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] string inlines on s390-{32,64}


Hi,
one of the reasons why the current CVS doesn't compile on s390-{32,64}
is because of conflicting definitions for strlen, strcpy, strncpy, strcat
and strncat e.g. for compiling debug/warning-nop.c. On x86 this doesn't
seem to happen because the five function are defined as macros. The
easiest way to fix this on s390 is to define these five functions as
macros as well.

--
blue skies,
  Martin.

"Reality continues to ruin my life." - Calvin.
---

2007-11-22  Martin Schwidefsky  <schwidefsky@de.ibm.com>

	* sysdeps/s390/bits/string.h (strlen, strcpy, strncpy, strcat,
	strncat): Define as macros to avoid compile errors.

diff -urpN libc/sysdeps/s390/bits/string.h libc-s390/sysdeps/s390/bits/string.h
--- libc/sysdeps/s390/bits/string.h	2007-09-19 13:55:13.000000000 +0200
+++ libc-s390/sysdeps/s390/bits/string.h	2007-11-22 13:32:32.000000000 +0100
@@ -40,8 +40,10 @@
 
 #define _HAVE_STRING_ARCH_strlen 1
 #ifndef _FORCE_INLINES
+#define strlen(str) __strlen_g ((str))
+
 __STRING_INLINE size_t
-strlen (__const char *__str)
+__strlen_g (__const char *__str)
 {
     char *__ptr, *__tmp;
 
@@ -59,8 +61,10 @@ strlen (__const char *__str)
 /* Copy SRC to DEST.  */
 #define _HAVE_STRING_ARCH_strcpy 1
 #ifndef _FORCE_INLINES
+#define strcpy(dest, src) __strcpy_g ((dest), (src))
+
 __STRING_INLINE char *
-strcpy (char *__dest, __const char *__src)
+__strcpy_g (char *__dest, __const char *__src)
 {
     char *tmp = __dest;
 
@@ -75,8 +79,10 @@ strcpy (char *__dest, __const char *__sr
 
 #define _HAVE_STRING_ARCH_strncpy 1
 #ifndef _FORCE_INLINES
+#define strncpy(dest, src, n) __strncpy_g ((dest), (src), (n))
+
 __STRING_INLINE char *
-strncpy (char *__dest, __const char *__src, size_t __n)
+__strncpy_g (char *__dest, __const char *__src, size_t __n)
 {
     char *__ret = __dest;
     char *__ptr;
@@ -114,8 +120,10 @@ strncpy (char *__dest, __const char *__s
 /* Append SRC onto DEST.  */
 #define _HAVE_STRING_ARCH_strcat 1
 #ifndef _FORCE_INLINES
+#define strcat(dest, src) __strcat_g ((dest), (src))
+
 __STRING_INLINE char *
-strcat(char *__dest, const char *__src)
+__strcat_g(char *__dest, const char *__src)
 {
     char *__ret = __dest;
     char *__ptr, *__tmp;
@@ -142,8 +150,10 @@ strcat(char *__dest, const char *__src)
 /* Append no more than N characters from SRC onto DEST.  */
 #define _HAVE_STRING_ARCH_strncat 1
 #ifndef _FORCE_INLINES
+#define strncat(dest, src, n) __strncat_g ((dest), (src), (n))
+
 __STRING_INLINE char *
-strncat (char *__dest, __const char *__src, size_t __n)
+__strncat_g (char *__dest, __const char *__src, size_t __n)
 {
     char *__ret = __dest;
     char *__ptr, *__tmp;



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]