@@ -17,6 +17,8 @@ limitations under the License.
1717#ifndef YR_EXCEPTION_H
1818#define YR_EXCEPTION_H
1919
20+ #include <assert.h>
21+
2022#if _WIN32
2123
2224#include <windows.h>
@@ -38,8 +40,8 @@ static LONG CALLBACK exception_handler(
3840 case EXCEPTION_ACCESS_VIOLATION :
3941 if (tidx != -1 && exc_jmp_buf [tidx ] != NULL )
4042 longjmp (* exc_jmp_buf [tidx ], 1 );
41- else
42- abort ();
43+
44+ assert (FALSE); // We should not reach this point.
4345 }
4446
4547 return EXCEPTION_CONTINUE_SEARCH ;
@@ -50,8 +52,7 @@ static LONG CALLBACK exception_handler(
5052 { \
5153 HANDLE exh = AddVectoredExceptionHandler(1, exception_handler); \
5254 int tidx = yr_get_tidx(); \
53- if (tidx == -1) \
54- abort(); \
55+ assert(tidx != -1); \
5556 jmp_buf jb; \
5657 exc_jmp_buf[tidx] = &jb; \
5758 if (setjmp(jb) == 0) \
@@ -77,8 +78,7 @@ static void exception_handler(int sig) {
7778 if (tidx != -1 && exc_jmp_buf [tidx ] != NULL )
7879 siglongjmp (* exc_jmp_buf [tidx ], 1 );
7980
80- // We should not reach this point.
81- abort ();
81+ assert (FALSE); // We should not reach this point.
8282 }
8383}
8484
@@ -96,8 +96,7 @@ typedef struct sigaction sa;
9696 pthread_sigmask (SIG_SETMASK , & act .sa_mask , & oldmask ); \
9797 sigaction (SIGBUS , & act , & oldact ); \
9898 int tidx = yr_get_tidx (); \
99- if (tidx == -1 ) \
100- abort (); \
99+ assert (tidx != -1 ); \
101100 sigjmp_buf jb ; \
102101 exc_jmp_buf [tidx ] = & jb ; \
103102 if (sigsetjmp (jb , 1 ) == 0 ) \
0 commit comments