From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30671 invoked by alias); 5 Feb 2015 21:33:33 -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 30627 invoked by uid 48); 5 Feb 2015 21:33:29 -0000 From: "dmalcolm at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/64955] New: RFE: have -Wformat suggest the correct format string to use Date: Thu, 05 Feb 2015 21:33:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dmalcolm at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-02/txt/msg00515.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D64955 Bug ID: 64955 Summary: RFE: have -Wformat suggest the correct format string to use Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: dmalcolm at gcc dot gnu.org Currently, -Wformat tells me that I got something wrong but doesn't tell we what the correct format string is: $ ./xgcc --version xgcc (GCC) 5.0.0 20150204 (experimental) (etc) $ cat test.c #include void test (long long ll) { printf ("%i\n", ll); } $ ./xgcc -c -B. test.c -Wformat test.c: In function =E2=80=98test=E2=80=99: test.c:5:11: warning: format =E2=80=98%i=E2=80=99 expects argument of type = =E2=80=98int=E2=80=99, but argument 2 has type =E2=80=98long long int=E2=80=99 [-Wformat=3D] printf ("%i\n", ll); ^ It would be helpful if gcc could emit something like: test.c:5:11: note: =E2=80=98printf=E2=80=98 expects format string =E2=80=98= %lli=E2=80=99 for type =E2=80=98long long int=E2=80=99. and maybe, if it can't be handled: test.c:5:11: note: =E2=80=98printf=E2=80=98 does not have a format string f= or handling type =E2=80=98struct foo=E2=80=99. as an additional clarifying note after the warning/error (Bonus points: have GCC generate a patch to fix it ;) ) >>From gcc-bugs-return-476183-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Feb 05 21:39:15 2015 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 19868 invoked by alias); 5 Feb 2015 21:39:14 -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 Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 16081 invoked by uid 48); 5 Feb 2015 21:39:11 -0000 From: "dmalcolm at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/64955] RFE: have -Wformat suggest the correct format string to use Date: Thu, 05 Feb 2015 21:39: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: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: dmalcolm at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: bug_severity 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/msg00516.txt.bz2 Content-length: 300 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64955 David Malcolm changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement