PATCH Replace index() with strchr() in read-rtl.c
Zack Weinberg
zack@codesourcery.com
Mon Sep 13 20:32:00 GMT 2004
"Kaveh R. Ghazi" <ghazi@caip.rutgers.edu> writes:
> > Now that we can count on C90 macro semantics, I wonder if
> >
> > #undef index
> > #define index(a,b,c) use_strchr_not_index(a,b,c)
> > #undef rindex
> > #define rindex(a,b,c) use_strrchr_not_rindex(a,b,c)
> >
> > at the end of system.h might be appropriate. (The only risk I see is
> > from system headers using index() behind our backs.)
> > zw
>
> Like so?
>
> No need for a rindex macro, we already poison it.
>
> Bootstrapped on sparc-sun-solaris2.7. It correctly detects occurances
> of index() in read-rtl.c. (If approved obviously I won't install it
> without the necessary fix to read-rtl.c.)
That's certainly what I had in mind. I'm still worried about system
header uses of index (e.g. maybe somebody decided to #define strchr
index ...)
zw
More information about the Gcc-patches
mailing list