diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2017-02-01 22:29:58 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2017-07-18 09:51:30 +0100 |
commit | 18afed0f98d020608c65293ecb9246dab6c58db3 (patch) | |
tree | 376aa1289f3f0e934e8381507c337d68e1e4b89a /include | |
parent | d416bdac2fff5eed7cfa70499ff61c8b8a9ca7ce (diff) | |
download | busybox-w32-18afed0f98d020608c65293ecb9246dab6c58db3.tar.gz busybox-w32-18afed0f98d020608c65293ecb9246dab6c58db3.tar.bz2 busybox-w32-18afed0f98d020608c65293ecb9246dab6c58db3.zip |
Use %I64* formats with MinGW instead of %ll* formats
The MSVC runtime uses the format specified %I64 for 64-bit data types;
It does not understand e.g. %llu for unsigned long longs.
However, mingw-w64 provides a compatibility mode in its runtime wrapper
which can be activated by defining the constant __USE_MINGW_ANSI_STDIO=1
in which case we must refrain from overriding the %ll* formats.
This fixes quite a couple of compile warnings when building with the
mingw-w64 compiler.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/libbb.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/include/libbb.h b/include/libbb.h index 9313a557a..0bc8cf29e 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -252,6 +252,13 @@ PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN | |||
252 | : ((T)1 << (sizeof(T)*8-1)) \ | 252 | : ((T)1 << (sizeof(T)*8-1)) \ |
253 | ) | 253 | ) |
254 | 254 | ||
255 | #if ENABLE_PLATFORM_MINGW32 && \ | ||
256 | (!defined(__USE_MINGW_ANSI_STDIO) || !__USE_MINGW_ANSI_STDIO) | ||
257 | #define LL_FMT "I64" | ||
258 | #else | ||
259 | #define LL_FMT "ll" | ||
260 | #endif | ||
261 | |||
255 | /* Large file support */ | 262 | /* Large file support */ |
256 | /* Note that CONFIG_LFS=y forces bbox to be built with all common ops | 263 | /* Note that CONFIG_LFS=y forces bbox to be built with all common ops |
257 | * (stat, lseek etc) mapped to "largefile" variants by libc. | 264 | * (stat, lseek etc) mapped to "largefile" variants by libc. |
@@ -277,7 +284,7 @@ typedef unsigned long long uoff_t; | |||
277 | # define XATOOFF(a) xatoull_range((a), 0, LLONG_MAX) | 284 | # define XATOOFF(a) xatoull_range((a), 0, LLONG_MAX) |
278 | # define BB_STRTOOFF bb_strtoull | 285 | # define BB_STRTOOFF bb_strtoull |
279 | # define STRTOOFF strtoull | 286 | # define STRTOOFF strtoull |
280 | # define OFF_FMT "ll" | 287 | # define OFF_FMT LL_FMT |
281 | # endif | 288 | # endif |
282 | #else | 289 | #else |
283 | /* CONFIG_LFS is off */ | 290 | /* CONFIG_LFS is off */ |