Add soft asserts and fixed precision in debug messages
This commit is contained in:
parent
7b016e5e40
commit
011d02cfca
1 changed files with 14 additions and 1 deletions
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
#if !defined(NDEBUG) || defined(SFIZZ_ENABLE_RELEASE_ASSERT)
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
// Break in source code
|
||||
#if defined(_WIN32) && defined(_MSC_VER)
|
||||
|
|
@ -40,16 +39,30 @@
|
|||
ASSERTFALSE; \
|
||||
} while (0)
|
||||
|
||||
#define CHECKFALSE \
|
||||
do { \
|
||||
std::cerr << "Check failed at " << __FILE__ << ":" << __LINE__ << '\n'; \
|
||||
} while (0)
|
||||
|
||||
#define CHECK(expression) \
|
||||
do { \
|
||||
if (!(expression)) \
|
||||
CHECKFALSE; \
|
||||
} while (0)
|
||||
|
||||
#else // NDEBUG
|
||||
|
||||
#define ASSERTFALSE do {} while (0)
|
||||
#define ASSERT(expression) do {} while (0)
|
||||
#define CHECKFALSE do {} while (0)
|
||||
#define CHECK(expression) do {} while (0)
|
||||
|
||||
#endif
|
||||
|
||||
// Debug message
|
||||
#if !defined(NDEBUG) || defined(SFIZZ_ENABLE_RELEASE_DBG)
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#define DBG(ostream) do { std::cerr << std::fixed << std::setprecision(2) << ostream << '\n'; } while (0)
|
||||
#else
|
||||
#define DBG(ostream) do {} while (0)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue