This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[c++] file numbering confusion
- To: gcc-bugs at gcc dot gnu dot org, neil at daikokuya dot demon dot co dot uk
- Subject: [c++] file numbering confusion
- From: Benjamin Kosnik <bkoz at redhat dot com>
- Date: Fri, 16 Mar 2001 10:38:32 -0800
Neil,
I keep dropping the ball WRT the line-numbering issue. Here's a small example:
#include <cstdio>
#include <iostream>
int test01()
{
std::ios_base::sync_with_stdio();
std::printf("1"); // stdout has 1 in in now
std::cout << "2";
std::putc('3', stdout); // std::stdout doesn't work here
std::cout << '4';
return 0;
}
int main()
{
test01();
}
Compiling this with the current compiler, and then running gdb on the
resultant execuatable gives:
std::cout << "2"; // step in on this line
(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /mnt/hd/bliss/src.gcc/libstdc++-v3/testsuite/a.out
std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*) (
__out=@0x80ebde0, __s=0x80c8dc2 "2") at include/bits/std_ostream.h:635
Line number 635 out of range; include/bits/std_ostream.h has 283 lines.
It's this last bit that's in error.
If you look at two files:
libstdc++-v3/include/bits/std_ostream.h
libstdc++-v3/inclue/bits/ostream.tcc
You'll see that the first one is 283 line long, and that it includes
#ifdef _GLIBCPP_FULLY_COMPLIANT_HEADERS
# include <bits/ostream.tcc>
#endif
at the end. This is the file that contains the definition we want,
with the correct line number of 635.
//ostream:635
// Partial specializationss
template<class _Traits>
basic_ostream<char, _Traits>&
operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
{
typedef basic_ostream<char, _Traits> __ostream_type;
typename __ostream_type::sentry __cerb(__out);
So, this appears to be a simple enough mistake to correct. Do you need
more info to track this down, and if so, what? Please let me know how
I can help.
thanks,
benjamin