summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRedirect 'Slash' NIL <redirect.slash.nil@gmail.com>2009-10-19 09:49:34 -0700
committerDavid Brownell <dbrownell@users.sourceforge.net>2009-10-19 09:49:34 -0700
commit113679ff59e20530c621051d0aceb1876a49c45d (patch)
treeb2c8bad588933bd2dc50aac0091f17dab5ef3075
parent557d1b6490fab73bd0df0b1127275db784281595 (diff)
downloadopenocd_libswd-113679ff59e20530c621051d0aceb1876a49c45d.tar.gz
openocd_libswd-113679ff59e20530c621051d0aceb1876a49c45d.tar.bz2
openocd_libswd-113679ff59e20530c621051d0aceb1876a49c45d.tar.xz
openocd_libswd-113679ff59e20530c621051d0aceb1876a49c45d.zip
corrective fix for MinGW GNU C99 printf compliance
Compilation on cygwin, using gcc v3 with option -mno-cygwin, currently produces a large number of the following warnings: warning: `gnu_printf' is an unrecognized format function type These have been introduced with the recent MinGW GNU C99 printf compliance patch, as gnu_printf was only introduced with gcc v4.4 and is not recognized with earlier versions. The attached fix adds gcc version detection to the previous patch to avoid the problem.
-rw-r--r--src/helper/command.h7
-rw-r--r--src/helper/log.h7
2 files changed, 8 insertions, 6 deletions
diff --git a/src/helper/command.h b/src/helper/command.h
index c574efd5..ba825bcb 100644
--- a/src/helper/command.h
+++ b/src/helper/command.h
@@ -35,9 +35,10 @@
#include "jim.h"
#endif
-/* To achieve C99 printf compatibility in MinGW, gnu_printf should */
-/* be used for __attribute__((format( ... ))) */
-#ifdef IS_MINGW
+/* To achieve C99 printf compatibility in MinGW, gnu_printf should be
+ * used for __attribute__((format( ... ))), with GCC v4.4 or later
+ */
+#if (defined(IS_MINGW) && (((__GNUC__ << 16) + __GNUC_MINOR__) >= 0x00040004))
#define PRINTF_ATTRIBUTE_FORMAT gnu_printf
#else
#define PRINTF_ATTRIBUTE_FORMAT printf
diff --git a/src/helper/log.h b/src/helper/log.h
index 8f6ac770..f43e1e6c 100644
--- a/src/helper/log.h
+++ b/src/helper/log.h
@@ -28,9 +28,10 @@
#include "command.h"
-/* To achieve C99 printf compatibility in MinGW, gnu_printf should */
-/* be used for __attribute__((format( ... ))) */
-#ifdef IS_MINGW
+/* To achieve C99 printf compatibility in MinGW, gnu_printf should be
+ * used for __attribute__((format( ... ))), with GCC v4.4 or later
+ */
+#if (defined(IS_MINGW) && (((__GNUC__ << 16) + __GNUC_MINOR__) >= 0x00040004))
#define PRINTF_ATTRIBUTE_FORMAT gnu_printf
#else
#define PRINTF_ATTRIBUTE_FORMAT printf