Re: MinGW compilation warnings in libiberty's xstrndup.c

DJ Delorie
2017-05-20T00:38:22Z

Pedro Alves <palves@redhat.com> writes:
> Ah, yeah. AFAICS, all the declaration checks in libiberty.h are
> HAVE_DECL checks. This suggests to me that this declaration guard
> should be HAVE_DECL too [1].

Except the ones in the $funcs list, which includes strnlen. I think in
the old days, we didn't put in declarations at all... until "char *"
became a different size than "int" and we started needing them.

So some functions in libiberty are HAVE_DECL and others are still HAVE.

Ah, found it, this commit is incomplete:

https://gcc.gnu.org/ml/gcc-patches/2014-06/msg00784.html

It changes gcc's configure but nobody else's (and now we have an answer
to the three-year-old question "why don't we have a more liberal commit
policy?" ;) which breaks both libiberty and libgfortran.

> BTW, I once proposed a new libiberty.m4 file that all libiberty
> clients would source so that these checks are all centralized.

I have no philosophical problem with that type of change, but I have the
usual fear of touching anything in libiberty that's been around this
long ;-)

(this bug being a prime example of how subtle an incorrect change can be)

(and honestly, my upstream attention is elsewhere these days)