[patch]: cleanup more builtins 1/5-5/5

Roger Sayle roger@eyesopen.com
Sat Oct 2 22:15:00 GMT 2004


On Fri, 1 Oct 2004, Kaveh R. Ghazi wrote:
> Ok for mainline?

Parts 1 (memcmp), 4 (strcmp) and 5 (strncmp) are OK for mainline.

For parts 2 (memcpy) and 3 (memmove), I think I'd prefer that the
expand_builtin_foo functions were changed to take an "exp", instead
of your current proposal to change the fold_builtin_foo to take a
arglist.

My reason for this small change, is that I believe its a reasonable
goal to have "fold" guarantee that the type of it's result is always
the same as the type of it's argument.  For memcpy and memmove, which
return a pointer-type result, I think the current fold_builtin_foo
practice of converting the result to TREE_TYPE (exp) is slightly safer
than always converting the result to ptr_type_mode.  On some non-POSIX
platforms, the system headers may prototype these functions as "char*",
or "unsigned char*" (instead of "void*", which are considered close
enough for GCC to continue to fold/expand the builtins.

I appreciate we're not exactly consistent with these semantics at the
moment, but your patches 2/5 and 3/5 move us slightly further away
from the ideal.

I hope this sounds acceptable?

Many thanks,

Roger
--



More information about the Gcc-patches mailing list