Building a testdir of all of Gnulib on Solaris 10 with Oracle Studio 12.6
and no optimization
  CC="cc -D_STDC_C99= -O"; CXX="CC -O"; export CC CXX
I see a link error:

cc -Wno-error -Wno-error -g   -o test-xstring-desc test-xstring-desc.o 
libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a libtests.a   -lm -lm 
-lm -lm -lm -lm -lm -lm -lm -lm -lm
Undefined                       first referenced
 symbol                             in file
xsd_c                               test-xstring-desc.o
ld: fatal: symbol referencing errors. No output written to test-xstring-desc
gmake[4]: *** [Makefile:27827: test-xstring-desc] Error 2

The reason is that xsd_c is defined as an inline function in
xstring-desc.h, but not defined by xstring-desc.o nor by string-desc.o.

This patch fixes it.


2026-05-10  Bruno Haible  <[email protected]>

        xstring-desc: Fix link error with non-optimizing compilers.
        * lib/xstring-desc.h (xsd_c): Define with GL_XSTRING_DESC_INLINE.

diff --git a/lib/xstring-desc.h b/lib/xstring-desc.h
index 9e46b7994b..1ef2bbf1d8 100644
--- a/lib/xstring-desc.h
+++ b/lib/xstring-desc.h
@@ -117,7 +117,7 @@ _xsd_c (idx_t s_nbytes, const char *s_data)
      _xsd_c (_xs_._nbytes, _xs_._data); \
    })
 #else
-GL_STRING_DESC_INLINE
+GL_XSTRING_DESC_INLINE
 _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_RETURNS_NONNULL
 char *
 xsd_c (string_desc_t s)




Reply via email to