|
|
Subscribe / Log in / New account

Enhanced printk() merged

Enhanced printk() merged

Posted Jul 17, 2008 16:41 UTC (Thu) by meuh (guest, #22042)
In reply to: Enhanced printk() merged by nix
Parent article: Enhanced printk() merged

Extending GCC to support some new kind of format string is also possible,
sadly this can't be done dynamically, patching GCC is required.

GCC already knows about other format string, see:
http://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Target-Format...
http://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Function-Attr...



to post comments

Enhanced printk() merged

Posted Jul 17, 2008 17:41 UTC (Thu) by nix (subscriber, #2304) [Link]

Yes indeed, and printk() is marked up with the printf attribute. The trick 
is to find a way to define new format characters that doesn't cause GCC to 
warn about all of them.

There were attempts in the past to make the format attributes dynamically 
redefinable, but if I recall correctly the consensus in the end was that 
this was simply too damn complicated.

(I wonder if what we need is loose versions of the format attribute's 
archetypes, which warn about incorrect numbers of parameters and type 
mismatches for format letters GCC knows about, but does not check format 
letters that GCC doesn't know? As long as nobody tries to reimplement 
something like .* which changes the number of arguments consumed, this 
should work fine.)


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds