Make sure struct members are initialized
[openal-soft.git] / common / alassert.h
blob3797e96d5bd17d463b96ec7d2ed2a1b6cb5474c7
1 #ifndef AL_ASSERT_H
2 #define AL_ASSERT_H
4 #include <array>
6 #include "opthelpers.h"
8 namespace al {
10 [[noreturn]]
11 void do_assert(const char *message, int linenum, const char *filename, const char *funcname) noexcept;
13 } /* namespace al */
15 /* A custom assert macro that is not compiled out for Release/NDEBUG builds,
16 * making it an appropriate replacement for assert() checks that must not be
17 * ignored.
19 #define alassert(cond) do { \
20 if(!(cond)) UNLIKELY \
21 al::do_assert("Assertion '" #cond "' failed", __LINE__, __FILE__, std::data(__func__)); \
22 } while(0)
24 #endif /* AL_ASSERT_H */