I wrote:
> This #undef breaks library namespacing.

And by breaking the library namespacing, it caused build failures of
GNU gettext on several platforms. Reported through the CI.

On Alpine Linux and macOS 15:

./obstack.h:470:10: warning: 'obstack_free' macro redefined [-Wmacro-redefined]
  470 | # define obstack_free(OBSTACK, OBJ)                                     
      \
      |          ^
./config.h:674:9: note: previous definition is here
  674 | #define obstack_free libtextstyle_obstack_free
      |         ^
../../../libtextstyle/lib/mem-hash-map.c:81:3: error: call to undeclared 
function 'obstack_free'; ISO C99 and later do not support implicit function 
declarations [-Wimplicit-function-declaration]
   81 |   obstack_free (&htab->mem_pool, NULL);
      |   ^
./obstack.h:477:10: note: expanded from macro 'obstack_free'
  477 |          __obstack_free (__o, __obj); })
      |          ^
./obstack.h:245:25: note: expanded from macro '__obstack_free'
  245 | # define __obstack_free obstack_free
      |                         ^
1 warning and 1 error generated.
make[5]: *** [libtextstyle_la-mem-hash-map.lo] Error 1

On 32-bit Cygwin:

/usr/lib/gcc/i686-pc-cygwin/11/../../../../i686-pc-cygwin/bin/ld: 
/cygdrive/d/a/ci-check/ci-check/gettext-2025-05-06/build/libtextstyle/lib/.libs/libtextstyle.a(libtextstyle_la-obstack.o):
 in function `obstack_free':
/cygdrive/d/a/ci-check/ci-check/gettext-2025-05-06/build/libtextstyle/lib/../../../libtextstyle/lib/obstack.c:295:
 multiple definition of `obstack_free'; 
./.libs/libgettextsrc.a(libgettextlib_la-obstack.o):/cygdrive/d/a/ci-check/ci-check/gettext-2025-05-06/build/gettext-tools/gnulib-lib/../../../gettext-tools/gnulib-lib/obstack.c:295:
 first defined here
collect2: error: ld returned 1 exit status
make[5]: *** [Makefile:5313: msgmerge.exe] Error 1

On 32-bit MSVC:

textstyle.lib(libtextstyle_la-obstack.obj) : error LNK2005: _obstack_free 
already defined in gettextsrc.lib(libgettextlib_la-obstack.obj)
   Creating library msgmerge.lib and object msgmerge.exp
msgmerge.exe : fatal error LNK1169: one or more multiply defined symbols found
libtool: link: lt_outputfile="msgmerge.exe"
libtool: link:  lt_tool_outputfile="msgmerge.exe"
libtool: link:  case msgmerge.exe in *.exe|*.EXE) ;; *) 
lt_outputfile=msgmerge.exe.exe lt_tool_outputfile=msgmerge.exe.exe ;; esac
libtool: link:  if test : != "mt" && test -f "msgmerge.exe.manifest"; then mt 
-manifest "msgmerge.exe.manifest" -outputresource:"msgmerge.exe" || exit 1; rm 
-f "msgmerge.exe.manifest"; fi
make[5]: *** [Makefile:5313: msgmerge.exe] Error 2

On 64-bit MSVC:

textstyle.lib(libtextstyle_la-obstack.obj) : error LNK2005: obstack_free 
already defined in gettextsrc.lib(libgettextlib_la-obstack.obj)
   Creating library msgmerge.lib and object msgmerge.exp
msgmerge.exe : fatal error LNK1169: one or more multiply defined symbols found
libtool: link: lt_outputfile="msgmerge.exe"
libtool: link:  lt_tool_outputfile="msgmerge.exe"
libtool: link:  case msgmerge.exe in *.exe|*.EXE) ;; *) 
lt_outputfile=msgmerge.exe.exe lt_tool_outputfile=msgmerge.exe.exe ;; esac
libtool: link:  if test : != "mt" && test -f "msgmerge.exe.manifest"; then mt 
-manifest "msgmerge.exe.manifest" -outputresource:"msgmerge.exe" || exit 1; rm 
-f "msgmerge.exe.manifest"; fi
make[5]: *** [Makefile:5313: msgmerge.exe] Error 2

The fix that I committed fixes the Alpine Linux FTBFS, and probably the other
ones as well.

Bruno




Reply via email to