Closed msiism closed 2 years ago
Ah, tricky - I need to either understand how autotools works or drop pre C99 support. Or maybe just have our own va_copy...
Although supposedly __va_copy is provided by gcc:
https://www.gnu.org/software/libc/manual/html_node/Argument-Macros.html
So maybe something wrong with ifndef? Confusing.
There is nothing wrong with ifndef. GCC's va_copy is defined in terms of appropriate builtins in stdarg.h. What glibc manual actually means, is that this header is no longer a part of GNU C library, but instead relies on the one provided by the compiler. However, musl does provide its own stdarg.h and here va_copy is always defined regardless of chosen standard mode, and nonstandard va_copy doesn't exists. The header provided by GCC is not used.
That ifndef, by the way, is rather recent (7ee55b5c). In other places where va_list is copied (including the very same fmtprint function!), memcpy is used when assignment fails (as determined by configure script that sets NO_VA_LIST_ASSIGN). This is likely wrong too even if it works.
This is what I get when trying to
make
Es on Adélie Linux, which uses musl libc:Adélie developers told me that the error is indeed related to musl vs. glibc. The problem is with
__va_copy
, which presumably is an internal glibc macro. Replacing it with the standardva_copy
fixes the issue. (Thanks to aranea.)After fixing that,
make
still fails, but for other reasons.