diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-04-16 09:50:50 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-16 09:50:50 -0400 |
commit | edb8075ae0c0986fb168b464b05e0b54537f8f30 (patch) | |
tree | fcce54a1332d699fb5ecaef85b5fba70066713de /include | |
parent | Merge pull request #1171 from JerziKaminsky/misc_fixes (diff) | |
parent | Fix location reported by sway_assert (diff) | |
download | sway-edb8075ae0c0986fb168b464b05e0b54537f8f30.tar.gz sway-edb8075ae0c0986fb168b464b05e0b54537f8f30.tar.zst sway-edb8075ae0c0986fb168b464b05e0b54537f8f30.zip |
Merge pull request #1175 from JerziKaminsky/fix_sway_assert_variadic
Fix multiple issues in sway_assert
Diffstat (limited to 'include')
-rw-r--r-- | include/log.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/include/log.h b/include/log.h index 2c4150e4..32981b62 100644 --- a/include/log.h +++ b/include/log.h | |||
@@ -19,15 +19,18 @@ void sway_log_colors(int mode); | |||
19 | void sway_log_errno(log_importance_t verbosity, char* format, ...) __attribute__((format(printf,2,3))); | 19 | void sway_log_errno(log_importance_t verbosity, char* format, ...) __attribute__((format(printf,2,3))); |
20 | void sway_abort(const char* format, ...) __attribute__((format(printf,1,2))); | 20 | void sway_abort(const char* format, ...) __attribute__((format(printf,1,2))); |
21 | 21 | ||
22 | bool _sway_assert(bool condition, const char* format, ...) __attribute__((format(printf,2,3))); | 22 | bool _sway_assert(bool condition, const char *filename, int line, const char* format, ...) __attribute__((format(printf,4,5))); |
23 | #define sway_assert(COND, FMT, ...) \ | 23 | #define sway_assert(COND, FMT, ...) \ |
24 | _sway_assert(COND, "%s:" FMT, __PRETTY_FUNCTION__, ##__VA_ARGS__) | 24 | _sway_assert(COND, __FILE__, __LINE__, "%s:" FMT, __PRETTY_FUNCTION__, ##__VA_ARGS__) |
25 | 25 | ||
26 | void _sway_log(const char *filename, int line, log_importance_t verbosity, const char* format, ...) __attribute__((format(printf,4,5))); | 26 | void _sway_log(const char *filename, int line, log_importance_t verbosity, const char* format, ...) __attribute__((format(printf,4,5))); |
27 | 27 | ||
28 | #define sway_log(VERBOSITY, FMT, ...) \ | 28 | #define sway_log(VERBOSITY, FMT, ...) \ |
29 | _sway_log(__FILE__, __LINE__, VERBOSITY, FMT, ##__VA_ARGS__) | 29 | _sway_log(__FILE__, __LINE__, VERBOSITY, FMT, ##__VA_ARGS__) |
30 | 30 | ||
31 | #define sway_vlog(VERBOSITY, FMT, VA_ARGS) \ | ||
32 | _sway_vlog(__FILE__, __LINE__, VERBOSITY, FMT, VA_ARGS) | ||
33 | |||
31 | void error_handler(int sig); | 34 | void error_handler(int sig); |
32 | 35 | ||
33 | #endif | 36 | #endif |