File: wasmexcept.hpp

package info (click to toggle)
prjtrellis 1.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 83,000 kB
  • sloc: cpp: 20,813; python: 16,246; sh: 375; makefile: 262; asm: 80; ansic: 58
file content (25 lines) | stat: -rw-r--r-- 778 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#if defined(__wasm)

#include <cstdint>
#include <iostream>

extern "C" {
// FIXME: WASI does not currently support exceptions.
void *__cxa_allocate_exception(size_t thrown_size) throw() { return malloc(thrown_size); }
bool __cxa_uncaught_exception() throw();
void __cxa_throw(void *thrown_exception, struct std::type_info *tinfo, void (*dest)(void *)) { (void)thrown_exception; (void)tinfo; (void)dest; std::terminate(); }
}

namespace boost {
struct source_location;
void throw_exception(std::exception const &e) { 
	std::cerr << "boost::exception(): " << e.what() << std::endl;
	exit(1);
}
void throw_exception(std::exception const &e, boost::source_location const &) { 
	std::cerr << "boost::exception(): " << e.what() << std::endl;
	exit(1);
}
} // namespace boost

#endif