diff options
author | nicm <nicm> | 2021-09-10 14:22:24 +0000 |
---|---|---|
committer | nicm <nicm> | 2021-09-10 14:22:24 +0000 |
commit | 33ac7a346e9134e27d26c88fc0693f16b1c55deb (patch) | |
tree | ebddf1082bc84e2e1fb6f63e61bea175756ff482 | |
parent | 5cdc1bdd32f1500beb01bfc632e314d784a07082 (diff) | |
download | rtmux-33ac7a346e9134e27d26c88fc0693f16b1c55deb.tar.gz rtmux-33ac7a346e9134e27d26c88fc0693f16b1c55deb.tar.bz2 rtmux-33ac7a346e9134e27d26c88fc0693f16b1c55deb.zip |
Get rid of the last two warnings by turning them off around the problem
statements, if the compiler supports it.
-rw-r--r-- | log.c | 4 | ||||
-rw-r--r-- | tmux.h | 14 |
2 files changed, 16 insertions, 2 deletions
@@ -147,7 +147,7 @@ fatal(const char *msg, ...) va_start(ap, msg); if (asprintf(&fmt, "fatal: %s: %s", msg, strerror(errno)) == -1) exit(1); - log_vwrite(fmt, ap); + no_format_nonliteral(log_vwrite(fmt, ap)); va_end(ap); exit(1); } @@ -162,7 +162,7 @@ fatalx(const char *msg, ...) va_start(ap, msg); if (asprintf(&fmt, "fatal: %s", msg) == -1) exit(1); - log_vwrite(fmt, ap); + no_format_nonliteral(log_vwrite(fmt, ap)); va_end(ap); exit(1); } @@ -93,6 +93,20 @@ struct winlink; #define DEFAULT_XPIXEL 16 #define DEFAULT_YPIXEL 32 +/* Don't complain about format arguments. */ +#if __clang__ || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) +#define no_format_nonliteral(x) do { \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wformat-nonliteral\"") \ + x; \ + _Pragma ("GCC diagnostic pop") \ +} while (0) +#else +#define no_format_nonliteral(x) do { \ + x; \ +} while (0) +#endif + /* Attribute to make GCC check printf-like arguments. */ #define printflike(a, b) __attribute__ ((format (printf, a, b))) |