summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/AppHdr.h
diff options
context:
space:
mode:
authorJohn Olender <john.olender@gmail.com>2014-06-08 18:27:31 -0400
committerNeil Moore <neil@s-z.org>2014-06-08 19:15:39 -0400
commit6bdb4c3189a32750953b17b04ef45849a24ff4a2 (patch)
tree8c4dd771c57b848cd1c81efd792ec3d5b42b7bc3 /crawl-ref/source/AppHdr.h
parent0fc4e0e3ec7886045c5d8573121d0a4a8027299d (diff)
downloadcrawl-ref-6bdb4c3189a32750953b17b04ef45849a24ff4a2.tar.gz
crawl-ref-6bdb4c3189a32750953b17b04ef45849a24ff4a2.zip
Remove PRINTF #define duplication in mingw check.
Fix indentation, remove #define duplication, and correct a comment about which macro must be defined for enabling mingw-w64's C99 printf.
Diffstat (limited to 'crawl-ref/source/AppHdr.h')
-rw-r--r--crawl-ref/source/AppHdr.h37
1 files changed, 19 insertions, 18 deletions
diff --git a/crawl-ref/source/AppHdr.h b/crawl-ref/source/AppHdr.h
index 7497d8022b..56d139c2f9 100644
--- a/crawl-ref/source/AppHdr.h
+++ b/crawl-ref/source/AppHdr.h
@@ -418,28 +418,29 @@ static inline void UNUSED(const volatile T &)
#ifdef __GNUC__
// show warnings about the format string
-#ifdef TARGET_COMPILER_MINGW
-// mingw32 / mingw-w64 compiler
-// If __MINGW_PRINTF_FORMAT is defined, mingw-w64 will try to use a C99 printf
+# ifdef TARGET_COMPILER_MINGW
+// Configure mingw32 / mingw-w64 printf format
+//
+// If __USE_MINGW_ANSI_STDIO is defined, mingw-w64 will try to use a C99 printf
// However, stdio.h must be included to have a C99 printf for use with
// __attribute__((format(...)).
-#ifdef __cplusplus
-#include <cstdio>
-#else
-#include <stdio.h>
-#endif
-// Fall back to standard printf if necessary
-#ifndef __MINGW_PRINTF_FORMAT
-#define __MINGW_PRINTF_FORMAT printf
-#endif
-// Use the mingw32/mingw-w64 C99-specific printf function to check format
-# define PRINTF(x, dfmt) const char *format dfmt, ...) \
- __attribute__((format (__MINGW_PRINTF_FORMAT, x+1, x+2))
-#else
+# ifdef __cplusplus
+# include <cstdio>
+# else
+# include <stdio.h>
+# endif
+// If mingw defined a special format function to use, use this over 'printf'.
+# ifdef __MINGW_PRINTF_FORMAT
+# define CRAWL_PRINTF_FORMAT __MINGW_PRINTF_FORMAT
+# else
+# define CRAWL_PRINTF_FORMAT printf
+# endif
+# else
// standard GNU-compatible compiler (i.e., not mingw32/mingw-w64)
+# define CRAWL_PRINTF_FORMAT printf
+# endif
# define PRINTF(x, dfmt) const char *format dfmt, ...) \
- __attribute__((format (printf, x+1, x+2))
-#endif
+ __attribute__((format (CRAWL_PRINTF_FORMAT, x+1, x+2))
#else
# define PRINTF(x, dfmt) const char *format dfmt, ...
#endif