From 643e0b8d2857ed63cb9e94731a30d8ed0e9ca889 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 12 Jun 2016 11:30:14 +0300 Subject: [PATCH] Fix printf-related compilation warnings on MinGW * src/conf_post.h (ATTRIBUTE_FORMAT_PRINTF) [__MINGW32__]: Use '__ms_printf__', not '__gnu_printf__', as the latter is not what MS 'printf' supports, and causes bogus compilation warnings. * src/lisp.h (pI) [__MINGW32__]: Define to "I64", as MS 'printf' doesn't support the "ll" modifier. --- src/conf_post.h | 13 +++++++++---- src/lisp.h | 6 +++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/conf_post.h b/src/conf_post.h index 6f48fd6d18..e21e73eb99 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -252,12 +252,17 @@ extern int emacs_setenv_TZ (char const *); #endif #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) -# define ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \ - ATTRIBUTE_FORMAT ((__gnu_printf__, formatstring_parameter, first_argument)) -#else +# ifdef __MINGW32__ +# define ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \ + ATTRIBUTE_FORMAT ((__ms_printf__, formatstring_parameter, first_argument)) +#else /* !__MINGW32__ */ +# define ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \ + ATTRIBUTE_FORMAT ((__gnu_printf__, formatstring_parameter, first_argument)) +#endif /* !__MINGW32__ */ +#else /* __GNUC__ < 4.4 */ # define ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \ ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument)) -#endif +#endif /* __GNUC__ < 4.4 */ #define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST #define ATTRIBUTE_UNUSED _GL_UNUSED diff --git a/src/lisp.h b/src/lisp.h index 3c6bf3473d..a0d0610a18 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -88,7 +88,11 @@ typedef unsigned long EMACS_UINT; typedef long long int EMACS_INT; typedef unsigned long long int EMACS_UINT; # define EMACS_INT_MAX LLONG_MAX -# define pI "ll" +# ifdef __MINGW32__ +# define pI "I64" +# else +# define pI "ll" +# endif # else # error "INTPTR_MAX too large" # endif -- 2.39.2