[PATCH] missing declaration in libiberty.h

DJ Delorie dj@redhat.com
Tue Aug 16 14:47:00 GMT 2005


> + #if !HAVE_DECL_STPCPY
> + extern char *stpcpy (char *__dest, const char *__src);
> + #endif

This is the wrong way to use the HAVE_DECL macros.  You want the
prototype if HAVE_DECL is defined but zero.  If HAVE_DECL is
undefined, the application hasn't tested for it and we don't know if
we need it (unsafe to have one).  If it's defined and nonzero, we have
one and don't need anoter.

Your code will cause failures if the application doesn't test for a
stpcpy decl but does include a header that provides a conflicting one.

Check out the ffs() prototype for a good example.

Also, please CC gcc-patches@gcc.gnu.org for all libiberty patches.

Thanks!
DJ



More information about the Binutils mailing list