This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Disabling strstr macro
- To: libc-alpha at sources dot redhat dot com
- Subject: Disabling strstr macro
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- Date: Wed, 1 Nov 2000 12:14:21 +0000 (GMT)
Kaveh R. Ghazi <ghazi@caip.rutgers.edu> added to GCC a builtin strstr that
implements glibc's optimization of the cases where NEEDLE is constant of
length zero or one, so this patch disables that macro for current GCC.
--- string2.h Mon Oct 30 07:42:48 2000
+++ string2.h.new Wed Nov 1 12:05:52 2000
@@ -1006,8 +1006,9 @@
#endif
-/* Find the first occurrence of NEEDLE in HAYSTACK. */
-#ifndef _HAVE_STRING_ARCH_strstr
+/* Find the first occurrence of NEEDLE in HAYSTACK. GCC does this
+ optimization itself since 2000-10-31. */
+#if !defined _HAVE_STRING_ARCH_strstr && !__GNUC_PREREQ (2, 97)
# define strstr(haystack, needle) \
(__extension__ (__builtin_constant_p (needle) && __string2_1bptr_p (needle) \
? (((__const char *) (needle))[0] == '\0' \
--
Joseph S. Myers
jsm28@cam.ac.uk