cloudius-systems / osv

OSv, a new operating system for the cloud.
osv.io
Other
4.08k stars 602 forks source link

missing register_printf_* functions #765

Open nyh opened 8 years ago

nyh commented 8 years ago

In 2009, new hooks were added in glibc to configure printf to support printing of additional types: register_printf_type(), register_printf_modifier() and register_printf_specifier(). See rationale in Ulrich Drepper's blog post.

These non-standard hooks are not commonly used in applications, but one place that does use them is the libquadmath library libquadmath library for quadruple-precision (128-bit) floating point - see the use here.

Full support for these hooks would require rewriting printf, which we would like to avoid (our printf implementation comes directly from Musl). For some applications which don't actually print out 128-bit numbers with printf, it might be "good enough" to have stub do-nothing implementations of these functions.

It appears that gcc has yet another hook, printf_register_function(), described here.

nyh commented 8 years ago

By the way, /usr/include/printf.h describes printf_register_function() as an "Obsolete interface similar to register_printf_specifier. It can only handle basic data types because the ARGINFO callback does not return information on the size of the user-defined type."