From: Gabriel Dos Reis Date: Thu, 19 Jul 2001 03:06:01 +0000 (+0000) Subject: gen-num-limits.cc (set_signals_handler): New function. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b2a4c43c0db0c7878b5e74271d9a658857454b92;p=gcc.git gen-num-limits.cc (set_signals_handler): New function. * src/gen-num-limits.cc (set_signals_handler): New function. Factor out signals setting. Set signal handler for SIGILL. Co-Authored-By: Bert De Knuydt From-SVN: r44139 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index e47ceb8c0b2..179e073ed78 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2001-07-19 Gabriel Dos Reis + Bert De Knuydt + + * src/gen-num-limits.cc (set_signals_handler): New function. + Factor out signals setting. Set signal handler for SIGILL. + 2001-07-18 Phil Edwards * docs/html/27_io/howto.html: Fix typo. 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 template 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 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()); - signal_adapter (signal, SIGFPE, signal_handler); - signal_adapter (signal, SIGTRAP, signal_handler); + set_signals_handler(); trap_flag = trap_flag || trapping(overflow()); const char* p = bool_alpha[trap_flag]; printf("%s%s = %s;\n", tab2, "static const bool traps", p); @@ -175,8 +183,7 @@ template 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())]; \ printf("%s%s = %s;\n", tab2, "static const bool traps", p); \ }