diff options
author | Adam Borowski <kilobyte@angband.pl> | 2011-07-06 03:15:22 +0200 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2011-07-06 12:21:55 +0200 |
commit | fdf5a12385d370cb2c920bdf9455759664ab8e47 (patch) | |
tree | 0c6d4a1f2f94ca0178f3b1ae682ebff30ae15e2d /crawl-ref/source/mpr.h | |
parent | 0b190e40a97ef1994ce822fd94a4fca840de326c (diff) | |
download | crawl-ref-fdf5a12385d370cb2c920bdf9455759664ab8e47.tar.gz crawl-ref-fdf5a12385d370cb2c920bdf9455759664ab8e47.zip |
Let GCC issue warnings about mprf() arguments.
Diffstat (limited to 'crawl-ref/source/mpr.h')
-rw-r--r-- | crawl-ref/source/mpr.h | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/crawl-ref/source/mpr.h b/crawl-ref/source/mpr.h index 00d8f6e0b2..488af9699c 100644 --- a/crawl-ref/source/mpr.h +++ b/crawl-ref/source/mpr.h @@ -83,15 +83,24 @@ inline void mprnojoin(std::string text, msg_channel_type channel=MSGCH_PLAIN, mpr(text, channel, param, true); } +#ifdef __GNUC__ +// show warnings about the format string +# define PRINTF(x) const char *format, ...) \ + __attribute__((format (printf, x+1, x+2)) +#else +# define PRINTF(x) const char *format, ... +#endif + // 4.1-style mpr, currently named mprf for minimal disruption. -void mprf(msg_channel_type channel, int param, const char *format, ...); -void mprf(msg_channel_type channel, const char *format, ...); -void mprf(const char *format, ...); +void mprf(msg_channel_type channel, int param, PRINTF(2)); +void mprf(msg_channel_type channel, PRINTF(1)); +void mprf(PRINTF(0)); #ifdef DEBUG_DIAGNOSTICS -void dprf(const char *format, ...); +void dprf(PRINTF(0)); #else # define dprf(...) ((void)0) #endif +#undef PRINTF #endif |