mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-29 04:20:20 +00:00
btstack_debug: add support for btstack_assert macro
This commit is contained in:
parent
8b7155e095
commit
50ca975402
@ -54,11 +54,31 @@
|
||||
#include <avr/pgmspace.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ASSERT
|
||||
#include <assert.h>
|
||||
#endif
|
||||
|
||||
// fallback to __FILE__ for untagged files
|
||||
#ifndef BTSTACK_FILE__
|
||||
#define BTSTACK_FILE__ __FILE__
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ASSERT
|
||||
// map to libc assert
|
||||
#define btstack_assert(condition) assert(condition)
|
||||
#else /* HAVE_ASSERT */
|
||||
#ifdef ENABLE_BTSTACK_ASSERT
|
||||
void btstack_assert_failed(const char * file, uint16_t line_nr);
|
||||
#ifndef btstack_assert
|
||||
// use btstack macro that calls btstack_assert_failed() - provided by port
|
||||
#define btstack_assert(condition) if (condition) {} else { btstack_assert_failed(BTSTACK_FILE__, __LINE__); }
|
||||
#endif
|
||||
#else /* btstack_assert */
|
||||
// asserts off
|
||||
#define btstack_assert(condition) {}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Avoid complaints of unused arguments when log levels are disabled.
|
||||
static inline void __log_unused(const char *format, ...) {
|
||||
UNUSED(format);
|
||||
|
Loading…
x
Reference in New Issue
Block a user