public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/62161] New: more precise locations for command-line diagnostics
@ 2014-08-16 10:41 manu at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: manu at gcc dot gnu.org @ 2014-08-16 10:41 UTC (permalink / raw)
  To: gcc-bugs

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
 ^
<command-line>:0:0: note: this is the location of the previous definition

We could print instead:

<command-line>: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
        ^
<command line>: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).


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-08-16 10:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-16 10:41 [Bug c++/62161] New: more precise locations for command-line diagnostics 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).