Debian Codegraph @

gcc/testsuite/g++.dg/contracts/preload_nocontinue_handler/nocontinue.cpp

raw
1 #include <exception>
2 #include <contract>
3 #include <dlfcn.h>
4
5 using handler = void (*)(const std::contract_violation &);
6 constexpr const char *mangledHandlerName = "_Z25handle_contract_violationRKSt18contract_violation";
7 void handle_contract_violation(const std::contract_violation &violation) {
8 try {
9 handler original_handle_contract_violation;
10 original_handle_contract_violation =
11 (handler)dlsym(RTLD_NEXT, mangledHandlerName);
12 (*original_handle_contract_violation)(violation);
13 }
14 catch(...) {
15 ; // squash
16 }
17 std::terminate();
18 }
19