diff options
author | 2019-11-04 22:04:11 +0100 | |
---|---|---|
committer | 2019-11-04 22:04:11 +0100 | |
commit | 2cf61b2e4c72a80eb688d1b6ffcacfdeaf55bf26 (patch) | |
tree | 0d056f80f69db1a17a680c6e3d8fac06aa6b3e45 /src/lib/netlist/plib/pexception.h | |
parent | e89f009945652ea15d941d4491cb8d9c0d2e3b65 (diff) |
netlist: code maintenance. (nw)
- more const
- explicitly raise exceptions instead of leaving this to log.fatal()
- correct a number of cppcheck findings.
- dead code removal
- clang lint corrections, e.g. include order
Diffstat (limited to 'src/lib/netlist/plib/pexception.h')
-rw-r--r-- | src/lib/netlist/plib/pexception.h | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/lib/netlist/plib/pexception.h b/src/lib/netlist/plib/pexception.h index e6c350a04b3..ba99b71cf73 100644 --- a/src/lib/netlist/plib/pexception.h +++ b/src/lib/netlist/plib/pexception.h @@ -15,16 +15,26 @@ namespace plib { - //============================================================ - // terminate - //============================================================ - - /*! Terminate the program + /*! Terminate the program. * * \note could be enhanced by setting a termination handler */ [[noreturn]] void terminate(const pstring &msg) noexcept; + + ///! throw an exception. + /// + /// throws an exception E. The purpose is to clearly identify exception + /// throwing in the code + /// + /// @tparam E Type of exception to be thrown + /// + template<typename E, typename... Args> + [[noreturn]] static inline void pthrow(Args&&... args) noexcept(false) + { + throw E(std::forward<Args>(args)...); + } + //============================================================ // exception base //============================================================ |