This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

V3 PATCH: handle SIGILL in gen-num-limits.cc



Bootstrapped and tested on an i686-pc-linux.
Applied to mainline and branch.

-- Gaby

Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/ChangeLog,v
retrieving revision 1.719
diff -p -r1.719 ChangeLog
*** ChangeLog	2001/07/18 21:37:06	1.719
--- ChangeLog	2001/07/19 03:05:04
***************
*** 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: src/gen-num-limits.cc
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/src/gen-num-limits.cc,v
retrieving revision 1.11
diff -p -r1.11 gen-num-limits.cc
*** gen-num-limits.cc	2001/07/13 16:47:56	1.11
--- gen-num-limits.cc	2001/07/19 03:05:04
*************** template<typename T> 
*** 157,171 ****
  
  template<typename T> struct underflow { };
  
  // traps
  template<typename T> void traps()
  {
    fflush(NULL);
!   signal_adapter (signal, SIGFPE, signal_handler);
!   signal_adapter (signal, SIGTRAP, signal_handler);
    bool trap_flag = trapping(division_by_zero<T>());
!   signal_adapter (signal, SIGFPE, signal_handler);
!   signal_adapter (signal, SIGTRAP, signal_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);    
--- 157,179 ----
  
  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);
!   set_signals_handler();
    bool trap_flag = trapping(division_by_zero<T>());
!   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);    
*************** template<typename T> void traps()
*** 175,182 ****
  template<> void traps< T >()                                            \
  {       								\
    fflush(NULL);                                                         \
!   signal_adapter (signal, SIGFPE, signal_handler);                      \
!   signal_adapter (signal, SIGTRAP, signal_handler);                     \
    const char* p = bool_alpha[trapping(division_by_zero<T>())];          \
    printf("%s%s = %s;\n", tab2, "static const bool traps", p);           \
  }
--- 183,189 ----
  template<> void traps< T >()                                            \
  {       								\
    fflush(NULL);                                                         \
!   set_signals_handler();                                                \
    const char* p = bool_alpha[trapping(division_by_zero<T>())];          \
    printf("%s%s = %s;\n", tab2, "static const bool traps", p);           \
  }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]