When I build GDB with DJGPP, GCC whines like so:
remote.c: In function `remote_xfer_partial':
remote.c:4920: warning: implicit declaration of function `snprintf'
(I see this warning for other source files as well.)
This happens because DJGPP doesn't have `snprintf' in its library, so
the libiberty version is used. But there's no prototype for the
libiberty `snprintf' anywhere, thus the warning. The code seems to be
relying on getting the prototype from stdio.h, but if the library
doesn't have the function, we cannot expect to have the prototype on a
standard header.
What would be the canonical way to fix that?
#if !HAVE_DECL_ASPRINTF
/* Like sprintf but provides a pointer to malloc'd storage, which must
be freed by the caller. */
extern int asprintf PARAMS ((char **, const char *, ...)) ATTRIBUTE_PRINTF_2;
#endif