Reuben Thomas wrote:
> With up-to-date gnulib (and I can't see any relevant changes for some
> years), I am getting the following error while using the configmake module
> and building on Mingw 64 x86_64:
>
> In file included from <command-line>:
> C:/msys64/mingw64/include/objidl.h:10677:3: error: expected identifier or
> '(' before string constant
> 10677 | } DATADIR;
> | ^~~~~~~
Many packages work around this by doing '#undef DATADIR' somewhere [1].
Thanks very much for the pointer, I was able to copy this workaround. It seems that the comment at that reference understates the case; it says:
/* This is a hack for Windows known directory support.
* DATADIR (autotools-generated constant) is a type defined in objidl.h
* so we must #undef it before including shlobj.h in order to avoid a
* name clash. */
But I only include windows.h (not shlobj.h), and that seems to be enough to trigger the problem.
For more investigation, we would need the complete include files stack,
as gcc prints it after "In file included ...".
Unfortunately, the output (plus the command, for reasons you will see) in my case is:
gcc -DHAVE_CONFIG_H -I. -I.. --include configmake.h --include config.h -I.. -isystem ../lib -isystem ../lib -IC:/msys64/mingw64/include/glib-2.0 -IC:/msys64/mingw64/lib/glib-2.0/include -fanalyzer -fstrict-flex-arrays -Wall -Warith-conversion -Wbad-function-cast -Wcast-align=strict -Wdate-time -Wdisabled-optimization -Wdouble-promotion -Wduplicated-branches -Wduplicated-cond -Wextra -Wformat-signedness -Winit-self -Winline -Winvalid-pch -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wmissing-prototypes -Wnested-externs -Wnull-dereference -Wold-style-definition -Wopenmp-simd -Woverlength-strings -Wpacked -Wpointer-arith -Wshadow -Wstack-protector -Wstrict-flex-arrays -Wstrict-overflow -Wstrict-prototypes -Wsuggest-attribute=cold -Wsuggest-attribute=const -Wsuggest-attribute=format -Wsuggest-attribute=malloc -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wsuggest-final-methods -Wsuggest-final-types -Wsync-nand -Wtrampolines -Wuninitialized -Wunknown-pragmas -Wunsafe-loop-optimizations -Wunused-macros -Wvariadic-macros -Wvector-operation-performance -Wvla -Wwrite-strings -Warray-bounds=2 -Wattribute-alias=2 -Wbidi-chars=any,ucn -Wformat-overflow=2 -Wformat=2 -Wformat-truncation=2 -Wshift-overflow=2 -Wuse-after-free=3 -Wunused-const-variable=2 -Wvla-larger-than=4031 -Wno-analyzer-malloc-leak -DG_LOG_DOMAIN='"libenchant"' -g -O2 -MT enchant.o -MD -MP -MF $depbase.Tpo -c -o enchant.o enchant.c &&\
mv -f $depbase.Tpo $depbase.Po
In file included from <command-line>:
C:/msys64/mingw64/include/objidl.h:10677:3: error: expected identifier or '(' before string constant
10677 | } DATADIR;
| ^~~~~~~