Skip to content

Commit edf404a

Browse files
committed
Sync SignalTryCatch
1 parent 9113778 commit edf404a

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

src/SignalTryCatch.h

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,31 @@
1818
#define NEED_SIGJMP 1
1919
#endif
2020

21+
// By default, the ExceptionContext_t class is expected in the namespace
22+
// CppyyLegacy, If it is expected in no namespace, one can explicitly define
23+
// NO_CPPYY_LEGACY_NAMESPACE at build time (e.g. if one wants to use ROOT).
24+
25+
#ifndef NO_CPPYY_LEGACY_NAMESPACE
2126
namespace CppyyLegacy {
27+
#endif
2228
struct ExceptionContext_t {
2329
#ifdef NEED_SIGJMP
2430
sigjmp_buf fBuf;
2531
#else
2632
jmp_buf fBuf;
2733
#endif
2834
};
35+
#ifndef NO_CPPYY_LEGACY_NAMESPACE
2936
}
3037

38+
using CppyyExceptionContext_t = CppyyLegacy::ExceptionContext_t;
39+
#else
40+
using CppyyExceptionContext_t = ExceptionContext_t;
41+
#endif
42+
3143
// FIXME: This is a dummy, replace with cling equivalent of gException
32-
static CppyyLegacy::ExceptionContext_t DummyException;
33-
static CppyyLegacy::ExceptionContext_t *gException = &DummyException;
44+
static CppyyExceptionContext_t DummyException;
45+
static CppyyExceptionContext_t *gException = &DummyException;
3446

3547
#ifdef NEED_SIGJMP
3648
# define CLING_EXCEPTION_SETJMP(buf) sigsetjmp(buf,1)
@@ -40,14 +52,14 @@ static CppyyLegacy::ExceptionContext_t *gException = &DummyException;
4052

4153
#define CLING_EXCEPTION_RETRY \
4254
{ \
43-
static CppyyLegacy::ExceptionContext_t R__curr, *R__old = gException; \
55+
static CppyyExceptionContext_t R__curr, *R__old = gException; \
4456
int R__code; \
4557
gException = &R__curr; \
4658
R__code = CLING_EXCEPTION_SETJMP(gException->fBuf); if (R__code) { }; {
4759

4860
#define CLING_EXCEPTION_TRY \
4961
{ \
50-
static CppyyLegacy::ExceptionContext_t R__curr, *R__old = gException; \
62+
static CppyyExceptionContext_t R__curr, *R__old = gException; \
5163
int R__code; \
5264
gException = &R__curr; \
5365
if ((R__code = CLING_EXCEPTION_SETJMP(gException->fBuf)) == 0) {
@@ -63,6 +75,6 @@ static CppyyLegacy::ExceptionContext_t *gException = &DummyException;
6375
gException = R__old; \
6476
}
6577

66-
CPYCPPYY_IMPORT CppyyLegacy::ExceptionContext_t *gException;
78+
CPYCPPYY_IMPORT CppyyExceptionContext_t *gException;
6779

6880
#endif

0 commit comments

Comments
 (0)