Eric Blake wrote: > > . Although *snprintf code is compiled and linked into libm4, none of > > > these functions make it into the m4 executable -- are the files > > > obsolete? > > > I'll take a look at that. It may be that it was only used by the code > > that I deleted when chopping out the usage of ecvt from the > > implementation of the format builtin. > > Found it. The xvasprintf gnulib module provides both xvasprintf and > xvasnprintf in the same .c, pulling in the *nprintf versions even though > m4 doesn't use them.
Not exactly. m4 needs xasprintf(), which is defined in the module xvasprintf and requires the vasprintf module. The vasprintf module uses libc's asprintf() and vasprintf() functions when present - this is the case on FreeBSD - but falls back on a vasnprintf() based implementation if not. Therefore it has a dependency towards the vasnprintf module. The vasnprintf module is compiled always, because it's a module of its own. If m4 was to use the vasnprintf() function, it could do so. In theory it would be possible to avoid to compile this code, by making a distinction between explicitly requested and dependent module in gnulib-tool, and by annotating the dependencies with #if conditions. Quite a lot of complication for very little gain - since the code doesn't end up in the m4 executable, there is no point in tracking these dependencies more closely. Another option would be put a 'static' copy of the vasnprintf code into the vasprintf module, and drop the dependency. But since other modules (snprintf, vsnprintf) also depend on the vasnprintf code, we might end up with multiple copies of the large vasnprintf code on some platforms - which is less desirable than the current situation on FreeBSD. Bruno