https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47781

Luke Shumaker <lukeshu at lukeshu dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lukeshu at lukeshu dot com

--- Comment #31 from Luke Shumaker <lukeshu at lukeshu dot com> ---
Prior art for consideration: Plan 9

Similar to GNU libc's register_printf_specifier() and
register_printf_modifier(), Plan 9 libc has fmtinstall() which can add new
specifiers and modifiers; and to support checking these strings, the compiler
supports `#pragma varargck`:

    fmtinstall('C', CONVFUNC)        /* since 1e (1992); if CONVFUNC returns 0
then 'C' is a specifier, if it returns 1 it's a modifier */
    #pragma varargck argpos FUNC POS /* since 3e (2000); equivalent to putting
`[[gnu::format(printf, POS, POS+1)]]` on FUNC
    #pragma varargck flag 'C'        /* since 3e (2000); says that 'C' is a
modifier, consumes 0 arguments */
    #pragma varargck type "C" TYPE   /* since 4e (2002); says that 'C' is a
specifier, consumes 1 argument of type TYPE */

fmtinstall()ed modifiers and specifiers can consume any number of arguments,
but `#pragma varargck` only supports indicating that they consume 0 and 1
arguments respectively.  Note that Plan 9 printf does not support POSIX-style
position-specifiers; arguments may only be consumed in order.

https://man.cat-v.org/plan_9/1/8c (8c is the x86 compiler)
https://man.cat-v.org/plan_9/2/fmtinstall

Reply via email to