mirror of https://github.com/ARMmbed/mbed-os.git
littlefs: Adopted MBED_ASSERT and littlefs.enable_assert
Much like the logging functions, assertions can be enabled, disabled and forced with the littlefs.enable_assert config option. Integrates with the new LFS_ASSERT macro.pull/6179/head
parent
453a1b6815
commit
afc3306d25
|
@ -37,16 +37,18 @@
|
|||
// macros must not have side-effects as the macros can be removed for a smaller
|
||||
// code footprint
|
||||
|
||||
// Logging functions
|
||||
#ifdef __MBED__
|
||||
#include "mbed_debug.h"
|
||||
#include "mbed_assert.h"
|
||||
#else
|
||||
#define MBED_LFS_ENABLE_INFO false
|
||||
#define MBED_LFS_ENABLE_DEBUG true
|
||||
#define MBED_LFS_ENABLE_WARN true
|
||||
#define MBED_LFS_ENABLE_ERROR true
|
||||
#define MBED_LFS_ENABLE_INFO false
|
||||
#define MBED_LFS_ENABLE_DEBUG true
|
||||
#define MBED_LFS_ENABLE_WARN true
|
||||
#define MBED_LFS_ENABLE_ERROR true
|
||||
#define MBED_LFS_ENABLE_ASSERT true
|
||||
#endif
|
||||
|
||||
// Logging functions
|
||||
#if !defined(LFS_NO_INFO) && MBED_LFS_ENABLE_INFO
|
||||
#define LFS_INFO(fmt, ...) printf("lfs info:%d: " fmt "\n", __LINE__, __VA_ARGS__)
|
||||
#elif !defined(LFS_NO_INFO) && !defined(MBED_LFS_ENABLE_INFO)
|
||||
|
@ -80,8 +82,10 @@
|
|||
#endif
|
||||
|
||||
// Runtime assertions
|
||||
#ifndef LFS_NO_ASSERT
|
||||
#if !defined(LFS_NO_ASSERT) && MBED_LFS_ENABLE_ASSERT
|
||||
#define LFS_ASSERT(test) assert(test)
|
||||
#elif !defined(LFS_NO_ASSERT) && !defined(MBED_LFS_ENABLE_ASSERT)
|
||||
#define LFS_ASSERT(test) MBED_ASSERT(test)
|
||||
#else
|
||||
#define LFS_ASSERT(test)
|
||||
#endif
|
||||
|
|
|
@ -40,6 +40,11 @@
|
|||
"macro_name": "MBED_LFS_ENABLE_ERROR",
|
||||
"value": null,
|
||||
"help": "Enables error logging, true = enabled, false = disabled, null = disabled only in release builds"
|
||||
},
|
||||
"enable_assert": {
|
||||
"macro_name": "MBED_LFS_ENABLE_ASSERT",
|
||||
"value": null,
|
||||
"help": "Enables asserts, true = enabled, false = disabled, null = disabled only in release builds"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue