On 05/20/2017 02:27 AM, DJ Delorie wrote: > > Pedro Alves <pal...@redhat.com> writes: >> That sounds to me like the root issue that should be fixed, >> so that these fallback definitions don't come into into play at all. >> I.e., why isn't HAVE_ENVIRON_DECL defined on mingw when >> setenv.o is built? Sounds like a decl check is missing >> in configure.ac. > > environ is tricky because it's typically messy on platforms, unlike a > standard C function. You can't use a generic check if the macro expands > to something that interferes with the check.
gnulib has a check, which I assume to be solid: http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=m4/environ.m4 we could import just that bit, I suppose, though every client of libiberty's environ.h would need to gain the same check. That's be quite doable with the shared libiberty.m4 idea (we'd just put the check there), but a nuisance if you have to copy the check all over the place. At this point it may be more worth it to invest in finishing the previous use-gnulib-in-gcc effort instead. Thanks, Pedro Alves