diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-12-10 17:01:10 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-12-10 17:01:10 +0000 |
commit | 80514f9c9bb86dbba761e4b026e5d62156ea112c (patch) | |
tree | 2dd06a646831d5da062f73543e5ac3909ac5fd97 /src/shared/macro.h | |
parent | 6e8df5f00a3874decf1e5542da3d65b25f6da1dc (diff) |
macro: log assertion at debug level in assert_return()
Diffstat (limited to 'src/shared/macro.h')
-rw-r--r-- | src/shared/macro.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/shared/macro.h b/src/shared/macro.h index 4198095011..fd3762eed4 100644 --- a/src/shared/macro.h +++ b/src/shared/macro.h @@ -153,10 +153,12 @@ static inline size_t ALIGN_TO(size_t l, size_t ali) { #define assert_cc(expr) struct UNIQUE(_assert_struct_) { char x[(expr) ? 0 : -1]; }; #endif -#define assert_return(expr, r) \ - do { \ - if (_unlikely_(!(expr))) \ - return (r); \ +#define assert_return(expr, r) \ + do { \ + if (_unlikely_(!(expr))) { \ + log_assert_failed_return(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__); \ + return (r); \ + } \ } while (false) #define PTR_TO_INT(p) ((int) ((intptr_t) (p))) |