diff options
author | June McEnroe <june@causal.agency> | 2018-08-07 14:11:19 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2018-08-07 14:11:19 -0400 |
commit | fa270d92873a7fd595e093eb3c07409e336620c0 (patch) | |
tree | ed289886434eae80a897000adcda1b0cb5d9e71f /chat.h | |
parent | Handle PART and QUIT without messages (diff) | |
download | catgirl-fa270d92873a7fd595e093eb3c07409e336620c0.tar.gz catgirl-fa270d92873a7fd595e093eb3c07409e336620c0.zip |
Hack clang into checking uiFmt format strings
Diffstat (limited to 'chat.h')
-rw-r--r-- | chat.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/chat.h b/chat.h index 3d3586c..47a7e1e 100644 --- a/chat.h +++ b/chat.h @@ -45,10 +45,18 @@ void uiRead(void); void uiTopic(const wchar_t *topic); void uiTopicStr(const char *topic); void uiLog(const wchar_t *line); - -//__attribute__((format(printf, 1, 2))) void uiFmt(const wchar_t *format, ...); +// HACK: clang won't check wchar_t *format strings. +#ifdef NDEBUG +#define uiFmt(format, ...) uiFmt(L##format, __VA_ARGS__) +#else +#define uiFmt(format, ...) do { \ + snprintf(NULL, 0, format, __VA_ARGS__); \ + uiFmt(L##format, __VA_ARGS__); \ +} while(0) +#endif + void handle(char *line); void input(wchar_t *line); |