Summary: | -fno-rtti vs _GLIBCXX_DEBUG | ||
---|---|---|---|
Product: | gcc | Reporter: | Jay Foad <jay.foad> |
Component: | libstdc++ | Assignee: | Paolo Carlini <paolo.carlini> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | asl, gcc-bugs |
Priority: | P3 | ||
Version: | 4.3.2 | ||
Target Milestone: | 4.5.0 | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2009-05-15 19:34:10 |
Description
Jay Foad
2009-05-15 14:02:50 UTC
I get your point, indeed I implemented __GXX_RTTI and put it to good use in has_facet / use_facet. However, here, what happens to debug mode if typeid is not available? Is it still largely usable? If not, and I'm afraid is not, then probably the error is rather appropriate, we can maybe make it more clear, but it's essentially. Or you believe debug mode can be made to work also together with -fno-rtti? I'm using debug mode to catch problems like v[i] where i >= v.size(). I think it would be very nice if this worked with -fno-rtti. I don't see why RTTI should be required to make this work. But then, I have no idea why typeid is being used in debug/formatter.h in the first place. As a workaround, I am removing -fno-rtti from the command line when I build my project with libstdc++ debug mode enabled, but it is annoying to have to do this for a project that doesn't use RTTI. Ok. In fact, being typeid used in formatter.h only (please confirm, if you can), I suspect not using it (replacing &typeid with 0) would only lead to worse error message, not more than that. Are you willing to experiment a bit with that? It would imply wrapping those place where _M_type is assigned with __GXX_RTTI, and also, careful, tweaking a bit src/debug.cc to not assert _M_type != 0, instead conditionalize consistently on that, have something like "<unknown type>" in its place. Please let me know... > typeid used in formatter.h only (please confirm, if you can)
If I replace typeid(...) with 0 in formatter.h then I can at least compile the following with -fno-rtti -D_GLIBCXX_DEBUG:
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <complex.h>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <cxxabi-forced.h>
#include <cxxabi.h>
#include <deque>
#include <exception>
#include <exception_defines.h>
#include <fenv.h>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <tgmath.h>
#include <typeinfo>
#include <utility>
#include <vector>
I'm not really in a position to test changes to libstdc++.so, sorry.
Ok, thanks. I'll fix it as I said earlier today. Subject: Bug 40160 Author: paolo Date: Fri May 15 22:25:24 2009 New Revision: 147599 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147599 Log: 2009-05-15 Paolo Carlini <paolo.carlini@oracle.com> PR libstdc++/40160 * include/debug/formatter.h (_Parameter::_Parameter): Don't use typeid when __GXX_RTTI is undefined. * src/debug.cc (_Error_formatter::_Parameter::_M_print_field): Adjust for null _M_variant._M_iterator._M_type, _M_variant._M_iterator._M_seq_type, _M_variant._M_sequence._M_type. * testsuite/21_strings/basic_string/40160.cc: New. Added: trunk/libstdc++-v3/testsuite/21_strings/basic_string/40160.cc Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/debug/formatter.h trunk/libstdc++-v3/src/debug.cc Fixed. Thanks Paolo! |