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.
__archive__
Redirect 'Slash' NIL 2009-10-19 09:49:34 -07:00 committed by David Brownell
parent 557d1b6490
commit 113679ff59
2 changed files with 8 additions and 6 deletions

View File

@ -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

View File

@ -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