> > Is it better to try to enumerate non-compliant systems at > > compile/link time, or to assume non-compliance when > > cross-compiling? Neither choice is ideal. What's more likely to > > be accepted into gnulib? > > How about assuming compliance when cross-compliance but enumerate, > when cross-compiling, the systems that fail? When not cross-compiling, > let's perform the compile-time check.
I would rather see the following: when not cross-compiling (or even when cross-compiling, but the cross-executable can be run), use a configure-time run check to decide up front whether the gnulib module should even be used. When cross-compiling, assume that the gnulib module is required (but of course, this can be overridden by presetting the appropriate cache variable to configure). At runtime, the gnulib module then performs a sanity check on first usage; if it passes, then configure was pessimistic, and all further *printf calls defer to the system (the cost is a slightly slower, slightly larger executable); if it fails, then use the gnulib implementation. That way, we can guarantee C99 semantics for all users, regardless of whether cross-compiling was unable to detect brokenness. -- Eric Blake