diff --git a/src/language/ASTNode.hpp b/src/language/ASTNode.hpp index 31b12b1e5ecfe6be2f90901923b49e6aa9b791ac..92aeb29e09458c780f112dbc4aa166bb96a14d3d 100644 --- a/src/language/ASTNode.hpp +++ b/src/language/ASTNode.hpp @@ -28,7 +28,7 @@ struct ASTNode : public parse_tree::basic_node<ASTNode> void execute(ExecUntilBreakOrContinue& exec_policy) { - Assert(static_cast<bool>(m_node_processor)); + Assert(m_node_processor, "Undefined node processor"); if (exec_policy.exec()) { m_node_processor->execute(exec_policy); } diff --git a/src/utils/PugsAssert.hpp b/src/utils/PugsAssert.hpp index 1ca85e009d7e3013d34e2ef2dbce39c0351b5052..d31c9ef3ac1ded594d1c3eefdcf14a860041135e 100644 --- a/src/utils/PugsAssert.hpp +++ b/src/utils/PugsAssert.hpp @@ -50,18 +50,11 @@ class AssertError ~AssertError() = default; }; -PRAGMA_DIAGNOSTIC_IGNORED_WATTRIBUTES -inline bool __attribute__((analyzer_noreturn)) _pugs_assert(const bool& assert) -{ - return assert; -} -PRAGMA_DIAGNOSTIC_POP - #ifdef NDEBUG // Useless test is there to check syntax even in optimized mode. Costs nothing. #define Assert(assertion, ...) \ - if (not _pugs_assert(assertion)) { \ + if (not static_cast<bool>(assertion)) { \ using vargs_t = decltype(std::make_tuple(__VA_ARGS__)); \ static_assert(std::tuple_size_v<vargs_t> <= 1, "too many arguments"); \ } @@ -69,7 +62,7 @@ PRAGMA_DIAGNOSTIC_POP #else // NDEBUG #define Assert(assertion, ...) \ - if (not _pugs_assert(assertion)) { \ + if (not static_cast<bool>(assertion)) { \ using vargs_t = decltype(std::make_tuple(__VA_ARGS__)); \ static_assert(std::tuple_size_v<vargs_t> <= 1, "too many arguments"); \ if constexpr (std::tuple_size_v<vargs_t> == 0) { \