From: Marat Radchenko Date: Tue, 30 Sep 2014 07:02:37 GMT Subject: [PATCH 08/14] MINGW: git-compat-util.h: use inttypes.h for printf macros Message-ID: <1412060563-22041-9-git-send-email-marat@slonopotamus.org> In-Reply-To: <1412060563-22041-1-git-send-email-marat@slonopotamus.org> All MinGW flavors have inttypes.h, so just include it. However, we need to pass -D__USE_MINGW_ANSI_STDIO=1 to select GNU-compatible macro definitions on MinGW-W64: http://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/ As a side-effect, Git no longer builds with MSVC < 2010 due to its lack of stdint.h but hopefully that is not a problem. Signed-off-by: Marat Radchenko --- compat/mingw.h | 2 -- compat/msvc.h | 3 +++ config.mak.uname | 3 ++- git-compat-util.h | 11 ++++++----- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/compat/mingw.h b/compat/mingw.h index d113b19..4bae842 100644 --- a/compat/mingw.h +++ b/compat/mingw.h @@ -353,8 +353,6 @@ static inline char *mingw_find_last_dir_sep(const char *path) int mingw_offset_1st_component(const char *path); #define offset_1st_component mingw_offset_1st_component #define PATH_SEP ';' -#define PRIuMAX "I64u" -#define PRId64 "I64d" void mingw_open_html(const char *path); #define open_html mingw_open_html diff --git a/compat/msvc.h b/compat/msvc.h index a63d878..84a03f9 100644 --- a/compat/msvc.h +++ b/compat/msvc.h @@ -17,6 +17,9 @@ typedef int pid_t; +#define PRIuMAX "I64u" +#define PRId64 "I64d" + static __inline int strcasecmp (const char *s1, const char *s2) { int size1 = strlen(s1); diff --git a/config.mak.uname b/config.mak.uname index 4470a928..c7aaa1c 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -328,6 +328,7 @@ ifeq ($(uname_S),Windows) NO_PREAD = YesPlease NEEDS_CRYPTO_WITH_SSL = YesPlease NO_LIBGEN_H = YesPlease + NO_INTTYPES_H = UnfortunatelyYes NO_POLL = YesPlease NO_SYMLINK_HEAD = YesPlease NO_IPV6 = YesPlease @@ -510,7 +511,7 @@ ifneq (,$(findstring MINGW,$(uname_S))) NO_POSIX_GOODIES = UnfortunatelyYes DEFAULT_HELP_FORMAT = html NO_D_INO_IN_DIRENT = YesPlease - COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/win32 + COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D__USE_MINGW_ANSI_STDIO=1 -DNOGDI -Icompat -Icompat/win32 ifneq (,$(findstring i686,$(CC_MACH))) COMPAT_CFLAGS += -D_USE_32BIT_TIME_T BASIC_LDFLAGS += -Wl,--large-address-aware diff --git a/git-compat-util.h b/git-compat-util.h index 0c4e663..9d2d5ab 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -96,6 +96,12 @@ #define GIT_WINDOWS_NATIVE #endif +#ifndef NO_INTTYPES_H +#include +#else +#include +#endif + #include #include #include @@ -147,11 +153,6 @@ #include #include #include -#ifndef NO_INTTYPES_H -#include -#else -#include -#endif #ifdef NO_INTPTR_T /* * On I16LP32, ILP32 and LP64 "long" is the save bet, however -- 2.1.1 -- -- *** Please reply-to-all at all times *** *** (do not pretend to know who is subscribed and who is not) *** *** Please avoid top-posting. *** The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free. You received this message because you are subscribed to the Google Groups "msysGit" group. To post to this group, send email to msysgit@googlegroups.com To unsubscribe from this group, send email to msysgit+unsubscribe@googlegroups.com For more options, and view previous threads, visit this group at http://groups.google.com/group/msysgit?hl=en_US?hl=en --- You received this message because you are subscribed to the Google Groups "Git for Windows" group. To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/d/optout.