This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[v3, 3.4] Minimal fixes for -fno-exceptions
- From: Paolo Carlini <pcarlini at suse dot de>
- To: "'gcc-patches at gcc dot gnu dot org'" <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 23 Dec 2004 23:00:39 +0100
- Subject: [v3, 3.4] Minimal fixes for -fno-exceptions
Hi,
minimal fixes (see http://gcc.gnu.org/ml/libstdc++/2004-12/msg00010.html).
Something similar will be necessary for mainline too + a fix for
libsup++/guard.cc (which uses abort() without includind <cstdlib>)
Tested x86-linux.
Paolo.
/////////////////
2004-12-23 Paolo Carlini <pcarlini@suse.de>
Minimal fixes for -fno-exceptions.
* testsuite/testsuite_abi.cc (get_symbol, examine_symbol,
create_symbols): Use __throw_exception_again, instead of
plain throw.
* testsuite/testsuite_hooks.cc (verify_demangle,
run_tests_wrapped_locale, run_tests_wrapped_env): Likewise.
(try_named_locale): Wrap the whole catch in __EXCEPTIONS.
diff -urN libstdc++-v3-orig/testsuite/testsuite_abi.cc libstdc++-v3/testsuite/testsuite_abi.cc
--- libstdc++-v3-orig/testsuite/testsuite_abi.cc 2004-10-05 21:20:39.000000000 +0200
+++ libstdc++-v3/testsuite/testsuite_abi.cc 2004-12-23 22:23:33.000000000 +0100
@@ -262,7 +262,7 @@
{
ostringstream os;
os << "get_symbol failed for symbol " << mangled;
- throw symbol_error(os.str());
+ __throw_exception_again symbol_error(os.str());
}
}
@@ -276,7 +276,7 @@
sym.print();
}
catch(...)
- { throw; }
+ { __throw_exception_again; }
}
void
@@ -419,7 +419,7 @@
{
ostringstream os;
os << "create_symbols failed for file " << file;
- throw runtime_error(os.str());
+ __throw_exception_again runtime_error(os.str());
}
return s;
}
diff -urN libstdc++-v3-orig/testsuite/testsuite_hooks.cc libstdc++-v3/testsuite/testsuite_hooks.cc
--- libstdc++-v3-orig/testsuite/testsuite_hooks.cc 2004-05-15 23:17:59.000000000 +0200
+++ libstdc++-v3/testsuite/testsuite_hooks.cc 2004-12-23 22:28:46.000000000 +0100
@@ -137,7 +137,7 @@
std::string w(wanted);
if (w != s)
- throw std::runtime_error(s);
+ __throw_exception_again std::runtime_error(std::string(s));
}
@@ -184,7 +184,8 @@
VERIFY( preLC_ALL == postLC_ALL );
}
else
- throw environment_variable(string("LC_ALL for ") + string(name));
+ __throw_exception_again
+ environment_variable(string("LC_ALL for ") + string(name));
}
void
@@ -209,7 +210,8 @@
setenv(env, oldENV ? oldENV : "", 1);
}
else
- throw environment_variable(string(env) + string(" to ") + string(name));
+ __throw_exception_again
+ environment_variable(string(env) + string(" to ") + string(name));
#endif
}
@@ -220,6 +222,7 @@
{
return std::locale(name);
}
+#ifdef __EXCEPTIONS
catch (std::runtime_error& ex)
{
// Thrown by generic and gnu implemenation if named locale fails.
@@ -228,6 +231,7 @@
else
throw;
}
+#endif
}
int