This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[libcpp] maybe canonicalize system paths in line-map


This patch tries to store the shortest form of a path to a system
file, either the original given or the canonical form returned by
realpath. User files are left untouched. This converts this:

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

into this:

canonicalize-paths.C: In function ‘void f()’:
canonicalize-paths.C:2:23: error: no matching function for call to ‘sort(int)’
canonicalize-paths.C:2:23: note: candidates are:
In file included from
/home/manuel/test2/186353M/install/include/c++/4.8.0/algorithm:63:0,
                 from canonicalize-paths.C:1:
/home/manuel/test2/186353M/install/include/c++/4.8.0/bits/stl_algo.h:5420:5:
note: template<class _RAIter> void std::sort(_RAIter, _RAIter)
/home/manuel/test2/186353M/install/include/c++/4.8.0/bits/stl_algo.h:5420:5:
note:   template argument deduction/substitution failed:
canonicalize-paths.C:2:23: note:   candidate expects 2 arguments, 1 provided
In file included from
/home/manuel/test2/186353M/install/include/c++/4.8.0/algorithm:63:0,
                 from canonicalize-paths.C:1:
/home/manuel/test2/186353M/install/include/c++/4.8.0/bits/stl_algo.h:5456:5:
note: template<class _RAIter, class _Compare> void std::sort(_RAIter,
_RAIter, _Compare)
/home/manuel/test2/186353M/install/include/c++/4.8.0/bits/stl_algo.h:5456:5:
note:   template argument deduction/substitution failed:
canonicalize-paths.C:2:23: note:   candidate expects 3 arguments, 1 provided

Bootstrapped and regtested on x86-64-unknown-linux-gnu.

OK for trunk?

2012-04-15  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR 52974
libcpp/
	* line-map.c (maybe_shorter_path): New.
	(linemap_add): Use it.

Attachment: pr52974.diff
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]