diff options
author | Christopher Haster <chaster@utexas.edu> | 2021-01-18 23:01:53 +0300 |
---|---|---|
committer | Christopher Haster <chaster@utexas.edu> | 2021-01-18 23:01:53 +0300 |
commit | c0cc0a417e727764ccce6f1284e3570898d750e6 (patch) | |
tree | a6f946fdfaeaa735e1d9ae3d62cd21868caac752 /lfs_util.h | |
parent | bca64d76cfca80675e78c58c736c38bb43ece86b (diff) |
Enabled overriding of LFS_ASSERT/TRACE/DEBUG/etcci-revamp
This is useful for testing the new erroring assert behavior in CI.
Asserts do not error by default, so this macro needs to be overriden.
It is possible to test this behavior using the existing option of
overriding lfs_util.h with a custom file, by using a small sed
one-line script. But this is much simpler.
This does raise the question if more of the configuration options in
lfs_util.h should be opened up for function-like macro overrides.
Diffstat (limited to 'lfs_util.h')
-rw-r--r-- | lfs_util.h | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -49,6 +49,7 @@ extern "C" // code footprint // Logging functions +#ifndef LFS_TRACE #ifdef LFS_YES_TRACE #define LFS_TRACE_(fmt, ...) \ printf("%s:%d:trace: " fmt "%s\n", __FILE__, __LINE__, __VA_ARGS__) @@ -56,7 +57,9 @@ extern "C" #else #define LFS_TRACE(...) #endif +#endif +#ifndef LFS_DEBUG #ifndef LFS_NO_DEBUG #define LFS_DEBUG_(fmt, ...) \ printf("%s:%d:debug: " fmt "%s\n", __FILE__, __LINE__, __VA_ARGS__) @@ -64,7 +67,9 @@ extern "C" #else #define LFS_DEBUG(...) #endif +#endif +#ifndef LFS_WARN #ifndef LFS_NO_WARN #define LFS_WARN_(fmt, ...) \ printf("%s:%d:warn: " fmt "%s\n", __FILE__, __LINE__, __VA_ARGS__) @@ -72,7 +77,9 @@ extern "C" #else #define LFS_WARN(...) #endif +#endif +#ifndef LFS_ERROR #ifndef LFS_NO_ERROR #define LFS_ERROR_(fmt, ...) \ printf("%s:%d:error: " fmt "%s\n", __FILE__, __LINE__, __VA_ARGS__) @@ -80,13 +87,16 @@ extern "C" #else #define LFS_ERROR(...) #endif +#endif // Runtime assertions +#ifndef LFS_ASSERT #ifndef LFS_NO_ASSERT #define LFS_ASSERT(test) assert(test) #else #define LFS_ASSERT(test) #endif +#endif // Builtin functions, these may be replaced by more efficient |