summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/src
diff options
context:
space:
mode:
authorgdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4>2001-07-19 03:06:01 +0000
committergdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4>2001-07-19 03:06:01 +0000
commit6e4345025139e1c68b75c7b450b46777de233a7c (patch)
tree0676b7ed67fef27a6f5966b14ddec759b2455c53 /libstdc++-v3/src
parentb92e80dba9bfe0f8c56380bff5fe386f04d5182e (diff)
downloadppe42-gcc-6e4345025139e1c68b75c7b450b46777de233a7c.tar.gz
ppe42-gcc-6e4345025139e1c68b75c7b450b46777de233a7c.zip
* src/gen-num-limits.cc (set_signals_handler): New function.
Factor out signals setting. Set signal handler for SIGILL. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44139 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/src')
-rw-r--r--libstdc++-v3/src/gen-num-limits.cc19
1 files changed, 13 insertions, 6 deletions
diff --git a/libstdc++-v3/src/gen-num-limits.cc b/libstdc++-v3/src/gen-num-limits.cc
index 1ea01bd2ebc..e52f67dc435 100644
--- a/libstdc++-v3/src/gen-num-limits.cc
+++ b/libstdc++-v3/src/gen-num-limits.cc
@@ -157,15 +157,23 @@ template<typename T>
template<typename T> struct underflow { };
+
+// Set various signals handler for trapping aritmetic ops.
+void set_signals_handler()
+{
+ signal_adapter(signal, SIGFPE, signal_handler);
+ signal_adapter(signal, SIGTRAP, signal_handler);
+ // This is necessary for Linux/SPARC.
+ signal_adapter(signal, SIGILL, signal_handler);
+}
+
// traps
template<typename T> void traps()
{
fflush(NULL);
- signal_adapter (signal, SIGFPE, signal_handler);
- signal_adapter (signal, SIGTRAP, signal_handler);
+ set_signals_handler();
bool trap_flag = trapping(division_by_zero<T>());
- signal_adapter (signal, SIGFPE, signal_handler);
- signal_adapter (signal, SIGTRAP, signal_handler);
+ set_signals_handler();
trap_flag = trap_flag || trapping(overflow<T>());
const char* p = bool_alpha[trap_flag];
printf("%s%s = %s;\n", tab2, "static const bool traps", p);
@@ -175,8 +183,7 @@ template<typename T> void traps()
template<> void traps< T >() \
{ \
fflush(NULL); \
- signal_adapter (signal, SIGFPE, signal_handler); \
- signal_adapter (signal, SIGTRAP, signal_handler); \
+ set_signals_handler(); \
const char* p = bool_alpha[trapping(division_by_zero<T>())]; \
printf("%s%s = %s;\n", tab2, "static const bool traps", p); \
}
OpenPOWER on IntegriCloud