This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


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

Disabling strstr macro


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


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