This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove unneeded 'use' from ext/XS-APItest/t/peep.t Devel::Peek is not used by ext...
[perl5.git] / ext / XS-APItest / exception.c
CommitLineData
9b5c3821
MHM
1#include "EXTERN.h"
2#include "perl.h"
3
4#define NO_XSLOCKS
5#include "XSUB.h"
6
7static void throws_exception(int throw_e)
8{
9 if (throw_e)
10 croak("boo\n");
11}
12
7a646707
NC
13/* Don't give this the same name as exection() in ext/Devel/PPPort/module3.c
14 as otherwise building entirely staticly will cause a test to fail, as
15 PPPort's execption() gets used in place of this one. */
16
17int apitest_exception(int throw_e)
9b5c3821
MHM
18{
19 dTHR;
20 dXCPT;
21 SV *caught = get_sv("XS::APItest::exception_caught", 0);
22
23 XCPT_TRY_START {
24 throws_exception(throw_e);
25 } XCPT_TRY_END
26
27 XCPT_CATCH
28 {
29 sv_setiv(caught, 1);
30 XCPT_RETHROW;
31 }
32
33 sv_setiv(caught, 0);
34
35 return 42;
36}
37