(I accidentally sent this from the wrong email address. Please respond to my
google.com address, not
gmail.com)
Thanks for your responses!
The patch above does not fix the issue because apparently REPLACE_LOCALTIME_R is defined as GNULIB_PORTCHECK which is not defined. Replacing that with #if 1 does fix it.
gdb does not define GNULIB_NAMESPACE.
713 S["GNULIB_TIME_R"]="1"
707 S["REPLACE_LOCALTIME_R"]="GNULIB_PORTCHECK"
711 S["HAVE_DECL_LOCALTIME_R"]="0"
It includes gnulib's config.h as the second file after gdb's config.h.
Here is the testcase:
#include "build-gnulib-gdbserver/config.h"
#include "pathmax.h"
#include "time.h"
x86_64-w64-mingw32-g++ test.cc -I build-gnulib-gdbserver/import/ -I ~/binutils-gdb/gnulib/import/
It turns out that the pathmax.h include is required for this to fail. Alternatively, including just unistd.h before time.h will fail. Error:
The enabled gnulib modules are:
IMPORTED_GNULIB_MODULES="\
alloca \
canonicalize-lgpl \
dirent \
dirfd \
errno \
fnmatch-gnu \
frexpl \
getcwd \
glob \
inet_ntop
inttypes \
lstat \
limits-h \
memchr \
memmem \
mkdir \
mkdtemp \
mkostemp \
pathmax \
rawmemchr \
readlink \
rename \
setenv \
signal-h \
strchrnul \
strerror_r-posix \
strstr \
strtok_r \
sys_stat \
time_r \
unistd \
unsetenv \
update-copyright \
wchar \
wctype-h \
"
Christian