From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30132 invoked by alias); 4 Feb 2015 17:38:59 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 30090 invoked by uid 48); 4 Feb 2015 17:38:56 -0000 From: "tromey at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/47781] warnings from custom printf format specifiers Date: Wed, 04 Feb 2015 17:38:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 4.4.5 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: tromey at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-02/txt/msg00337.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47781 --- Comment #13 from Tom Tromey --- (In reply to joseph@codesourcery.com from comment #12) > On Thu, 29 Jan 2015, tromey at gcc dot gnu.org wrote: > > > E.g., firefox has a logging printf that accepts "%hs" to print char16_t* > > strings. This extension means that printf checking can't be used here. > > Requiring a plugin to deal with this situation would also be difficult. > > However letting one write __attribute__((printf, 1, 2, "hs", char16_t*)) > > would solve this nicely. > > Do you then take this as being length modifier 'h' followed by format > specifier 's', or is it a complete specifier on its own with everything > that would otherwise be length and specifier being reparsed as an > extension if it can't be parsed as a standard format? Do the flags "-wp" > and "cR" for %s formats apply to this format? I see what you mean -- maybe "simple" isn't straightforward. I have been reconsidering the plugin approach given some new things I learned about the details of the firefox code (namely that it doesn't faithfully follow printf semantics, sigh). One additional note for this bug is that it would be nice if any such addition by a plugin worked properly with -Wmissing-format-attribute.