This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

Re: Patch for more removal of old string functions


On Thu, 9 Nov 2000, Kaveh R. Ghazi wrote:

> 1.  I noticed that mips-tfile.c defines local_index/local_rindex, you
> can probably nuke these and switch to strchr/strrchr.
>
> 2.  index still appears in config/winnt/spawnv.c.  Strangely, it looks
> like it simply defines it unconditionally to strchr and then calls
> index.

Could the relevant target maintainers please look at these?  They didn't
seem relevant to the configure support for whether the old functions
existed so could be left for after the configure support was removed.

There are still many casts (of arguments and return values) associated
with uses of the string functions.  I suspect the use of them is somewhat
inconsistent, and many excess casts could go away.

One thing that would be useful is if people looked at bcopy calls in parts
of the compiler they're familiar with, and worked out whether they should
change to memcpy or memmove (in either case, reordering the source and
destination arguments when changing from bcopy to mem*) - since these need
individual attention to work out whether the arguments may alias, but in
most cases they can't and the call can become memcpy, a minor
optimization.

> 3.  You may want to put something like the following at the end of
> system.h to ensure these functions don't creep back in.  Some
> platform's system headers define b->mem or mem->b style so that's the
> reason for putting it after all includes in system.h and wrapping it
> with ifndef.
>
>  > #if GCC_VERSION >= 20?? && !defined(bzero) && !defined(memset)
>  > #pragma GCC poison bzero
>  > #endif

Might there be any systems which define other macros (than the direct
equivalents) to use the b* functions?

-- 
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]