All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Marat Radchenko <marat@slonopotamus.org>
Cc: git@vger.kernel.org,  msysGit <msysgit@googlegroups.com>
Subject: Re: [PATCH 08/14] MINGW: git-compat-util.h: use inttypes.h for printf macros
Date: Wed, 08 Oct 2014 12:25:44 -0700	[thread overview]
Message-ID: <xmqq38ay9xdz.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: 1412791267-13356-9-git-send-email-marat@slonopotamus.org

Marat Radchenko <marat@slonopotamus.org> writes:

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

That "hopefully" does not build much confidence.

"All have inttypes.h, so just include it" does not say why it is a
good idea to do so, if the source before this patch built OK without
including it.

    Bad things like this and that happen because the current code
    does not include inttypes.h, but the header exists everywhere so
    we can fix this and that by including it.

would be more understandable, but otherwise, it is unclear what
problems it attempts to fix, and if it is an improvement overall to
trade it off with the possible breakage on some systems.

The log message also needs to explain why inclusion order in
git-compat-util.h must be changed.  What problem does that change
fix?

> Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
> ---
>  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 ba05044..59a50fc 100644
> --- a/compat/mingw.h
> +++ b/compat/mingw.h
> @@ -358,8 +358,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 fb41118..b338277 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 <inttypes.h>
> +#else
> +#include <stdint.h>
> +#endif
> +
>  #include <unistd.h>
>  #include <stdio.h>
>  #include <sys/stat.h>
> @@ -147,11 +153,6 @@
>  #include <netdb.h>
>  #include <pwd.h>
>  #include <sys/un.h>
> -#ifndef NO_INTTYPES_H
> -#include <inttypes.h>
> -#else
> -#include <stdint.h>
> -#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.

  reply	other threads:[~2014-10-08 19:25 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-08 18:00 [PATCH v5] MinGW(-W64) compilation Marat Radchenko
2014-10-08 18:00 ` [PATCH 01/14] MINGW: compat/mingw.h: do not attempt to redefine lseek on mingw-w64 Marat Radchenko
2014-10-09  1:01   ` Erik Faye-Lund
2014-10-08 18:00 ` [PATCH 02/14] MSVC: config.mak.uname: drop -D__USE_MINGW_ACCESS from CFLAGS Marat Radchenko
2014-10-08 18:00 ` [PATCH 03/14] MINGW: compat/mingw.h: drop fork() definition Marat Radchenko
2014-10-08 18:00 ` [PATCH 04/14] MINGW: do not fail at redefining pid_t on MinGW-W64 Marat Radchenko
2014-10-08 18:00 ` [PATCH 05/14] MINGW: config.mak.uname: allow using cURL for non-msysGit builds Marat Radchenko
2014-10-08 18:00 ` [PATCH 06/14] MINGW: compat/winansi.c: do not redefine CONSOLE_FONT_INFOEX Marat Radchenko
2014-10-08 18:01 ` [PATCH 07/14] Fix BASIC_LDFLAGS and COMPAT_CFLAGS for 64bit MinGW-w64 Marat Radchenko
2014-10-08 19:24   ` Junio C Hamano
2014-10-09 19:22   ` Johannes Schindelin
2014-10-09 19:25     ` [msysGit] " Ray Donnelly
2014-10-09 19:47       ` Johannes Schindelin
2014-10-09 23:56         ` Ray Donnelly
2014-10-10  6:38           ` Johannes Schindelin
2014-10-10 10:55             ` Johannes Schindelin
2014-10-11 11:12               ` Johannes Schindelin
     [not found]             ` <CAOYw7dtSdR8GVYK2YrVjgQ7ZRExHjPBLCNQk7vchV66fx27xBw@mail.gmail.com>
2014-10-11  9:11               ` Johannes Schindelin
2014-10-14  7:08     ` Marat Radchenko
2014-10-08 18:01 ` [PATCH 08/14] MINGW: git-compat-util.h: use inttypes.h for printf macros Marat Radchenko
2014-10-08 19:25   ` Junio C Hamano [this message]
2014-10-08 18:01 ` [PATCH 09/14] MINGW: config.mak.uname: reorganize MinGW settings Marat Radchenko
2014-10-08 18:01 ` [PATCH 10/14] Makefile: introduce CROSS_COMPILE variable Marat Radchenko
2014-10-08 19:25   ` Junio C Hamano
2014-10-08 18:01 ` [PATCH 11/14] compat/nedmalloc/malloc.c.h: fix compilation under MinGW-W64 Marat Radchenko
2014-10-08 18:01 ` [PATCH 12/14] Fix pointer -> integer casts on IL32P64 systems Marat Radchenko
2014-10-08 18:01 ` [PATCH 13/14] git-compat-util.h: fix integer overflow " Marat Radchenko
2014-10-08 19:22   ` Junio C Hamano
2014-10-08 20:02     ` Junio C Hamano
2014-10-09  5:05       ` Marat Radchenko
2014-10-09  7:31         ` Junio C Hamano
2014-10-09  6:08     ` Johannes Schindelin
2014-10-08 18:01 ` [PATCH 14/14] MINGW: config.mak.uname: auto-detect MinGW build from compiler Marat Radchenko
2014-10-08 19:26   ` Junio C Hamano
2014-10-09  5:03     ` Marat Radchenko
2014-10-09  7:04       ` Johannes Schindelin
2014-10-09  7:34       ` Junio C Hamano
2014-10-09  7:38         ` [msysGit] " Johannes Schindelin
     [not found]           ` <CAPc5daUo+Fw2Oh3LK+0HJCmtVjicYk62qiQ2v8h8pitYHAZL3w@mail.gmail.com>
2014-10-09 10:18             ` Johannes Schindelin
     [not found]               ` <CAPc5daWdkz16RnORjtjw+oP3PO043Y57wAMm3TxC6L5GBJz8uQ@mail.gmail.com>
2014-10-09 15:49                 ` Johannes Schindelin
2014-10-09  8:48         ` Marat Radchenko
2014-10-08 19:23 ` [PATCH v5] MinGW(-W64) compilation Junio C Hamano
2014-10-09 10:11 ` Johannes Schindelin
2014-10-09 10:39   ` Marat Radchenko
2014-10-09 10:59     ` Johannes Schindelin
  -- strict thread matches above, loose matches on Subject: below --
2014-09-30  7:02 [PATCH v4] " Marat Radchenko
2014-09-30  7:02 ` [PATCH 08/14] MINGW: git-compat-util.h: use inttypes.h for printf macros Marat Radchenko
2014-09-28 13:24 MinGW(-W64) compilation Marat Radchenko
2014-09-28 13:24 ` [PATCH 08/14] MINGW: git-compat-util.h: use inttypes.h for printf macros Marat Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq38ay9xdz.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=marat@slonopotamus.org \
    --cc=msysgit@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.