git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* MinGW(-W64) compilation
@ 2014-09-28 13:24 Marat Radchenko
  2014-09-28 13:24 ` [PATCH 01/14] MINGW: compat/mingw.h: do not attempt to redefine lseek on mingw-w64 Marat Radchenko
                   ` (14 more replies)
  0 siblings, 15 replies; 20+ messages in thread
From: Marat Radchenko @ 2014-09-28 13:24 UTC (permalink / raw)
  To: git; +Cc: marat, msysGit, Erik Faye-Lund

This patch series fixes building on modern MinGW and MinGW-W64 (including x86_64!).

*Compilation* tested on:
 - MSVC (via WinGit environment)
 - msysGit environment
 - Linux cross-toolchain i686-pc-mingw32
 - Linux cross-toolchain i686-w64-mingw32
 - Linux cross-toolchain x86_64-w64-mingw32

Attention: in order to build on MinGW-W64, you need to use 'sf/v3.x' branch
from MinGW-W64 repo because MinGW-W64 releases do not yet have a fix
for https://sourceforge.net/p/mingw-w64/bugs/397

Workaround that allows to also build on older MinGW-W64 is currently
pending [1] on gnulib ML. If it is accepted, same fix [2] can be applied
to Git copy of poll.c.

[1]: http://lists.gnu.org/archive/html/bug-gnulib/2014-09/msg00076.html
[2]: http://git.661346.n2.nabble.com/PATCH-v2-MinGW-W64-cross-compilation-tp7609085p7609093.html

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 01/14] MINGW: compat/mingw.h: do not attempt to redefine lseek on mingw-w64
  2014-09-28 13:24 MinGW(-W64) compilation Marat Radchenko
@ 2014-09-28 13:24 ` Marat Radchenko
  2014-09-28 13:24 ` [PATCH 02/14] MSVC: config.mak.uname: drop -D__USE_MINGW_ACCESS from CFLAGS Marat Radchenko
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Marat Radchenko @ 2014-09-28 13:24 UTC (permalink / raw)
  To: git; +Cc: marat, msysGit, Erik Faye-Lund

Unlike MinGW, MinGW-W64 has lseek already properly defined in io.h.

Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
Acked-by: Eric Faye-Lund <kusmabite@gmail.com>
---
 compat/mingw.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/compat/mingw.h b/compat/mingw.h
index df0e320..ed79368 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -281,7 +281,9 @@ static inline int getrlimit(int resource, struct rlimit *rlp)
  * Use mingw specific stat()/lstat()/fstat() implementations on Windows.
  */
 #define off_t off64_t
+#ifndef lseek
 #define lseek _lseeki64
+#endif
 
 /* use struct stat with 64 bit st_size */
 #ifdef stat
-- 
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.

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 02/14] MSVC: config.mak.uname: drop -D__USE_MINGW_ACCESS from CFLAGS
  2014-09-28 13:24 MinGW(-W64) compilation Marat Radchenko
  2014-09-28 13:24 ` [PATCH 01/14] MINGW: compat/mingw.h: do not attempt to redefine lseek on mingw-w64 Marat Radchenko
@ 2014-09-28 13:24 ` Marat Radchenko
  2014-09-28 13:24 ` [PATCH 03/14] MINGW: compat/mingw.h: drop fork() definition Marat Radchenko
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Marat Radchenko @ 2014-09-28 13:24 UTC (permalink / raw)
  To: git; +Cc: marat, msysGit, Erik Faye-Lund

-D__USE_MINGW_ACCESS only affects MinGW and does nothing when
MSVC is used.

Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
Acked-by: Eric Faye-Lund <kusmabite@gmail.com>
---
 config.mak.uname | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config.mak.uname b/config.mak.uname
index a2f380f..20cbdcf 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -368,7 +368,7 @@ ifeq ($(uname_S),Windows)
 	COMPAT_OBJS = compat/msvc.o compat/winansi.o \
 		compat/win32/pthread.o compat/win32/syslog.o \
 		compat/win32/dirent.o
-	COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
+	COMPAT_CFLAGS = -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
 	BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE
 	EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj
 	PTHREAD_LIBS =
-- 
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.

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 03/14] MINGW: compat/mingw.h: drop fork() definition
  2014-09-28 13:24 MinGW(-W64) compilation Marat Radchenko
  2014-09-28 13:24 ` [PATCH 01/14] MINGW: compat/mingw.h: do not attempt to redefine lseek on mingw-w64 Marat Radchenko
  2014-09-28 13:24 ` [PATCH 02/14] MSVC: config.mak.uname: drop -D__USE_MINGW_ACCESS from CFLAGS Marat Radchenko
@ 2014-09-28 13:24 ` Marat Radchenko
  2014-09-28 13:24 ` [PATCH 04/14] MINGW: do not fail at redefining pid_t on MinGW-W64 Marat Radchenko
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Marat Radchenko @ 2014-09-28 13:24 UTC (permalink / raw)
  To: git; +Cc: marat, msysGit, Erik Faye-Lund

fork() is not used in MinGW builds but causes a compiler warning
on x86_64 MinGW-W64: conflicting types for built-in function 'fork'

Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
Acked-by: Eric Faye-Lund <kusmabite@gmail.com>
---
 compat/mingw.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/compat/mingw.h b/compat/mingw.h
index ed79368..948a174 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -93,8 +93,6 @@ static inline int symlink(const char *oldpath, const char *newpath)
 { errno = ENOSYS; return -1; }
 static inline int fchmod(int fildes, mode_t mode)
 { errno = ENOSYS; return -1; }
-static inline pid_t fork(void)
-{ errno = ENOSYS; return -1; }
 static inline unsigned int alarm(unsigned int seconds)
 { return 0; }
 static inline int fsync(int fd)
-- 
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.

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 04/14] MINGW: do not fail at redefining pid_t on MinGW-W64
  2014-09-28 13:24 MinGW(-W64) compilation Marat Radchenko
                   ` (2 preceding siblings ...)
  2014-09-28 13:24 ` [PATCH 03/14] MINGW: compat/mingw.h: drop fork() definition Marat Radchenko
@ 2014-09-28 13:24 ` Marat Radchenko
  2014-09-28 13:24 ` [PATCH 05/14] MINGW: config.mak.uname: allow using cURL for non-msysGit builds Marat Radchenko
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Marat Radchenko @ 2014-09-28 13:24 UTC (permalink / raw)
  To: git; +Cc: marat, msysGit, Erik Faye-Lund

pid_t is available in sys/types.h on both MinGW and MinGW-W64

Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
Acked-by: Eric Faye-Lund <kusmabite@gmail.com>
---
 compat/mingw.h | 1 -
 compat/msvc.h  | 2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/compat/mingw.h b/compat/mingw.h
index 948a174..d113b19 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -5,7 +5,6 @@
  * things that are not available in header files
  */
 
-typedef int pid_t;
 typedef int uid_t;
 typedef int socklen_t;
 #define hstrerror strerror
diff --git a/compat/msvc.h b/compat/msvc.h
index 580bb55..a63d878 100644
--- a/compat/msvc.h
+++ b/compat/msvc.h
@@ -15,6 +15,8 @@
 #define strtoull     _strtoui64
 #define strtoll      _strtoi64
 
+typedef int pid_t;
+
 static __inline int strcasecmp (const char *s1, const char *s2)
 {
 	int size1 = strlen(s1);
-- 
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.

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 05/14] MINGW: config.mak.uname: allow using cURL for non-msysGit builds
  2014-09-28 13:24 MinGW(-W64) compilation Marat Radchenko
                   ` (3 preceding siblings ...)
  2014-09-28 13:24 ` [PATCH 04/14] MINGW: do not fail at redefining pid_t on MinGW-W64 Marat Radchenko
@ 2014-09-28 13:24 ` Marat Radchenko
  2014-09-28 13:24 ` [PATCH 06/14] MINGW: compat/winansi.c: do not redefine CONSOLE_FONT_INFOEX Marat Radchenko
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Marat Radchenko @ 2014-09-28 13:24 UTC (permalink / raw)
  To: git; +Cc: marat, msysGit, Erik Faye-Lund

Is it absolutely valid and possible to have cURL in generic
MinGW environment. Building Git without cURL is still possible
by passing NO_CURL=1

Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
Acked-by: Eric Faye-Lund <kusmabite@gmail.com>
---
 config.mak.uname | 2 --
 1 file changed, 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index 20cbdcf..324a7fc 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -531,8 +531,6 @@ ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
 	INTERNAL_QSORT = YesPlease
 	HAVE_LIBCHARSET_H = YesPlease
 	NO_GETTEXT = YesPlease
-else
-	NO_CURL = YesPlease
 endif
 endif
 ifeq ($(uname_S),QNX)
-- 
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.

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 06/14] MINGW: compat/winansi.c: do not redefine CONSOLE_FONT_INFOEX
  2014-09-28 13:24 MinGW(-W64) compilation Marat Radchenko
                   ` (4 preceding siblings ...)
  2014-09-28 13:24 ` [PATCH 05/14] MINGW: config.mak.uname: allow using cURL for non-msysGit builds Marat Radchenko
@ 2014-09-28 13:24 ` Marat Radchenko
  2014-09-28 13:24 ` [PATCH 07/14] Fix BASIC_LDFLAGS and COMPAT_CFLAGS for 64bit MinGW-w64 Marat Radchenko
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Marat Radchenko @ 2014-09-28 13:24 UTC (permalink / raw)
  To: git; +Cc: marat, msysGit, Erik Faye-Lund

Unlike MinGW, MinGW-W64 has CONSOLE_FONT_INFOEX already properly defined
in wincon.h.

Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
---
 compat/winansi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compat/winansi.c b/compat/winansi.c
index efc5bb3..0ac3297 100644
--- a/compat/winansi.c
+++ b/compat/winansi.c
@@ -22,7 +22,7 @@ static int non_ascii_used = 0;
 static HANDLE hthread, hread, hwrite;
 static HANDLE hconsole1, hconsole2;
 
-#ifdef __MINGW32__
+#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
 typedef struct _CONSOLE_FONT_INFOEX {
 	ULONG cbSize;
 	DWORD nFont;
-- 
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.

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 07/14] Fix BASIC_LDFLAGS and COMPAT_CFLAGS for 64bit MinGW-w64
  2014-09-28 13:24 MinGW(-W64) compilation Marat Radchenko
                   ` (5 preceding siblings ...)
  2014-09-28 13:24 ` [PATCH 06/14] MINGW: compat/winansi.c: do not redefine CONSOLE_FONT_INFOEX Marat Radchenko
@ 2014-09-28 13:24 ` Marat Radchenko
  2014-09-28 13:24 ` [PATCH 08/14] MINGW: git-compat-util.h: use inttypes.h for printf macros Marat Radchenko
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Marat Radchenko @ 2014-09-28 13:24 UTC (permalink / raw)
  To: git; +Cc: marat, msysGit, Erik Faye-Lund, Ray Donnelly

From: Ray Donnelly <mingw.android@gmail.com>

Signed-off-by: Ray Donnelly <mingw.android@gmail.com>
Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
---
 config.mak.uname | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index 324a7fc..4470a928 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -6,6 +6,7 @@ uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
 uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
 uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
 uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
+CC_MACH := $(shell sh -c '$(CC) -dumpmachine 2>/dev/null || echo not')
 
 ifdef MSVC
 	# avoid the MingW and Cygwin configuration sections
@@ -509,12 +510,15 @@ 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 -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32
+	COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/win32
+	ifneq (,$(findstring i686,$(CC_MACH)))
+		COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
+		BASIC_LDFLAGS += -Wl,--large-address-aware
+	endif
 	COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
 	COMPAT_OBJS += compat/mingw.o compat/winansi.o \
 		compat/win32/pthread.o compat/win32/syslog.o \
 		compat/win32/dirent.o
-	BASIC_LDFLAGS += -Wl,--large-address-aware
 	EXTLIBS += -lws2_32
 	GITLIBS += git.res
 	PTHREAD_LIBS =
-- 
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.

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 08/14] MINGW: git-compat-util.h: use inttypes.h for printf macros
  2014-09-28 13:24 MinGW(-W64) compilation Marat Radchenko
                   ` (6 preceding siblings ...)
  2014-09-28 13:24 ` [PATCH 07/14] Fix BASIC_LDFLAGS and COMPAT_CFLAGS for 64bit MinGW-w64 Marat Radchenko
@ 2014-09-28 13:24 ` Marat Radchenko
  2014-09-28 13:24 ` [PATCH 09/14] MINGW: config.mak.uname: reorganize MinGW settings Marat Radchenko
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Marat Radchenko @ 2014-09-28 13:24 UTC (permalink / raw)
  To: git; +Cc: marat, msysGit, Erik Faye-Lund

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

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 09/14] MINGW: config.mak.uname: reorganize MinGW settings
  2014-09-28 13:24 MinGW(-W64) compilation Marat Radchenko
                   ` (7 preceding siblings ...)
  2014-09-28 13:24 ` [PATCH 08/14] MINGW: git-compat-util.h: use inttypes.h for printf macros Marat Radchenko
@ 2014-09-28 13:24 ` Marat Radchenko
  2014-09-28 13:24 ` [PATCH 10/14] Makefile: introduce CROSS_COMPILE variable Marat Radchenko
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Marat Radchenko @ 2014-09-28 13:24 UTC (permalink / raw)
  To: git; +Cc: marat, msysGit, Erik Faye-Lund

HAVE_LIBCHARSET_H and NO_R_TO_GCC_LINKER are not specific to
msysGit, they're general MinGW settings.

Logic behind HAVE_LIBCHARSET_H: if user is on MinGW and has iconv,
we expect him to have libcharset.h. If user doesn't have iconv,
he has to explicitly say so via NO_ICONV=1 regardless of this
commit.

Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
---
 config.mak.uname | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index c7aaa1c..f79c0e0 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -532,11 +532,11 @@ ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
 	prefix =
 	INSTALL = /bin/install
 	EXTLIBS += /mingw/lib/libz.a
-	NO_R_TO_GCC_LINKER = YesPlease
 	INTERNAL_QSORT = YesPlease
-	HAVE_LIBCHARSET_H = YesPlease
 	NO_GETTEXT = YesPlease
 endif
+	HAVE_LIBCHARSET_H = YesPlease
+	NO_R_TO_GCC_LINKER = YesPlease
 endif
 ifeq ($(uname_S),QNX)
 	COMPAT_CFLAGS += -DSA_RESTART=0
-- 
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.

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 10/14] Makefile: introduce CROSS_COMPILE variable
  2014-09-28 13:24 MinGW(-W64) compilation Marat Radchenko
                   ` (8 preceding siblings ...)
  2014-09-28 13:24 ` [PATCH 09/14] MINGW: config.mak.uname: reorganize MinGW settings Marat Radchenko
@ 2014-09-28 13:24 ` Marat Radchenko
  2014-09-28 13:24 ` [PATCH 11/14] compat/nedmalloc/malloc.c.h: fix compilation under MinGW-W64 Marat Radchenko
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Marat Radchenko @ 2014-09-28 13:24 UTC (permalink / raw)
  To: git; +Cc: marat, msysGit, Erik Faye-Lund

To ease cross-compilation process, introduce a single variable
with the prefix to all compiler-related executables.

Define CROSS_COMPILE=foo- if your compiler and binary utilities
are foo-cc, foo-ar, foo-strip, etc.  More specific variables
override this, so if you set CC=gcc CROSS_COMPILE=ia64-linux-gnu-
then the compiler will be 'gcc', not 'ia64-linux-gnu-gcc'.

Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
---
 Makefile         | 19 +++++++++++++------
 config.mak.uname |  2 +-
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index f34a2d4..c412996 100644
--- a/Makefile
+++ b/Makefile
@@ -339,6 +339,11 @@ all::
 # return NULL when it receives a bogus time_t.
 #
 # Define HAVE_CLOCK_GETTIME if your platform has clock_gettime in librt.
+#
+# Define CROSS_COMPILE=foo- if your compiler and binary utilities
+# are foo-cc, foo-ar, foo-strip, etc.  More specific variables
+# override this, so if you set CC=gcc CROSS_COMPILE=ia64-linux-gnu-
+# then the compiler will be 'gcc', not 'ia64-linux-gnu-gcc'.
 
 GIT-VERSION-FILE: FORCE
 	@$(SHELL_PATH) ./GIT-VERSION-GEN
@@ -350,7 +355,6 @@ CFLAGS = -g -O2 -Wall
 LDFLAGS =
 ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
-STRIP ?= strip
 
 # Among the variables below, these:
 #   gitexecdir
@@ -390,8 +394,12 @@ htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))
 
 export prefix bindir sharedir sysconfdir gitwebdir localedir
 
-CC = cc
-AR = ar
+AR = $(CROSS_COMPILE)ar
+CC = $(CROSS_COMPILE)cc
+GCOV = $(CROSS_COMPILE)gcov
+RC = $(CROSS_COMPILE)windres
+STRIP = $(CROSS_COMPILE)strip
+
 RM = rm -f
 DIFF = diff
 TAR = tar
@@ -404,13 +412,12 @@ XGETTEXT = xgettext
 MSGFMT = msgfmt
 PTHREAD_LIBS = -lpthread
 PTHREAD_CFLAGS =
-GCOV = gcov
 
 export TCL_PATH TCLTK_PATH
 
 SPARSE_FLAGS =
 
-
+RCFLAGS =
 
 ### --- END CONFIGURATION SECTION ---
 
@@ -1669,7 +1676,7 @@ $(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
 	mv $@+ $@
 
 git.res: git.rc GIT-VERSION-FILE
-	$(QUIET_RC)$(RC) \
+	$(QUIET_RC)$(RC) $(RCFLAGS) \
 	  $(join -DMAJOR= -DMINOR=, $(wordlist 1,2,$(subst -, ,$(subst ., ,$(GIT_VERSION))))) \
 	  -DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" $< -o $@
 
diff --git a/config.mak.uname b/config.mak.uname
index f79c0e0..9f7037e 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -523,7 +523,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
 	EXTLIBS += -lws2_32
 	GITLIBS += git.res
 	PTHREAD_LIBS =
-	RC = windres -O coff
+	RCFLAGS += -O coff
 	NATIVE_CRLF = YesPlease
 	X = .exe
 	SPARSE_FLAGS = -Wno-one-bit-signed-bitfield
-- 
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.

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 11/14] compat/nedmalloc/malloc.c.h: fix compilation under MinGW-W64
  2014-09-28 13:24 MinGW(-W64) compilation Marat Radchenko
                   ` (9 preceding siblings ...)
  2014-09-28 13:24 ` [PATCH 10/14] Makefile: introduce CROSS_COMPILE variable Marat Radchenko
@ 2014-09-28 13:24 ` Marat Radchenko
  2014-09-28 13:24 ` [PATCH 12/14] Fix pointer -> integer casts on IL32P64 systems Marat Radchenko
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Marat Radchenko @ 2014-09-28 13:24 UTC (permalink / raw)
  To: git; +Cc: marat, msysGit, Erik Faye-Lund

1. Unlike MinGW, MinGW-W64 already provides _ReadWriteBarrier macro,
   so don't try to redefine it.

2. MinGW-W64 has a strange definition FORCEINLINE as
   extern __inline__ __attribute__((__always_inline__,__gnu_inline__))

   'extern' doesn't work together with 'static', so #undef MinGW-W64
   version of FORCEINLINE.

Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
---
 compat/nedmalloc/malloc.c.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/compat/nedmalloc/malloc.c.h b/compat/nedmalloc/malloc.c.h
index f216a2a..a6c8cac 100644
--- a/compat/nedmalloc/malloc.c.h
+++ b/compat/nedmalloc/malloc.c.h
@@ -715,6 +715,10 @@ struct mallinfo {
 #endif /* HAVE_USR_INCLUDE_MALLOC_H */
 #endif /* NO_MALLINFO */
 
+#ifdef __MINGW64_VERSION_MAJOR
+  #undef FORCEINLINE
+#endif
+
 /*
   Try to persuade compilers to inline. The most critical functions for
   inlining are defined as macros, so these aren't used for them.
@@ -1382,7 +1386,9 @@ LONG __cdecl _InterlockedExchange(LONG volatile *Target, LONG Value);
 
   /*** Atomic operations ***/
   #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100
-    #define _ReadWriteBarrier() __sync_synchronize()
+    #ifndef _ReadWriteBarrier
+      #define _ReadWriteBarrier() __sync_synchronize()
+    #endif
   #else
     static __inline__ __attribute__((always_inline)) long __sync_lock_test_and_set(volatile long * const Target, const long Value)
     {
-- 
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.

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 12/14] Fix pointer -> integer casts on IL32P64 systems
  2014-09-28 13:24 MinGW(-W64) compilation Marat Radchenko
                   ` (10 preceding siblings ...)
  2014-09-28 13:24 ` [PATCH 11/14] compat/nedmalloc/malloc.c.h: fix compilation under MinGW-W64 Marat Radchenko
@ 2014-09-28 13:24 ` Marat Radchenko
  2014-09-29 20:43   ` Johannes Sixt
  2014-09-28 13:24 ` [PATCH 13/14] git-compat-util.h: fix integer overflow " Marat Radchenko
                   ` (2 subsequent siblings)
  14 siblings, 1 reply; 20+ messages in thread
From: Marat Radchenko @ 2014-09-28 13:24 UTC (permalink / raw)
  To: git; +Cc: marat, msysGit, Erik Faye-Lund

This commit touches regcomp.c and poll.c from Gnulib,
both were fixed upstream in 2012 the same way.

Wrt ShellExecute, see [1].

[1]: http://blogs.msdn.com/b/oldnewthing/archive/2006/11/08/1035971.aspx

Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
---
 compat/mingw.c         | 8 ++++----
 compat/poll/poll.c     | 2 +-
 compat/regex/regcomp.c | 4 ++--
 compat/win32/pthread.h | 2 +-
 compat/winansi.c       | 2 +-
 pack-revindex.c        | 2 +-
 sha1_file.c            | 8 ++++----
 7 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index c5c37e5..27925d9 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -674,13 +674,13 @@ int pipe(int filedes[2])
 		errno = err_win_to_posix(GetLastError());
 		return -1;
 	}
-	filedes[0] = _open_osfhandle((int)h[0], O_NOINHERIT);
+	filedes[0] = _open_osfhandle((intptr_t)h[0], O_NOINHERIT);
 	if (filedes[0] < 0) {
 		CloseHandle(h[0]);
 		CloseHandle(h[1]);
 		return -1;
 	}
-	filedes[1] = _open_osfhandle((int)h[1], O_NOINHERIT);
+	filedes[1] = _open_osfhandle((intptr_t)h[1], O_NOINHERIT);
 	if (filedes[0] < 0) {
 		close(filedes[0]);
 		CloseHandle(h[1]);
@@ -1819,7 +1819,7 @@ void mingw_open_html(const char *unixpath)
 			const char *, const char *, const char *, INT);
 	T ShellExecute;
 	HMODULE shell32;
-	int r;
+	intptr_t r;
 
 	shell32 = LoadLibrary("shell32.dll");
 	if (!shell32)
@@ -1829,7 +1829,7 @@ void mingw_open_html(const char *unixpath)
 		die("cannot run browser");
 
 	printf("Launching default browser to display HTML ...\n");
-	r = (int)ShellExecute(NULL, "open", htmlpath, NULL, "\\", SW_SHOWNORMAL);
+	r = (intptr_t)ShellExecute(NULL, "open", htmlpath, NULL, "\\", SW_SHOWNORMAL);
 	FreeLibrary(shell32);
 	/* see the MSDN documentation referring to the result codes here */
 	if (r <= 32) {
diff --git a/compat/poll/poll.c b/compat/poll/poll.c
index a9b41d8..8941249 100644
--- a/compat/poll/poll.c
+++ b/compat/poll/poll.c
@@ -76,7 +76,7 @@
 
 #ifdef WIN32_NATIVE
 
-#define IsConsoleHandle(h) (((long) (h) & 3) == 3)
+#define IsConsoleHandle(h) (((intptr_t) (h) & 3) == 3)
 
 static BOOL
 IsSocketHandle (HANDLE h)
diff --git a/compat/regex/regcomp.c b/compat/regex/regcomp.c
index 06f3088..d8bde06 100644
--- a/compat/regex/regcomp.c
+++ b/compat/regex/regcomp.c
@@ -2577,7 +2577,7 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
     old_tree = NULL;
 
   if (elem->token.type == SUBEXP)
-    postorder (elem, mark_opt_subexp, (void *) (long) elem->token.opr.idx);
+    postorder (elem, mark_opt_subexp, (void *) (intptr_t) elem->token.opr.idx);
 
   tree = create_tree (dfa, elem, NULL, (end == -1 ? OP_DUP_ASTERISK : OP_ALT));
   if (BE (tree == NULL, 0))
@@ -3806,7 +3806,7 @@ create_token_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right,
 static reg_errcode_t
 mark_opt_subexp (void *extra, bin_tree_t *node)
 {
-  int idx = (int) (long) extra;
+  int idx = (int) (intptr_t) extra;
   if (node->token.type == SUBEXP && node->token.opr.idx == idx)
     node->token.opt_subexp = 1;
 
diff --git a/compat/win32/pthread.h b/compat/win32/pthread.h
index 8ad1873..6ccfb7b 100644
--- a/compat/win32/pthread.h
+++ b/compat/win32/pthread.h
@@ -77,7 +77,7 @@ extern pthread_t pthread_self(void);
 
 static inline int pthread_exit(void *ret)
 {
-	ExitThread((DWORD)ret);
+	ExitThread((DWORD)(uintptr_t)ret);
 }
 
 typedef DWORD pthread_key_t;
diff --git a/compat/winansi.c b/compat/winansi.c
index 0ac3297..ca4c295 100644
--- a/compat/winansi.c
+++ b/compat/winansi.c
@@ -452,7 +452,7 @@ static HANDLE duplicate_handle(HANDLE hnd)
 	HANDLE hresult, hproc = GetCurrentProcess();
 	if (!DuplicateHandle(hproc, hnd, hproc, &hresult, 0, TRUE,
 			DUPLICATE_SAME_ACCESS))
-		die_lasterr("DuplicateHandle(%li) failed", (long) hnd);
+		die_lasterr("DuplicateHandle(%p) failed", hnd);
 	return hresult;
 }
 
diff --git a/pack-revindex.c b/pack-revindex.c
index 5c8376e..df02e9f 100644
--- a/pack-revindex.c
+++ b/pack-revindex.c
@@ -21,7 +21,7 @@ static int pack_revindex_hashsz;
 
 static int pack_revindex_ix(struct packed_git *p)
 {
-	unsigned long ui = (unsigned long)p;
+	uintptr_t ui = (uintptr_t)p;
 	int i;
 
 	ui = ui ^ (ui >> 16); /* defeat structure alignment */
diff --git a/sha1_file.c b/sha1_file.c
index c08c0cb..a534fda 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1966,11 +1966,11 @@ static struct delta_base_cache_entry {
 	enum object_type type;
 } delta_base_cache[MAX_DELTA_CACHE];
 
-static unsigned long pack_entry_hash(struct packed_git *p, off_t base_offset)
+static uintptr_t pack_entry_hash(struct packed_git *p, off_t base_offset)
 {
-	unsigned long hash;
+	uintptr_t hash;
 
-	hash = (unsigned long)p + (unsigned long)base_offset;
+	hash = (uintptr_t)p + base_offset;
 	hash += (hash >> 8) + (hash >> 16);
 	return hash % MAX_DELTA_CACHE;
 }
@@ -1978,7 +1978,7 @@ static unsigned long pack_entry_hash(struct packed_git *p, off_t base_offset)
 static struct delta_base_cache_entry *
 get_delta_base_cache_entry(struct packed_git *p, off_t base_offset)
 {
-	unsigned long hash = pack_entry_hash(p, base_offset);
+	uintptr_t hash = pack_entry_hash(p, base_offset);
 	return delta_base_cache + hash;
 }
 
-- 
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.

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 13/14] git-compat-util.h: fix integer overflow on IL32P64 systems
  2014-09-28 13:24 MinGW(-W64) compilation Marat Radchenko
                   ` (11 preceding siblings ...)
  2014-09-28 13:24 ` [PATCH 12/14] Fix pointer -> integer casts on IL32P64 systems Marat Radchenko
@ 2014-09-28 13:24 ` Marat Radchenko
  2014-09-28 13:24 ` [PATCH 14/14] MINGW: config.mak.uname: auto-detect MinGW build from compiler Marat Radchenko
  2014-09-28 20:55 ` MinGW(-W64) compilation Johannes Schindelin
  14 siblings, 0 replies; 20+ messages in thread
From: Marat Radchenko @ 2014-09-28 13:24 UTC (permalink / raw)
  To: git; +Cc: marat, msysGit, Erik Faye-Lund

Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
---
 git-compat-util.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-compat-util.h b/git-compat-util.h
index 9d2d5ab..5f6659c 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -474,7 +474,7 @@ extern int git_munmap(void *start, size_t length);
 #endif
 
 #define DEFAULT_PACKED_GIT_LIMIT \
-	((1024L * 1024L) * (sizeof(void*) >= 8 ? 8192 : 256))
+	((size_t)(1024L * 1024L) * (sizeof(void*) >= 8 ? 8192 : 256))
 
 #ifdef NO_PREAD
 #define pread git_pread
-- 
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.

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 14/14] MINGW: config.mak.uname: auto-detect MinGW build from compiler
  2014-09-28 13:24 MinGW(-W64) compilation Marat Radchenko
                   ` (12 preceding siblings ...)
  2014-09-28 13:24 ` [PATCH 13/14] git-compat-util.h: fix integer overflow " Marat Radchenko
@ 2014-09-28 13:24 ` Marat Radchenko
  2014-09-28 20:55 ` MinGW(-W64) compilation Johannes Schindelin
  14 siblings, 0 replies; 20+ messages in thread
From: Marat Radchenko @ 2014-09-28 13:24 UTC (permalink / raw)
  To: git; +Cc: marat, msysGit, Erik Faye-Lund

When crosscompiling, one cannot rely on `uname` from host system.

Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
---
 config.mak.uname | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/config.mak.uname b/config.mak.uname
index 9f7037e..182da50 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -14,6 +14,11 @@ ifdef MSVC
 	uname_O := Windows
 endif
 
+ifneq (,$(findstring mingw,$(CC_MACH)))
+	uname_S := MINGW
+	uname_O := MINGW
+endif
+
 # We choose to avoid "if .. else if .. else .. endif endif"
 # because maintaining the nesting to match is a pain.  If
 # we had "elif" things would have been much nicer...
-- 
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.

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: MinGW(-W64) compilation
  2014-09-28 13:24 MinGW(-W64) compilation Marat Radchenko
                   ` (13 preceding siblings ...)
  2014-09-28 13:24 ` [PATCH 14/14] MINGW: config.mak.uname: auto-detect MinGW build from compiler Marat Radchenko
@ 2014-09-28 20:55 ` Johannes Schindelin
  14 siblings, 0 replies; 20+ messages in thread
From: Johannes Schindelin @ 2014-09-28 20:55 UTC (permalink / raw)
  To: Marat Radchenko; +Cc: git, msysGit, Erik Faye-Lund

Hi Marat,

On Sun, 28 Sep 2014, Marat Radchenko wrote:

> This patch series fixes building on modern MinGW and MinGW-W64
> (including x86_64!).

Awesome work! I'll have a look at it as soon as I can!

Ciao,
Johannes

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 12/14] Fix pointer -> integer casts on IL32P64 systems
  2014-09-28 13:24 ` [PATCH 12/14] Fix pointer -> integer casts on IL32P64 systems Marat Radchenko
@ 2014-09-29 20:43   ` Johannes Sixt
  2014-09-30  6:29     ` Marat Radchenko
  0 siblings, 1 reply; 20+ messages in thread
From: Johannes Sixt @ 2014-09-29 20:43 UTC (permalink / raw)
  To: Marat Radchenko; +Cc: git, msysGit, Erik Faye-Lund

Am 28.09.2014 um 15:24 schrieb Marat Radchenko:
> This commit touches regcomp.c and poll.c from Gnulib,
> both were fixed upstream in 2012 the same way.
> 
> Wrt ShellExecute, see [1].
> 
> [1]: http://blogs.msdn.com/b/oldnewthing/archive/2006/11/08/1035971.aspx

Please do not force readers to visit a web site; provide at least a summary.

> 
> Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
> ---

> diff --git a/compat/regex/regcomp.c b/compat/regex/regcomp.c
> index 06f3088..d8bde06 100644
> --- a/compat/regex/regcomp.c
> +++ b/compat/regex/regcomp.c
> @@ -2577,7 +2577,7 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
>      old_tree = NULL;
>  
>    if (elem->token.type == SUBEXP)
> -    postorder (elem, mark_opt_subexp, (void *) (long) elem->token.opr.idx);
> +    postorder (elem, mark_opt_subexp, (void *) (intptr_t) elem->token.opr.idx);
>  
>    tree = create_tree (dfa, elem, NULL, (end == -1 ? OP_DUP_ASTERISK : OP_ALT));
>    if (BE (tree == NULL, 0))
> @@ -3806,7 +3806,7 @@ create_token_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right,
>  static reg_errcode_t
>  mark_opt_subexp (void *extra, bin_tree_t *node)
>  {
> -  int idx = (int) (long) extra;
> +  int idx = (int) (intptr_t) extra;
>    if (node->token.type == SUBEXP && node->token.opr.idx == idx)
>      node->token.opt_subexp = 1;
>  

This breaks with

In file included from compat/regex/regex.c:77:
compat/regex/regcomp.c: In function 'parse_dup_op':
compat/regex/regcomp.c:2580: error: 'intptr_t' undeclared (first use in
this function)

when compiled using the msysgit environment.

-- Hannes

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 12/14] Fix pointer -> integer casts on IL32P64 systems
  2014-09-29 20:43   ` Johannes Sixt
@ 2014-09-30  6:29     ` Marat Radchenko
  0 siblings, 0 replies; 20+ messages in thread
From: Marat Radchenko @ 2014-09-30  6:29 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git, msysGit, Erik Faye-Lund, marat

On Mon, Sep 29, 2014 at 10:43:41PM +0200, Johannes Sixt wrote:
> Am 28.09.2014 um 15:24 schrieb Marat Radchenko:
> > This commit touches regcomp.c and poll.c from Gnulib,
> > both were fixed upstream in 2012 the same way.
> > 
> > Wrt ShellExecute, see [1].
> > 
> > [1]: http://blogs.msdn.com/b/oldnewthing/archive/2006/11/08/1035971.aspx
> 
> Please do not force readers to visit a web site; provide at least a summary.

No problem, will expand commit message.

> This breaks with
> 
> In file included from compat/regex/regex.c:77:
> compat/regex/regcomp.c: In function 'parse_dup_op':
> compat/regex/regcomp.c:2580: error: 'intptr_t' undeclared (first use in
> this function)
> 
> when compiled using the msysgit environment.

Aargh! No idea how this slipped through. Will reroll.

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 12/14] Fix pointer -> integer casts on IL32P64 systems
  2014-09-30  7:02 [PATCH v4] " Marat Radchenko
@ 2014-09-30  7:02 ` Marat Radchenko
  0 siblings, 0 replies; 20+ messages in thread
From: Marat Radchenko @ 2014-09-30  7:02 UTC (permalink / raw)
  To: git; +Cc: marat, msysGit

This commit touches regcomp.c and poll.c from Gnulib,
both were fixed upstream in 2012 the same way.

Also, this commit touches regex_internal.h from Gnulib,
which was fixed upstream in 2005.

Wrt ShellExecute in winansi.c, quoting [1]:

  MSDN says you can cast the result to an integer and compare the result
  against 32... You could cast in the other direction, comparing the return
  value against (HINSTANCE)32... Or you could cast the result to an INT_PTR
  and compare the result against 32.

We use the third option: cast HINSTANCE to intptr_t.

[1]: http://blogs.msdn.com/b/oldnewthing/archive/2006/11/08/1035971.aspx

Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
---
 compat/mingw.c                | 8 ++++----
 compat/poll/poll.c            | 2 +-
 compat/regex/regcomp.c        | 4 ++--
 compat/regex/regex_internal.h | 1 +
 compat/win32/pthread.h        | 2 +-
 compat/winansi.c              | 2 +-
 pack-revindex.c               | 2 +-
 sha1_file.c                   | 8 ++++----
 8 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index c5c37e5..27925d9 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -674,13 +674,13 @@ int pipe(int filedes[2])
 		errno = err_win_to_posix(GetLastError());
 		return -1;
 	}
-	filedes[0] = _open_osfhandle((int)h[0], O_NOINHERIT);
+	filedes[0] = _open_osfhandle((intptr_t)h[0], O_NOINHERIT);
 	if (filedes[0] < 0) {
 		CloseHandle(h[0]);
 		CloseHandle(h[1]);
 		return -1;
 	}
-	filedes[1] = _open_osfhandle((int)h[1], O_NOINHERIT);
+	filedes[1] = _open_osfhandle((intptr_t)h[1], O_NOINHERIT);
 	if (filedes[0] < 0) {
 		close(filedes[0]);
 		CloseHandle(h[1]);
@@ -1819,7 +1819,7 @@ void mingw_open_html(const char *unixpath)
 			const char *, const char *, const char *, INT);
 	T ShellExecute;
 	HMODULE shell32;
-	int r;
+	intptr_t r;
 
 	shell32 = LoadLibrary("shell32.dll");
 	if (!shell32)
@@ -1829,7 +1829,7 @@ void mingw_open_html(const char *unixpath)
 		die("cannot run browser");
 
 	printf("Launching default browser to display HTML ...\n");
-	r = (int)ShellExecute(NULL, "open", htmlpath, NULL, "\\", SW_SHOWNORMAL);
+	r = (intptr_t)ShellExecute(NULL, "open", htmlpath, NULL, "\\", SW_SHOWNORMAL);
 	FreeLibrary(shell32);
 	/* see the MSDN documentation referring to the result codes here */
 	if (r <= 32) {
diff --git a/compat/poll/poll.c b/compat/poll/poll.c
index a9b41d8..8941249 100644
--- a/compat/poll/poll.c
+++ b/compat/poll/poll.c
@@ -76,7 +76,7 @@
 
 #ifdef WIN32_NATIVE
 
-#define IsConsoleHandle(h) (((long) (h) & 3) == 3)
+#define IsConsoleHandle(h) (((intptr_t) (h) & 3) == 3)
 
 static BOOL
 IsSocketHandle (HANDLE h)
diff --git a/compat/regex/regcomp.c b/compat/regex/regcomp.c
index 06f3088..d8bde06 100644
--- a/compat/regex/regcomp.c
+++ b/compat/regex/regcomp.c
@@ -2577,7 +2577,7 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
     old_tree = NULL;
 
   if (elem->token.type == SUBEXP)
-    postorder (elem, mark_opt_subexp, (void *) (long) elem->token.opr.idx);
+    postorder (elem, mark_opt_subexp, (void *) (intptr_t) elem->token.opr.idx);
 
   tree = create_tree (dfa, elem, NULL, (end == -1 ? OP_DUP_ASTERISK : OP_ALT));
   if (BE (tree == NULL, 0))
@@ -3806,7 +3806,7 @@ create_token_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right,
 static reg_errcode_t
 mark_opt_subexp (void *extra, bin_tree_t *node)
 {
-  int idx = (int) (long) extra;
+  int idx = (int) (intptr_t) extra;
   if (node->token.type == SUBEXP && node->token.opr.idx == idx)
     node->token.opt_subexp = 1;
 
diff --git a/compat/regex/regex_internal.h b/compat/regex/regex_internal.h
index 4184d7f..da12670 100644
--- a/compat/regex/regex_internal.h
+++ b/compat/regex/regex_internal.h
@@ -26,6 +26,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <stdint.h>
 
 #if defined HAVE_LANGINFO_H || defined HAVE_LANGINFO_CODESET || defined _LIBC
 # include <langinfo.h>
diff --git a/compat/win32/pthread.h b/compat/win32/pthread.h
index 8ad1873..6ccfb7b 100644
--- a/compat/win32/pthread.h
+++ b/compat/win32/pthread.h
@@ -77,7 +77,7 @@ extern pthread_t pthread_self(void);
 
 static inline int pthread_exit(void *ret)
 {
-	ExitThread((DWORD)ret);
+	ExitThread((DWORD)(uintptr_t)ret);
 }
 
 typedef DWORD pthread_key_t;
diff --git a/compat/winansi.c b/compat/winansi.c
index 0ac3297..ca4c295 100644
--- a/compat/winansi.c
+++ b/compat/winansi.c
@@ -452,7 +452,7 @@ static HANDLE duplicate_handle(HANDLE hnd)
 	HANDLE hresult, hproc = GetCurrentProcess();
 	if (!DuplicateHandle(hproc, hnd, hproc, &hresult, 0, TRUE,
 			DUPLICATE_SAME_ACCESS))
-		die_lasterr("DuplicateHandle(%li) failed", (long) hnd);
+		die_lasterr("DuplicateHandle(%p) failed", hnd);
 	return hresult;
 }
 
diff --git a/pack-revindex.c b/pack-revindex.c
index 5c8376e..df02e9f 100644
--- a/pack-revindex.c
+++ b/pack-revindex.c
@@ -21,7 +21,7 @@ static int pack_revindex_hashsz;
 
 static int pack_revindex_ix(struct packed_git *p)
 {
-	unsigned long ui = (unsigned long)p;
+	uintptr_t ui = (uintptr_t)p;
 	int i;
 
 	ui = ui ^ (ui >> 16); /* defeat structure alignment */
diff --git a/sha1_file.c b/sha1_file.c
index c08c0cb..a534fda 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1966,11 +1966,11 @@ static struct delta_base_cache_entry {
 	enum object_type type;
 } delta_base_cache[MAX_DELTA_CACHE];
 
-static unsigned long pack_entry_hash(struct packed_git *p, off_t base_offset)
+static uintptr_t pack_entry_hash(struct packed_git *p, off_t base_offset)
 {
-	unsigned long hash;
+	uintptr_t hash;
 
-	hash = (unsigned long)p + (unsigned long)base_offset;
+	hash = (uintptr_t)p + base_offset;
 	hash += (hash >> 8) + (hash >> 16);
 	return hash % MAX_DELTA_CACHE;
 }
@@ -1978,7 +1978,7 @@ static unsigned long pack_entry_hash(struct packed_git *p, off_t base_offset)
 static struct delta_base_cache_entry *
 get_delta_base_cache_entry(struct packed_git *p, off_t base_offset)
 {
-	unsigned long hash = pack_entry_hash(p, base_offset);
+	uintptr_t hash = pack_entry_hash(p, base_offset);
 	return delta_base_cache + hash;
 }
 
-- 
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.

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 12/14] Fix pointer -> integer casts on IL32P64 systems
  2014-10-08 18:00 [PATCH v5] MinGW(-W64) compilation Marat Radchenko
@ 2014-10-08 18:01 ` Marat Radchenko
  0 siblings, 0 replies; 20+ messages in thread
From: Marat Radchenko @ 2014-10-08 18:01 UTC (permalink / raw)
  To: git; +Cc: marat, msysGit

This commit touches regcomp.c from Gnulib,
was fixed upstream in 3a4836d1.

This commit also touches poll.c from Gnulib,
was fixed upstream in d295f6c5.

This commit also touches regex_internal.h from Gnulib,
was fixed upstream in 8335a4d6.

Wrt ShellExecute in winansi.c, quoting [1]:

  MSDN says you can cast the result to an integer and compare the result
  against 32... You could cast in the other direction, comparing the return
  value against (HINSTANCE)32... Or you could cast the result to an INT_PTR
  and compare the result against 32.

We use the third option: cast HINSTANCE to intptr_t.

[1]: http://blogs.msdn.com/b/oldnewthing/archive/2006/11/08/1035971.aspx

Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
---
 compat/mingw.c                | 8 ++++----
 compat/poll/poll.c            | 2 +-
 compat/regex/regcomp.c        | 4 ++--
 compat/regex/regex_internal.h | 1 +
 compat/win32/pthread.h        | 2 +-
 compat/winansi.c              | 2 +-
 pack-revindex.c               | 2 +-
 sha1_file.c                   | 8 ++++----
 8 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index c5c37e5..27925d9 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -674,13 +674,13 @@ int pipe(int filedes[2])
 		errno = err_win_to_posix(GetLastError());
 		return -1;
 	}
-	filedes[0] = _open_osfhandle((int)h[0], O_NOINHERIT);
+	filedes[0] = _open_osfhandle((intptr_t)h[0], O_NOINHERIT);
 	if (filedes[0] < 0) {
 		CloseHandle(h[0]);
 		CloseHandle(h[1]);
 		return -1;
 	}
-	filedes[1] = _open_osfhandle((int)h[1], O_NOINHERIT);
+	filedes[1] = _open_osfhandle((intptr_t)h[1], O_NOINHERIT);
 	if (filedes[0] < 0) {
 		close(filedes[0]);
 		CloseHandle(h[1]);
@@ -1819,7 +1819,7 @@ void mingw_open_html(const char *unixpath)
 			const char *, const char *, const char *, INT);
 	T ShellExecute;
 	HMODULE shell32;
-	int r;
+	intptr_t r;
 
 	shell32 = LoadLibrary("shell32.dll");
 	if (!shell32)
@@ -1829,7 +1829,7 @@ void mingw_open_html(const char *unixpath)
 		die("cannot run browser");
 
 	printf("Launching default browser to display HTML ...\n");
-	r = (int)ShellExecute(NULL, "open", htmlpath, NULL, "\\", SW_SHOWNORMAL);
+	r = (intptr_t)ShellExecute(NULL, "open", htmlpath, NULL, "\\", SW_SHOWNORMAL);
 	FreeLibrary(shell32);
 	/* see the MSDN documentation referring to the result codes here */
 	if (r <= 32) {
diff --git a/compat/poll/poll.c b/compat/poll/poll.c
index a9b41d8..8941249 100644
--- a/compat/poll/poll.c
+++ b/compat/poll/poll.c
@@ -76,7 +76,7 @@
 
 #ifdef WIN32_NATIVE
 
-#define IsConsoleHandle(h) (((long) (h) & 3) == 3)
+#define IsConsoleHandle(h) (((intptr_t) (h) & 3) == 3)
 
 static BOOL
 IsSocketHandle (HANDLE h)
diff --git a/compat/regex/regcomp.c b/compat/regex/regcomp.c
index 06f3088..d8bde06 100644
--- a/compat/regex/regcomp.c
+++ b/compat/regex/regcomp.c
@@ -2577,7 +2577,7 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
     old_tree = NULL;
 
   if (elem->token.type == SUBEXP)
-    postorder (elem, mark_opt_subexp, (void *) (long) elem->token.opr.idx);
+    postorder (elem, mark_opt_subexp, (void *) (intptr_t) elem->token.opr.idx);
 
   tree = create_tree (dfa, elem, NULL, (end == -1 ? OP_DUP_ASTERISK : OP_ALT));
   if (BE (tree == NULL, 0))
@@ -3806,7 +3806,7 @@ create_token_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right,
 static reg_errcode_t
 mark_opt_subexp (void *extra, bin_tree_t *node)
 {
-  int idx = (int) (long) extra;
+  int idx = (int) (intptr_t) extra;
   if (node->token.type == SUBEXP && node->token.opr.idx == idx)
     node->token.opt_subexp = 1;
 
diff --git a/compat/regex/regex_internal.h b/compat/regex/regex_internal.h
index 4184d7f..da12670 100644
--- a/compat/regex/regex_internal.h
+++ b/compat/regex/regex_internal.h
@@ -26,6 +26,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <stdint.h>
 
 #if defined HAVE_LANGINFO_H || defined HAVE_LANGINFO_CODESET || defined _LIBC
 # include <langinfo.h>
diff --git a/compat/win32/pthread.h b/compat/win32/pthread.h
index 8ad1873..6ccfb7b 100644
--- a/compat/win32/pthread.h
+++ b/compat/win32/pthread.h
@@ -77,7 +77,7 @@ extern pthread_t pthread_self(void);
 
 static inline int pthread_exit(void *ret)
 {
-	ExitThread((DWORD)ret);
+	ExitThread((DWORD)(uintptr_t)ret);
 }
 
 typedef DWORD pthread_key_t;
diff --git a/compat/winansi.c b/compat/winansi.c
index 0ac3297..ca4c295 100644
--- a/compat/winansi.c
+++ b/compat/winansi.c
@@ -452,7 +452,7 @@ static HANDLE duplicate_handle(HANDLE hnd)
 	HANDLE hresult, hproc = GetCurrentProcess();
 	if (!DuplicateHandle(hproc, hnd, hproc, &hresult, 0, TRUE,
 			DUPLICATE_SAME_ACCESS))
-		die_lasterr("DuplicateHandle(%li) failed", (long) hnd);
+		die_lasterr("DuplicateHandle(%p) failed", hnd);
 	return hresult;
 }
 
diff --git a/pack-revindex.c b/pack-revindex.c
index 5c8376e..df02e9f 100644
--- a/pack-revindex.c
+++ b/pack-revindex.c
@@ -21,7 +21,7 @@ static int pack_revindex_hashsz;
 
 static int pack_revindex_ix(struct packed_git *p)
 {
-	unsigned long ui = (unsigned long)p;
+	uintptr_t ui = (uintptr_t)p;
 	int i;
 
 	ui = ui ^ (ui >> 16); /* defeat structure alignment */
diff --git a/sha1_file.c b/sha1_file.c
index c08c0cb..a534fda 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1966,11 +1966,11 @@ static struct delta_base_cache_entry {
 	enum object_type type;
 } delta_base_cache[MAX_DELTA_CACHE];
 
-static unsigned long pack_entry_hash(struct packed_git *p, off_t base_offset)
+static uintptr_t pack_entry_hash(struct packed_git *p, off_t base_offset)
 {
-	unsigned long hash;
+	uintptr_t hash;
 
-	hash = (unsigned long)p + (unsigned long)base_offset;
+	hash = (uintptr_t)p + base_offset;
 	hash += (hash >> 8) + (hash >> 16);
 	return hash % MAX_DELTA_CACHE;
 }
@@ -1978,7 +1978,7 @@ static unsigned long pack_entry_hash(struct packed_git *p, off_t base_offset)
 static struct delta_base_cache_entry *
 get_delta_base_cache_entry(struct packed_git *p, off_t base_offset)
 {
-	unsigned long hash = pack_entry_hash(p, base_offset);
+	uintptr_t hash = pack_entry_hash(p, base_offset);
 	return delta_base_cache + hash;
 }
 
-- 
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.

^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2014-10-08 18:15 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-28 13:24 MinGW(-W64) compilation Marat Radchenko
2014-09-28 13:24 ` [PATCH 01/14] MINGW: compat/mingw.h: do not attempt to redefine lseek on mingw-w64 Marat Radchenko
2014-09-28 13:24 ` [PATCH 02/14] MSVC: config.mak.uname: drop -D__USE_MINGW_ACCESS from CFLAGS Marat Radchenko
2014-09-28 13:24 ` [PATCH 03/14] MINGW: compat/mingw.h: drop fork() definition Marat Radchenko
2014-09-28 13:24 ` [PATCH 04/14] MINGW: do not fail at redefining pid_t on MinGW-W64 Marat Radchenko
2014-09-28 13:24 ` [PATCH 05/14] MINGW: config.mak.uname: allow using cURL for non-msysGit builds Marat Radchenko
2014-09-28 13:24 ` [PATCH 06/14] MINGW: compat/winansi.c: do not redefine CONSOLE_FONT_INFOEX Marat Radchenko
2014-09-28 13:24 ` [PATCH 07/14] Fix BASIC_LDFLAGS and COMPAT_CFLAGS for 64bit MinGW-w64 Marat Radchenko
2014-09-28 13:24 ` [PATCH 08/14] MINGW: git-compat-util.h: use inttypes.h for printf macros Marat Radchenko
2014-09-28 13:24 ` [PATCH 09/14] MINGW: config.mak.uname: reorganize MinGW settings Marat Radchenko
2014-09-28 13:24 ` [PATCH 10/14] Makefile: introduce CROSS_COMPILE variable Marat Radchenko
2014-09-28 13:24 ` [PATCH 11/14] compat/nedmalloc/malloc.c.h: fix compilation under MinGW-W64 Marat Radchenko
2014-09-28 13:24 ` [PATCH 12/14] Fix pointer -> integer casts on IL32P64 systems Marat Radchenko
2014-09-29 20:43   ` Johannes Sixt
2014-09-30  6:29     ` Marat Radchenko
2014-09-28 13:24 ` [PATCH 13/14] git-compat-util.h: fix integer overflow " Marat Radchenko
2014-09-28 13:24 ` [PATCH 14/14] MINGW: config.mak.uname: auto-detect MinGW build from compiler Marat Radchenko
2014-09-28 20:55 ` MinGW(-W64) compilation 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 12/14] Fix pointer -> integer casts on IL32P64 systems Marat Radchenko
2014-10-08 18:00 [PATCH v5] MinGW(-W64) compilation Marat Radchenko
2014-10-08 18:01 ` [PATCH 12/14] Fix pointer -> integer casts on IL32P64 systems Marat Radchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).