aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2017-09-14 20:38:42 +0300
committerEli Zaretskii2017-09-14 20:38:42 +0300
commit2c29280e7a360f55a8110bb1e3985cc09eb94577 (patch)
tree74145f4f68d7126c995359bf89a8e7cdb54dc3e6 /src
parent56ab0c4a4c99766c041a12f737353c9b889d1750 (diff)
downloademacs-2c29280e7a360f55a8110bb1e3985cc09eb94577.tar.gz
emacs-2c29280e7a360f55a8110bb1e3985cc09eb94577.zip
Fix warnings about formats in printf-like functions on MS-Windows
* src/lisp.h (pI) [__MINGW32__]: Provide definition that will hopefully DTRT with both MinGW64 and mingw.org's MinGW. See http://lists.gnu.org/archive/html/emacs-devel/2017-09/msg00171.html for the details. * src/conf_post.h (PRINTF_ARCHETYPE) [MINGW_W64]: Separate definition specific to MinGW64. (PRINTF_ARCHETYPE) [__MINGW32__]: For mingw.org's MinGW, use __mingw_printf__ in ANSI-compatible mode.
Diffstat (limited to 'src')
-rw-r--r--src/conf_post.h22
-rw-r--r--src/lisp.h11
2 files changed, 30 insertions, 3 deletions
diff --git a/src/conf_post.h b/src/conf_post.h
index 096a6779971..febdb8b8bf7 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -255,7 +255,27 @@ extern int emacs_setenv_TZ (char const *);
255#if GNUC_PREREQ (4, 4, 0) && defined __GLIBC_MINOR__ 255#if GNUC_PREREQ (4, 4, 0) && defined __GLIBC_MINOR__
256# define PRINTF_ARCHETYPE __gnu_printf__ 256# define PRINTF_ARCHETYPE __gnu_printf__
257#elif GNUC_PREREQ (4, 4, 0) && defined __MINGW32__ 257#elif GNUC_PREREQ (4, 4, 0) && defined __MINGW32__
258# define PRINTF_ARCHETYPE __ms_printf__ 258# ifdef MINGW_W64
259/* When __USE_MINGW_ANSI_STDIO is non-zero (as set by config.h),
260 MinGW64 replaces printf* with its own versions that are
261 __gnu_printf__ compatible, and emits warnings for MS native %I64d
262 format spec. */
263# if __USE_MINGW_ANSI_STDIO
264# define PRINTF_ARCHETYPE __gnu_printf__
265# else
266# define PRINTF_ARCHETYPE __ms_printf__
267# endif
268# else /* mingw.org's MinGW */
269/* Starting from runtime v5.0.0, mingw.org's MinGW with GCC 6 and
270 later turns on __USE_MINGW_ANSI_STDIO by default, replaces printf*
271 with its own __mingw_printf__ version, which still recognizes
272 %I64d. */
273# if GNUC_PREREQ (6, 0, 0) && __MINGW32_MAJOR_VERSION >= 5
274# define PRINTF_ARCHETYPE __mingw_printf__
275# else /* __MINGW32_MAJOR_VERSION < 5 */
276# define PRINTF_ARCHETYPE __ms_printf__
277# endif /* __MINGW32_MAJOR_VERSION < 5 */
278# endif /* MinGW */
259#else 279#else
260# define PRINTF_ARCHETYPE __printf__ 280# define PRINTF_ARCHETYPE __printf__
261#endif 281#endif
diff --git a/src/lisp.h b/src/lisp.h
index 40e84ec7ecc..c5aea9c34cb 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -94,9 +94,16 @@ typedef long long int EMACS_INT;
94typedef unsigned long long int EMACS_UINT; 94typedef unsigned long long int EMACS_UINT;
95enum { EMACS_INT_WIDTH = LLONG_WIDTH, EMACS_UINT_WIDTH = ULLONG_WIDTH }; 95enum { EMACS_INT_WIDTH = LLONG_WIDTH, EMACS_UINT_WIDTH = ULLONG_WIDTH };
96# define EMACS_INT_MAX LLONG_MAX 96# define EMACS_INT_MAX LLONG_MAX
97# ifdef __MINGW32__ 97/* MinGW supports %lld only if __USE_MINGW_ANSI_STDIO is non-zero,
98 which is arranged by config.h, and (for mingw.org) if GCC is 6.0 or
99 later and the runtime version is 5.0.0 or later. Otherwise,
100 printf-like functions are declared with __ms_printf__ attribute,
101 which will cause a warning for %lld etc. */
102# if defined __MINGW32__ \
103 && (!defined __USE_MINGW_ANSI_STDIO \
104 || !(GNUC_PREREQ (6, 0, 0) && __MINGW32_MAJOR_VERSION >= 5))
98# define pI "I64" 105# define pI "I64"
99# else 106# else /* ! MinGW */
100# define pI "ll" 107# define pI "ll"
101# endif 108# endif
102# else 109# else