This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] libiberty/strdup.c: Constify the argument.
> > > error: argument "s" doesn't match prototype
> >
> > What prototype? If there's a prototype, strdup.c shouldn't have
> > been
> > compiled - unless the runtime is broken?
>
> Hmm. I can't find one... The GCC with Zack's patch would say the
> same with or without const, so the error may be a bug in Zack's patch.
If you can't find strdup in your system headers, you still would be
conflicting with the builtin strdup prototype. (We have strdup as a
builtin to apply various attributes to it like `malloc', `nothrow' and
`nonnull' and it has a const argument.) That's probably where the
error message is coming from.
So I believe your const-ification patch is correct. I can't speak for
Zack's patch.
--Kaveh
--
Kaveh R. Ghazi ghazi@caip.rutgers.edu