public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/46836] New: reporting locations for names in std namespace could be improved
@ 2010-12-07 14:58 froydnj at gcc dot gnu.org
  2010-12-07 15:31 ` [Bug c++/46836] " redi at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: froydnj at gcc dot gnu.org @ 2010-12-07 14:58 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: reporting locations for names in std namespace could
                    be improved
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: froydnj@gcc.gnu.org


As suggested in http://gcc.gnu.org/ml/gcc-patches/2010-12/msg00530.html , if we
have to issue diagnostics about names in standard headers, it would be better
if we said something like:

<algorithm>: ...std::count...

rather than:

/some/ugly/path/the/user/didn't/include: ...std::count...


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

* [Bug c++/46836] reporting locations for names in std namespace could be improved
  2010-12-07 14:58 [Bug c++/46836] New: reporting locations for names in std namespace could be improved froydnj at gcc dot gnu.org
@ 2010-12-07 15:31 ` redi at gcc dot gnu.org
  2010-12-07 15:49 ` froydnj at codesourcery dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2010-12-07 15:31 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |redi at gcc dot gnu.org

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-12-07 15:30:56 UTC ---
yes yes yes!

It's not entirely trivial, because e.g. std::tuple_size is declared in more
than one place, and we have internal helpers which might be in namespace std
but probably don't want to be reported as being part of any standard header,
but I'd love to see this.

If there's anything we can add to the libstdc++ headers to help this please let
us know, I'd be happy to work on that.


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

* [Bug c++/46836] reporting locations for names in std namespace could be improved
  2010-12-07 14:58 [Bug c++/46836] New: reporting locations for names in std namespace could be improved froydnj at gcc dot gnu.org
  2010-12-07 15:31 ` [Bug c++/46836] " redi at gcc dot gnu.org
@ 2010-12-07 15:49 ` froydnj at codesourcery dot com
  2010-12-07 16:49 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: froydnj at codesourcery dot com @ 2010-12-07 15:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from froydnj at codesourcery dot com <froydnj at codesourcery dot com> 2010-12-07 15:49:15 UTC ---
On Tue, Dec 07, 2010 at 03:31:22PM +0000, redi at gcc dot gnu.org wrote:
> It's not entirely trivial, because e.g. std::tuple_size is declared in more
> than one place, and we have internal helpers which might be in namespace std
> but probably don't want to be reported as being part of any standard header,
> but I'd love to see this.

Wow, what entirely trivial implementation are you thinking of? :)  I
guess you could augment the compiler to maintain an identifier->header
mapping, but I was thinking about doing it entirely on-the-fly, which
already strikes me as non-trivial.  (Identifiers declared in more that
one place and/or not in their intended header, etc.)

> If there's anything we can add to the libstdc++ headers to help this please let
> us know, I'd be happy to work on that.

I'll do that, though I'm not planning on working on this right now.  The
only thing that comes to mind is something like:

#pragma GCC canonical_header [header-name] [identifier]

but that's just one idea from two minutes of thinking about it.


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

* [Bug c++/46836] reporting locations for names in std namespace could be improved
  2010-12-07 14:58 [Bug c++/46836] New: reporting locations for names in std namespace could be improved froydnj at gcc dot gnu.org
  2010-12-07 15:31 ` [Bug c++/46836] " redi at gcc dot gnu.org
  2010-12-07 15:49 ` froydnj at codesourcery dot com
@ 2010-12-07 16:49 ` redi at gcc dot gnu.org
  2012-05-29 12:06 ` paolo.carlini at oracle dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2010-12-07 16:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-12-07 16:48:56 UTC ---
(In reply to comment #2)
> On Tue, Dec 07, 2010 at 03:31:22PM +0000, redi at gcc dot gnu.org wrote:
> > It's not entirely trivial, because e.g. std::tuple_size is declared in more
> > than one place, and we have internal helpers which might be in namespace std
> > but probably don't want to be reported as being part of any standard header,
> > but I'd love to see this.
> 
> Wow, what entirely trivial implementation are you thinking of? :)

My first thought was just fudging it with
#line 1 "<algorithm>"

But it would be nice to do better than that!


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

* [Bug c++/46836] reporting locations for names in std namespace could be improved
  2010-12-07 14:58 [Bug c++/46836] New: reporting locations for names in std namespace could be improved froydnj at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2010-12-07 16:49 ` redi at gcc dot gnu.org
@ 2012-05-29 12:06 ` paolo.carlini at oracle dot com
  2012-05-29 12:14 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-05-29 12:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-05-29 12:02:58 UTC ---
Jon, is this a duplicate? A couple of weeks ago I saw a patch related to this
issue but I don't see it mentioned here?!?


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

* [Bug c++/46836] reporting locations for names in std namespace could be improved
  2010-12-07 14:58 [Bug c++/46836] New: reporting locations for names in std namespace could be improved froydnj at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2012-05-29 12:06 ` paolo.carlini at oracle dot com
@ 2012-05-29 12:14 ` redi at gcc dot gnu.org
  2012-05-29 12:47 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2012-05-29 12:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-05-29 12:08:24 UTC ---
For PR 52974 Manu made a huge improvement, so that we only get
/some/ugly/path/the/user/didn't/include instead of
/some/ugly/path/the/user/can't/even/parse/../../../didn't/include, but this PR
suggests printing the name of a standard header instead of a physical path.

This would make it harder to go and look at the relevant code, so there should
be an option to display the physical path, but most users don't need to look in
standard headers and can't read the uglified code anyway


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

* [Bug c++/46836] reporting locations for names in std namespace could be improved
  2010-12-07 14:58 [Bug c++/46836] New: reporting locations for names in std namespace could be improved froydnj at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2012-05-29 12:14 ` redi at gcc dot gnu.org
@ 2012-05-29 12:47 ` redi at gcc dot gnu.org
  2012-05-29 13:51 ` manu at gcc dot gnu.org
  2012-05-30  7:49 ` dodji at seketeli dot org
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2012-05-29 12:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-05-29 12:14:18 UTC ---
(In reply to comment #2)
> #pragma GCC canonical_header [header-name] [identifier]

I don't think we even need to do it per-identifier.

If each standard header started with:

#pragma GCC canonical_header push [header-name]

and ended with:

#pragma GCC canonical_header pop

then we'd always know which header we're "in" when an error occurs, even for
nested headers (e.g. <fstream> includes <ios>) and helper files that are
included from many places (e.g. bits/stl_tree.h gets included by both <map> and
<set>)


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

* [Bug c++/46836] reporting locations for names in std namespace could be improved
  2010-12-07 14:58 [Bug c++/46836] New: reporting locations for names in std namespace could be improved froydnj at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2012-05-29 12:47 ` redi at gcc dot gnu.org
@ 2012-05-29 13:51 ` manu at gcc dot gnu.org
  2012-05-30  7:49 ` dodji at seketeli dot org
  7 siblings, 0 replies; 9+ messages in thread
From: manu at gcc dot gnu.org @ 2012-05-29 13:51 UTC (permalink / raw)
  To: gcc-bugs

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org

--- Comment #7 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-05-29 13:50:17 UTC ---
(In reply to comment #6)
> (In reply to comment #2)
> > #pragma GCC canonical_header [header-name] [identifier]
> 
> I don't think we even need to do it per-identifier.
> 
> If each standard header started with:
> 
> #pragma GCC canonical_header push [header-name]
> 
> and ended with:
> 
> #pragma GCC canonical_header pop
> 
> then we'd always know which header we're "in" when an error occurs, even for
> nested headers (e.g. <fstream> includes <ios>) and helper files that are
> included from many places (e.g. bits/stl_tree.h gets included by both <map> and
> <set>)

Well, we already have pragma system_header, we could extend it with an optional
parameter.

#pragma GCC system_header "canonical_name"

and when the pragma is read, save "canonical_name". Then when printing the name
of a file, we could check that it is a system-header and there is a saved
canonical_name. System-headerness is reset when leaving a file (but I think not
when including something from a system header), so you don't need explicit
push/pop.


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

* [Bug c++/46836] reporting locations for names in std namespace could be improved
  2010-12-07 14:58 [Bug c++/46836] New: reporting locations for names in std namespace could be improved froydnj at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2012-05-29 13:51 ` manu at gcc dot gnu.org
@ 2012-05-30  7:49 ` dodji at seketeli dot org
  7 siblings, 0 replies; 9+ messages in thread
From: dodji at seketeli dot org @ 2012-05-30  7:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from dodji at seketeli dot org <dodji at seketeli dot org> 2012-05-30 07:34:17 UTC ---
"manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> a écrit:

> Well, we already have pragma system_header, we could extend it with an optional
> parameter.
>
> #pragma GCC system_header "canonical_name"

Seconded.


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

end of thread, other threads:[~2012-05-30  7:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-07 14:58 [Bug c++/46836] New: reporting locations for names in std namespace could be improved froydnj at gcc dot gnu.org
2010-12-07 15:31 ` [Bug c++/46836] " redi at gcc dot gnu.org
2010-12-07 15:49 ` froydnj at codesourcery dot com
2010-12-07 16:49 ` redi at gcc dot gnu.org
2012-05-29 12:06 ` paolo.carlini at oracle dot com
2012-05-29 12:14 ` redi at gcc dot gnu.org
2012-05-29 12:47 ` redi at gcc dot gnu.org
2012-05-29 13:51 ` manu at gcc dot gnu.org
2012-05-30  7:49 ` dodji at seketeli dot 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).