Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
exceptions.hpp
Go to the documentation of this file.
1#pragma once
2
25
26#if defined(__cpp_exceptions) && __cpp_exceptions
27
28#define PULP_TRY try
29#define PULP_CATCH_ALL catch (...)
30
31#else
32
33// Exceptions disabled: run the guarded block unconditionally, and make the
34// handler a never-taken branch the optimizer removes. `if (false)` keeps the
35// handler body syntactically valid (it is parsed, not discarded) without a
36// `catch` keyword, which `-fno-exceptions` rejects.
37//
38// Only `catch (...)` is provided — a typed/bound handler (`catch (const E& e)`)
39// cannot be expressed this way because its body would reference an undefined
40// binding. Defensive sites that only need to swallow-and-fall-through use
41// `catch (...)`, which is all these toolchains require.
42#define PULP_TRY if (true)
43#define PULP_CATCH_ALL if (false)
44
45#endif