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:
parent
e34b6500d9
commit
a8b9d15d1b
|
@ -20,7 +20,6 @@
|
||||||
|
|
||||||
#include "zm_define.h"
|
#include "zm_define.h"
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <cassert>
|
|
||||||
#include "span.hpp"
|
#include "span.hpp"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
|
@ -31,6 +31,14 @@
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <vector>
|
#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;
|
typedef std::vector<std::string> StringVector;
|
||||||
|
|
||||||
std::string Trim(const std::string &str, const std::string &char_set);
|
std::string Trim(const std::string &str, const std::string &char_set);
|
||||||
|
|
Loading…
Reference in New Issue