public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/52974] New: Canonicalize include paths in diagnostics
@ 2012-04-13 13:16 redi at gcc dot gnu.org
  2012-04-13 13:17 ` [Bug c++/52974] " redi at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2012-04-13 13:16 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52974
           Summary: Canonicalize include paths in diagnostics
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: redi@gcc.gnu.org
                CC: manu@gcc.gnu.org


#include <algorithm>
void f() { std::sort(1); }

The diagnostics caused by misuse of the standard library are ridiculous:


t.cc: In function 'void f()':
t.cc:2:23: error: no matching function for call to 'sort(int)'
t.cc:2:23: note: candidates are:
In file included from
/home/redi/gcc/4.x/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0/algorithm:63:0,
                 from t.cc:1:
/home/redi/gcc/4.x/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0/bits/stl_algo.h:5420:5:
note: template<class _RAIter> void std::sort(_RAIter, _RAIter)
/home/redi/gcc/4.x/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0/bits/stl_algo.h:5420:5:
note:   template argument deduction/substitution failed:
t.cc:2:23: note:   candidate expects 2 arguments, 1 provided
In file included from
/home/redi/gcc/4.x/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0/algorithm:63:0,
                 from t.cc:1:
/home/redi/gcc/4.x/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0/bits/stl_algo.h:5456:5:
note: template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter,
_Compare)
/home/redi/gcc/4.x/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0/bits/stl_algo.h:5456:5:
note:   template argument deduction/substitution failed:
t.cc:2:23: note:   candidate expects 3 arguments, 1 provided

Users don't care that the include path is
$PREFIX/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0

The paths should be canonicalized using realpath(3) to simply
/home/redi/gcc/4.x/include/c++/4.8.0/algorithm and
/home/redi/gcc/4.x/include/c++/4.8.0/bits/stl_algo.h

This probably isn't a good idea for user headers, as the include path they use
with -I should be preserved so they recognise it, but for GCC's own C++ headers
(and possibly all system headers?) it would be a huge improvement.


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

* [Bug c++/52974] Canonicalize include paths in diagnostics
  2012-04-13 13:16 [Bug c++/52974] New: Canonicalize include paths in diagnostics redi at gcc dot gnu.org
@ 2012-04-13 13:17 ` redi at gcc dot gnu.org
  2012-04-13 13:43 ` manu at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2012-04-13 13:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-04-13 13:16:01 UTC ---
The canonicalized version of that error is a lot more readable

t.cc: In function 'void f()':
t.cc:2:23: error: no matching function for call to 'sort(int)'
t.cc:2:23: note: candidates are:
In file included from /home/redi/gcc/4.x/include/c++/4.8.0/algorithm:63:0,
                 from t.cc:1:
/home/redi/gcc/4.x/include/c++/4.8.0/bits/stl_algo.h:5420:5: note:
template<class _RAIter> void std::sort(_RAIter, _RAIter)
/home/redi/gcc/4.x/include/c++/4.8.0/bits/stl_algo.h:5420:5: note:   template
argument deduction/substitution failed:
t.cc:2:23: note:   candidate expects 2 arguments, 1 provided
In file included from /home/redi/gcc/4.x/include/c++/4.8.0/algorithm:63:0,
                 from t.cc:1:
/home/redi/gcc/4.x/include/c++/4.8.0/bits/stl_algo.h:5456:5: note:
template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter,
_Compare)
/home/redi/gcc/4.x/include/c++/4.8.0/bits/stl_algo.h:5456:5: note:   template
argument deduction/substitution failed:
t.cc:2:23: note:   candidate expects 3 arguments, 1 provided


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

* [Bug c++/52974] Canonicalize include paths in diagnostics
  2012-04-13 13:16 [Bug c++/52974] New: Canonicalize include paths in diagnostics redi at gcc dot gnu.org
  2012-04-13 13:17 ` [Bug c++/52974] " redi at gcc dot gnu.org
@ 2012-04-13 13:43 ` manu at gcc dot gnu.org
  2012-04-13 13:55 ` redi at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: manu at gcc dot gnu.org @ 2012-04-13 13:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-04-13 13:42:51 UTC ---
(In reply to comment #0)
> This probably isn't a good idea for user headers, as the include path they use
> with -I should be preserved so they recognise it, but for GCC's own C++ headers
> (and possibly all system headers?) it would be a huge improvement.

System headers are easy to detect, but what is "GCC's own C++ headers"? How can
one detect those?


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

* [Bug c++/52974] Canonicalize include paths in diagnostics
  2012-04-13 13:16 [Bug c++/52974] New: Canonicalize include paths in diagnostics redi at gcc dot gnu.org
  2012-04-13 13:17 ` [Bug c++/52974] " redi at gcc dot gnu.org
  2012-04-13 13:43 ` manu at gcc dot gnu.org
@ 2012-04-13 13:55 ` redi at gcc dot gnu.org
  2012-04-15 15:32 ` manu at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2012-04-13 13:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-04-13 13:55:27 UTC ---
I don't know where they're defined but they're built in and g++ -v shows them

#include "..." search starts here:
#include <...> search starts here:

/home/redi/gcc/4.x/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0

/home/redi/gcc/4.x/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0/x86_64-unknown-linux-gnu

/home/redi/gcc/4.x/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0/backward
 /home/redi/gcc/4.x/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/include
 /usr/local/include
 /home/redi/gcc/4.x/include
 /home/redi/gcc/4.x/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/include-fixed
 /usr/include
End of search list.

The C++ headers are the only ones that need canonicalizing.


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

* [Bug c++/52974] Canonicalize include paths in diagnostics
  2012-04-13 13:16 [Bug c++/52974] New: Canonicalize include paths in diagnostics redi at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2012-04-13 13:55 ` redi at gcc dot gnu.org
@ 2012-04-15 15:32 ` manu at gcc dot gnu.org
  2012-04-15 15:32 ` manu at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: manu at gcc dot gnu.org @ 2012-04-15 15:32 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-04-15
     Ever Confirmed|0                           |1


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

* [Bug c++/52974] Canonicalize include paths in diagnostics
  2012-04-13 13:16 [Bug c++/52974] New: Canonicalize include paths in diagnostics redi at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2012-04-15 15:32 ` manu at gcc dot gnu.org
@ 2012-04-15 15:32 ` manu at gcc dot gnu.org
  2012-04-15 18:33 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: manu at gcc dot gnu.org @ 2012-04-15 15:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-04-15 15:31:46 UTC ---
Created attachment 27160
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27160
patch

This patch implements the shortening in line-map.c. It seems more general fix
than touching the default include paths.

If it looks ok to you, I will submit it properly.


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

* [Bug c++/52974] Canonicalize include paths in diagnostics
  2012-04-13 13:16 [Bug c++/52974] New: Canonicalize include paths in diagnostics redi at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2012-04-15 15:32 ` manu at gcc dot gnu.org
@ 2012-04-15 18:33 ` redi at gcc dot gnu.org
  2012-04-30 17:02 ` manu at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2012-04-15 18:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-04-15 18:32:49 UTC ---
That was fast :)

I've only tested it lightly but it looks great, thank you very much.


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

* [Bug c++/52974] Canonicalize include paths in diagnostics
  2012-04-13 13:16 [Bug c++/52974] New: Canonicalize include paths in diagnostics redi at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2012-04-15 18:33 ` redi at gcc dot gnu.org
@ 2012-04-30 17:02 ` manu at gcc dot gnu.org
  2012-04-30 17:04 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: manu at gcc dot gnu.org @ 2012-04-30 17:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-04-30 17:01:11 UTC ---
Author: manu
Revision: 186991
Modified property: svn:log

Modified: svn:log at Mon Apr 30 17:00:59 2012
------------------------------------------------------------------------------
--- svn:log (original)
+++ svn:log Mon Apr 30 17:00:59 2012
@@ -1,6 +1,6 @@
 2012-04-30  Manuel López-Ibáñez  <manu@gcc.gnu.org>
         Dodji Seketeli  <dodji@seketeli.org>

-    PR 5297
+    PR c++/52974
     * libcpp/files.c (maybe_shorter_path): New.
     (find_file_in_dir): Use it.


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

* [Bug c++/52974] Canonicalize include paths in diagnostics
  2012-04-13 13:16 [Bug c++/52974] New: Canonicalize include paths in diagnostics redi at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2012-04-30 17:02 ` manu at gcc dot gnu.org
@ 2012-04-30 17:04 ` redi at gcc dot gnu.org
  2012-04-30 17:20 ` manu at gcc dot gnu.org
  2012-05-02 23:05 ` redi at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2012-04-30 17:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-04-30 17:03:30 UTC ---
Nice, thanks very much!


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

* [Bug c++/52974] Canonicalize include paths in diagnostics
  2012-04-13 13:16 [Bug c++/52974] New: Canonicalize include paths in diagnostics redi at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2012-04-30 17:04 ` redi at gcc dot gnu.org
@ 2012-04-30 17:20 ` manu at gcc dot gnu.org
  2012-05-02 23:05 ` redi at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: manu at gcc dot gnu.org @ 2012-04-30 17:20 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #8 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-04-30 17:20:19 UTC ---
(In reply to comment #7)
> Nice, thanks very much!

Does it also help with the debug info? I haven't tested that. 

Also, I don't think it changes the output of g++ -v.


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

* [Bug c++/52974] Canonicalize include paths in diagnostics
  2012-04-13 13:16 [Bug c++/52974] New: Canonicalize include paths in diagnostics redi at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2012-04-30 17:20 ` manu at gcc dot gnu.org
@ 2012-05-02 23:05 ` redi at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2012-05-02 23:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-05-02 23:04:55 UTC ---
(In reply to comment #8)
> Does it also help with the debug info? I haven't tested that. 

It does, great!

> Also, I don't think it changes the output of g++ -v.

It doesn't, I don't care :)

Thanks again.


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

end of thread, other threads:[~2012-05-02 23:05 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-13 13:16 [Bug c++/52974] New: Canonicalize include paths in diagnostics redi at gcc dot gnu.org
2012-04-13 13:17 ` [Bug c++/52974] " redi at gcc dot gnu.org
2012-04-13 13:43 ` manu at gcc dot gnu.org
2012-04-13 13:55 ` redi at gcc dot gnu.org
2012-04-15 15:32 ` manu at gcc dot gnu.org
2012-04-15 15:32 ` manu at gcc dot gnu.org
2012-04-15 18:33 ` redi at gcc dot gnu.org
2012-04-30 17:02 ` manu at gcc dot gnu.org
2012-04-30 17:04 ` redi at gcc dot gnu.org
2012-04-30 17:20 ` manu at gcc dot gnu.org
2012-05-02 23:05 ` redi 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).