Skip to content
Snippets Groups Projects
Commit 78e2cd1d authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Add __attribut__ to help scan-build static analyzer

parent 40bf8161
No related branches found
No related tags found
No related merge requests found
......@@ -45,15 +45,25 @@ class AssertError
~AssertError() = default;
};
#pragma GCC diagnostic ignored "-Wattributes"
inline bool
__attribute__((analyzer_noreturn))
_pastis_assert(const bool& assert)
{
return assert;
}
#pragma GCC diagnostic pop
#ifdef NDEBUG
// Useless test is there to check syntax even in optimized mode. Costs nothing.
#define Assert(assertion) if (not (assertion)) {}
#define Assert(assertion) \
if (not _pastis_assert(assertion)) {}
#else // NDEBUG
#define Assert(assertion) \
if (not (assertion)) { \
if (not _pastis_assert(assertion)) { \
throw AssertError(__FILE__, \
__LINE__, \
__PRETTY_FUNCTION__, \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment