On 05/19/2017 11:31 PM, DJ Delorie wrote: > > Right, I meant, libiberty's configure, gcc's configure, binutils' > configure, and gdb's configure, all need to agree on whether strnlen is > a HAVE or a HAVE_DECL type symbol. If they don't, the header can't > provide "one" working solution. >
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]. BTW, I once proposed a new libiberty.m4 file that all libiberty clients would source so that these checks are all centralized. Here: https://gcc.gnu.org/ml/gcc-patches/2015-02/msg00580.html And follow up here: https://gcc.gnu.org/ml/gcc-patches/2015-02/msg01712.html Leading to (as, gold, ld, gdb and libiberty/ itself converted): https://github.com/palves/gdb/commits/palves/libiberty_m4 I never tried adjusting gcc, but even if it wouldn't work there, it'd still be a net win. Wonder what others think of that approach. Thanks, Pedro Alves