gen-num-limits.cc (set_signals_handler): New function.
authorGabriel Dos Reis <gdr@merlin.codesourcery.com>
Thu, 19 Jul 2001 03:06:01 +0000 (03:06 +0000)
committerGabriel Dos Reis <gdr@gcc.gnu.org>
Thu, 19 Jul 2001 03:06:01 +0000 (03:06 +0000)
        * 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 <Bert.Deknuydt@esat.kuleuven.ac.be>
From-SVN: r44139

libstdc++-v3/ChangeLog
libstdc++-v3/src/gen-num-limits.cc

index e47ceb8c0b2120b244924e10d244cab0e0e7369e..179e073ed78e19242ac826eaa40946d9bceadbb8 100644 (file)
@@ -1,3 +1,9 @@
+2001-07-19  Gabriel Dos Reis  <gdr@merlin.codesourcery.com>
+           Bert De Knuydt <Bert.Deknuydt@esat.kuleuven.ac.be>
+
+       * src/gen-num-limits.cc (set_signals_handler): New function.
+       Factor out signals setting.  Set signal handler for SIGILL.
+
 2001-07-18  Phil Edwards  <pme@sources.redhat.com>
 
        * docs/html/27_io/howto.html:  Fix typo.
index 1ea01bd2ebc464d0e04e34b8b282479aae062ec9..e52f67dc43589919602f2f6a4ac90401182a9857 100644 (file)
@@ -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);           \
 }