diff options
| author | John "Lameguy" Wilbert Villamor <lameguy64@gmail.com> | 2022-11-03 10:14:22 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-03 10:14:22 +0800 |
| commit | 4139331d233b7a962e747c5564fa68a285f81cc8 (patch) | |
| tree | d4d3374afd5e36e8580cc424ab2c63ee9e7d357c /libpsn00b/include/assert.h | |
| parent | e08a3d9366f8ca14a76b3dd569dac1fb9f569748 (diff) | |
| parent | 37d963f724113e45d15aa9b8ee86baa9c4362b8f (diff) | |
| download | psn00bsdk-4139331d233b7a962e747c5564fa68a285f81cc8.tar.gz | |
Merge pull request #60 from spicyjpeg/bugfix
Bugfixes, new serial port API and sound examples
Diffstat (limited to 'libpsn00b/include/assert.h')
| -rw-r--r-- | libpsn00b/include/assert.h | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/libpsn00b/include/assert.h b/libpsn00b/include/assert.h index 32301e2..12212af 100644 --- a/libpsn00b/include/assert.h +++ b/libpsn00b/include/assert.h @@ -1,20 +1,35 @@ /* - * PSn00bSDK assert macro + * PSn00bSDK assert macro and internal logging * (C) 2022 spicyjpeg - MPL licensed + * + * Note that the _sdk_log() macro is used internally by PSn00bSDK to output + * debug messages and warnings. */ #ifndef __ASSERT_H #define __ASSERT_H +#include <stdio.h> + void _assert_abort(const char *file, int line, const char *expr); #ifdef NDEBUG -#define assert(x) + +#define assert(expr) +#define _sdk_log(fmt, ...) + #else + #define assert(expr) { \ - if (!(expr)) \ - _assert_abort(__FILE__, __LINE__, #expr); \ + if (!(expr)) _assert_abort(__FILE__, __LINE__, #expr); \ } + +#ifdef SDK_LIBRARY_NAME +#define _sdk_log(fmt, ...) printf(SDK_LIBRARY_NAME ": " fmt, ##__VA_ARGS__) +#else +#define _sdk_log(fmt, ...) printf(fmt, ##__VA_ARGS__) +#endif + #endif #endif |
