This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] missing declaration in libiberty.h


> + #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


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