From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32189 invoked by alias); 16 Aug 2014 10:41:58 -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 32155 invoked by uid 48); 16 Aug 2014 10:41:52 -0000 From: "manu at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/62161] New: more precise locations for command-line diagnostics Date: Sat, 16 Aug 2014 10:41: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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: manu 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: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-08/txt/msg01126.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62161 Bug ID: 62161 Summary: more precise locations for command-line diagnostics Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: manu at gcc dot gnu.org manuel@gcc10:~$ cc1 -D A=2 redef.c redef.c:1:0: warning: "A" redefined #define A 1 ^ :0:0: note: this is the location of the previous definition We could print instead: :1:4: note: this is the location of the previous definition -D A=2 redef.c ^ clang tries to do something similar but they print some kind of intermediate file: manuel@gcc10:~$ clang -D A=2 redef.c redef.c:1:9: warning: 'A' macro redefined #define A 1 ^ :1:9: note: previous definition is here #define A 2 ^ One way is to have some location_t bit that tells us when something is the command-line and show_locus can handle this bit to not look a file but use the command-line string as the line. Another way is that the location code that looks up the line handles this transparently (when we create the line-map file for command-line, we push the command-line string somewhere).