Codechange: wrap 'if' in macros into 'do { ... } while (false)', so it does not break on following 'else'.

This commit is contained in:
frosch
2024-01-30 22:42:20 +01:00
committed by frosch
parent e0bd1dd42e
commit 4d2fc28834
2 changed files with 2 additions and 2 deletions

View File

@@ -392,7 +392,7 @@ void NORETURN AssertFailedError(int line, const char *file, const char *expressi
/* For non-debug builds with assertions enabled use the special assertion handler. */
#if defined(NDEBUG) && defined(WITH_ASSERT)
# undef assert
# define assert(expression) if (unlikely(!(expression))) AssertFailedError(__LINE__, __FILE__, #expression);
# define assert(expression) do { if (unlikely(!(expression))) AssertFailedError(__LINE__, __FILE__, #expression); } while (false)
#endif
/* Define JSON_ASSERT, which is used by nlohmann-json. Otherwise the header-file