This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/47781] warnings from custom printf format specifiers
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 17 Feb 2011 18:24:30 +0000
- Subject: [Bug c/47781] warnings from custom printf format specifiers
- Auto-submitted: auto-generated
- References: <bug-47781-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47781
--- Comment #4 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2011-02-17 18:24:25 UTC ---
On Thu, 17 Feb 2011, mark-gcc at glines dot org wrote:
> I'd like to request a finer grained means of control. A syntactical element
> (builtin/pragma/attribute/whatever) to pre-declare a format conversion and the
> typedef to check it against would be very nice, if complex. A much simpler
> solution would be a -Wno-format-unknown-specifier option, which skips the
> argument in the argument list and otherwise ignores conversions it doesn't
> recognize.
You can't reliably know how many arguments the unknown specifier takes,
though assuming them to take one argument would be a reasonable heuristic
for such an option.
For the general issue, my inclination is that we should add plugin hooks
into the format checking machinery that allow plugins to define formats
with the full flexibility of all the format checking datastructures in
GCC. Using GCC plugins for this avoids problems with defining complicated
syntax in the source file to describe the peculiarities of different
formats, which might constrain future changes to the format checking
implementation by making too much of the internals visible to user source
code, because by design GCC plugins can use GCC internals which are free
to change incompatibly in ways that require plugin changes.