X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=macro.h;h=2379ee2de3cc6114dff85e2c454049a5b0b5ec37;hp=d56585dc341bdfc93480c8a92ec8f4a55138bade;hb=fbe9f3a92dcb585c14faf06ef9017f552e405222;hpb=dd8f71ee9fe4408311b335726e0787a37fbf9d42 diff --git a/macro.h b/macro.h index d56585dc3..2379ee2de 100644 --- a/macro.h +++ b/macro.h @@ -35,6 +35,7 @@ #define _deprecated __attribute__ ((deprecated)) #define _packed __attribute__ ((packed)) #define _malloc __attribute__ ((malloc)) +#define _weak __attribute__ ((weak)) #define _likely(x) (__builtin_expect(!!(x),1)) #define _unlikely(x) (__builtin_expect(!!(x),0)) @@ -69,11 +70,10 @@ static inline size_t ALIGN(size_t l) { #define assert_se(expr) \ do { \ - if (_unlikely(!(expr))) { \ - log_error("Assertion '%s' failed at %s:%u, function %s(). Aborting.", \ - #expr , __FILE__, __LINE__, __PRETTY_FUNCTION__); \ - abort(); \ - } \ + if (_unlikely(!(expr))) \ + log_assert(__FILE__, __LINE__, __PRETTY_FUNCTION__, \ + "Assertion '%s' failed at %s:%u, function %s(). Aborting.", \ + #expr , __FILE__, __LINE__, __PRETTY_FUNCTION__); \ } while (false) \ /* We override the glibc assert() here. */ @@ -86,9 +86,9 @@ static inline size_t ALIGN(size_t l) { #define assert_not_reached(t) \ do { \ - log_error("Code should not be reached '%s' at %s:%u, function %s(). Aborting.", \ - t, __FILE__, __LINE__, __PRETTY_FUNCTION__); \ - abort(); \ + log_assert(__FILE__, __LINE__, __PRETTY_FUNCTION__, \ + "Code should not be reached '%s' at %s:%u, function %s(). Aborting.", \ + t, __FILE__, __LINE__, __PRETTY_FUNCTION__); \ } while (false) #define assert_cc(expr) \