Utils: Add our own ASSERT macro

Using `assert` from `<cassert>` leads to unused variable warnings in release builds.
Define the `ASSERT` macro which compiles to a no-op in release builds but still avoids
the warnings.
This commit is contained in:
Peter Keresztes Schmidt 2021-05-29 19:52:53 +02:00
parent e34b6500d9
commit a8b9d15d1b
2 changed files with 8 additions and 1 deletions

View File

@ -20,7 +20,6 @@
#include "zm_define.h"
#include <array>
#include <cassert>
#include "span.hpp"
#include <string>
#include <vector>

View File

@ -31,6 +31,14 @@
#include <sys/time.h>
#include <vector>
#ifdef NDEBUG
#define ASSERT(x) do { (void) sizeof(x); } while (0)
#else
#include <cassert>
#define ASSERT(x) assert(x)
#endif
typedef std::vector<std::string> StringVector;
std::string Trim(const std::string &str, const std::string &char_set);