public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/47781] New: warnings from custom printf format specifiers
@ 2011-02-17 11:55 mark-gcc at glines dot org
  2011-02-17 11:58 ` [Bug c/47781] " manu at gcc dot gnu.org
                   ` (21 more replies)
  0 siblings, 22 replies; 23+ messages in thread
From: mark-gcc at glines dot org @ 2011-02-17 11:55 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: warnings from custom printf format specifiers
           Product: gcc
           Version: 4.4.5
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: mark-gcc@glines.org


Glibc allows a project to define custom printf conversions, via one of two
APIs: register_printf_function, and more recently, register_printf_specifier. 
For instance, my project has a custom %v conversion, which takes a pointer to a
vector structure that is heavily used within the project, and pretty-prints it.

The problem is, every time the custom format conversion is used, gcc (which is
invoked with -Wall) generates warnings.

test.c:198: warning: unknown conversion type character ‘v’ in format
test.c:198: warning: too many arguments for format

I can get rid of the warnings with -Wno-format, but that also disables the rest
of gcc's format string checking (which is very helpful!).

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.

Any solution along those lines would be very helpful.


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2023-01-18 17:46 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-17 11:55 [Bug c/47781] New: warnings from custom printf format specifiers mark-gcc at glines dot org
2011-02-17 11:58 ` [Bug c/47781] " manu at gcc dot gnu.org
2011-02-17 12:00 ` mark-gcc at glines dot org
2011-02-17 12:14 ` mark-gcc at glines dot org
2011-02-17 18:38 ` joseph at codesourcery dot com
2013-09-23 21:54 ` pinskia at gcc dot gnu.org
2013-09-23 21:55 ` pinskia at gcc dot gnu.org
2013-09-23 21:57 ` pinskia at gcc dot gnu.org
2014-08-21 17:07 ` joseph at codesourcery dot com
2014-08-21 17:54 ` philipp_subx@redfish-solutions.com
2015-01-29 16:42 ` tromey at gcc dot gnu.org
2015-01-29 21:55 ` joseph at codesourcery dot com
2015-02-04 17:38 ` tromey at gcc dot gnu.org
2015-02-04 18:44 ` manu at gcc dot gnu.org
2015-09-21 19:16 ` egall at gwmail dot gwu.edu
2020-12-13 15:48 ` dcrocker at eschertech dot com
2020-12-14 14:10 ` tromey at gcc dot gnu.org
2021-12-06 17:47 ` grant.b.edwards at gmail dot com
2021-12-06 22:48 ` joseph at codesourcery dot com
2023-01-18 11:03 ` jan@swi-prolog.org
2023-01-18 12:11 ` manu at gcc dot gnu.org
2023-01-18 17:40 ` joseph at codesourcery dot com
2023-01-18 17:46 ` manu at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).