]> OCCT Git - occt.git/commitdiff
Foundation Classes - Update signal handling for GLIBC compatibility on Linux #458
authorPasukhin Dmitry <dpasukhi@opencascade.com>
Sun, 23 Mar 2025 18:57:11 +0000 (18:57 +0000)
committerGitHub <noreply@github.com>
Sun, 23 Mar 2025 18:57:11 +0000 (18:57 +0000)
Simply disabling the code which enables floating point exceptions
  is probably wrong, but I don't have a replacement for the
    non-posix functions fegetexcept(3) and feenableexcept(3).

src/FoundationClasses/TKernel/OSD/OSD_signal.cxx

index 45d0debe85a0440045402511c8d3a4f445b50a9a..0545d7496dca8f5e7ccd6242bae5a2e4e42ddf78 100644 (file)
@@ -769,7 +769,7 @@ typedef void (*SIG_PFV)(int);
 
   #include <signal.h>
 
-  #if !defined(__ANDROID__) && !defined(__QNX__) && !defined(__EMSCRIPTEN__)
+  #if !defined(__ANDROID__) && !defined(__QNX__) && !defined(__EMSCRIPTEN__) && defined(__GLIBC__)
     #include <sys/signal.h>
   #endif
 
@@ -994,7 +994,7 @@ static void SegvHandler(const int              theSignal,
 
 void OSD::SetFloatingSignal(Standard_Boolean theFloatingSignal)
 {
-  #if defined(__linux__)
+  #if defined(__linux__) && defined(__GLIBC__)
   feclearexcept(FE_ALL_EXCEPT);
   if (theFloatingSignal)
   {
@@ -1025,7 +1025,7 @@ void OSD::SetFloatingSignal(Standard_Boolean theFloatingSignal)
 
 Standard_Boolean OSD::ToCatchFloatingSignals()
 {
-  #if defined(__linux__)
+  #if defined(__linux__) && defined(__GLIBC__)
   return (fegetexcept() & _OSD_FPX) != 0;
   #else
   return Standard_False;