Improving C++ error messages
Kevin Atkinson
kevinatk@home.com
Sun Aug 1 21:01:00 GMT 1999
Sorry if this has come up before but does anyone plan on ever improving
C++ error messages with complicated templates. For example an error
message of:
/usr/local/gcc2.95/bin/g++ -DHAVE_CONFIG_H -I. -I. -I.. -I../ -I../util
-I../lib/inc -I../popt -g -c aspell.cc
../lib/inc/check.hh: In method `const char
region_skipper_iterator<_Rope_const_iterator<char,allocator<char>
>,_Rope_const_iterator<char,allocator<char> > >::operator *() const':
../lib/inc/check-t.hh:66: instantiated from
`region_skipper_iterator_nv<_Rope_const_iterator<char,allocator<char>
>,_Rope_const_iterator<char,allocator<char> > >::operator *() const'
../lib/inc/token-t.hh:16: instantiated from
`tok<region_skipper_iterator_nv<_Rope_const_iterator<char,allocator<char>
>,_Rope_const_iterator<char,allocator<char> > >,region_skipper_iterator_nv_end<_Rope_const_iterator<char,allocator<char> >,_Rope_const_iterator<char,allocator<char> > > >::operator ++()'
../lib/inc/token.hh:23: instantiated from
`tok<region_skipper_iterator_nv<_Rope_const_iterator<char,allocator<char>
>,_Rope_const_iterator<char,allocator<char> > >,region_skipper_iterator_nv_end<_Rope_const_iterator<char,allocator<char> >,_Rope_const_iterator<char,allocator<char> > > >::tok(const region_skipper_iterator_nv<_Rope_const_iterator<char,allocator<char> >,_Rope_const_iterator<char,allocator<char> > > &, const region_skipper_iterator_nv_end<_Rope_const_iterator<char,allocator<char> >,_Rope_const_iterator<char,allocator<char> > > &, const SC_Language &)'
../lib/inc/check-t.hh:116: instantiated from
`check<_Rope_const_iterator<char,allocator<char> >,
_Rope_const_iterator<char,allocator<char> >, AS_DoNothing>(const aspell
&, aspell_check_state<_Rope_const_iterator<char,allocator<char>
>,_Rope_const_iterator<char,allocator<char> > > &, const AS_DoNothing &)'
../lib/inc/check.hh:172: instantiated from here
../lib/inc/check.hh:53: passing `const
_Rope_const_iterator<char,allocator<char> >' as `this' argument of `char
_Rope_const_iterator<char,allocator<char> >::operator *()' discards
qualifiers
make: *** [aspell.o] Error 1
is just a little bit ridicules. I don't know what what would be the
best solution to this problem is but for god sakes something needs to be
done as wading through what all this means is a rather difficult task.
I would like to see a solution where the compile tracks keep tracks of
the typedef currently in uses that name instead of the fully expanded
one. I am not saying it would be easy but it would go a LONG way in
producing much for readable messages.
For example
_Rope_const_iterator<char,allocator<char>
should really be
crope::const_iterator
Also template parameters which are the defaults should also be
eliminated. For example:
_Rope_const_iterator<char,allocator<char>
should be
_Rope_const_iterator<char>
What do you think?
Also why does gcc only give the line number when giving an error
message. A character offset in many cases would be very useful as often
something like before '(' is not very useful when there is a parse or
syntax error as I have many '(' on one line.
I really hope someone will take me seriously. And, before you ask, I do
not have the knowledge or time to do it my self.
--
Kevin Atkinson
kevinatk@home.com
http://metalab.unc.edu/kevina/
More information about the Gcc
mailing list