Re: [PATCH 17/19] Portable alloca for Git

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 27, 2014 at 06:22:50PM +0400, Kirill Smelkov wrote:
> On Mon, Mar 24, 2014 at 02:47:24PM -0700, Junio C Hamano wrote:
> > Kirill Smelkov <kirr@xxxxxxxxxx> writes:
> > 
> > > On Fri, Feb 28, 2014 at 06:19:58PM +0100, Erik Faye-Lund wrote:
> > >> On Fri, Feb 28, 2014 at 6:00 PM, Kirill Smelkov <kirr@xxxxxxxxxx> wrote:
> > >> ...
> > >> > In fact that would be maybe preferred, for maintainers to enable alloca
> > >> > with knowledge and testing, as one person can't have them all at hand.
> > >> 
> > >> Yeah, you're probably right.
> > >
> > > Erik, the patch has been merged into pu today. Would you please
> > > follow-up with tested MINGW change?
> > 
> > Sooo.... I lost track but this discussion seems to have petered out
> > around here.  I think the copy we have had for a while on 'pu' is
> > basically sound, and can easily built on by platform folks by adding
> > or removing the -DHAVE_ALLOCA_H from the Makefile.
> 
> Yes, that is all correct - that version works and we can improve it in
> the future with platform-specific follow-up patches, if needed.

Junio, thanks for merging this and other diff-tree patches to next.  It
so happened that I'm wrestling with MSysGit today, so please also find
alloca-for-mingw patch attached below.

Thanks,
Kirill

---- 8< ----
Subject: [PATCH] mingw: activate alloca

Both MSVC and MINGW have alloca(3) definitions in malloc.h, so by moving
win32-compat alloca.h from compat/vcbuild/include/ to compat/win32/ ,
which is included by both MSVC and MINGW CFLAGS, we can make alloca()
work on both those Windows environments.

In MINGW, malloc.h has explicit check for GNUC and if it is so, defines
alloca to __builtin_alloca, so it looks like we don't need to add any
code to here-shipped alloca.h to get optimum performance.

Compile-tested on Windows in MSysGit.

Signed-off-by: Kirill Smelkov <kirr@xxxxxxxxxx>
---
 compat/{vcbuild/include => win32}/alloca.h | 0
 config.mak.uname                           | 1 +
 2 files changed, 1 insertion(+)
 rename compat/{vcbuild/include => win32}/alloca.h (100%)

diff --git a/compat/vcbuild/include/alloca.h b/compat/win32/alloca.h
similarity index 100%
rename from compat/vcbuild/include/alloca.h
rename to compat/win32/alloca.h
diff --git a/config.mak.uname b/config.mak.uname
index 17ef893..67bc054 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -480,6 +480,7 @@ ifeq ($(uname_S),NONSTOP_KERNEL)
 endif
 ifneq (,$(findstring MINGW,$(uname_S)))
 	pathsep = ;
+	HAVE_ALLOCA_H = YesPlease
 	NO_PREAD = YesPlease
 	NEEDS_CRYPTO_WITH_SSL = YesPlease
 	NO_LIBGEN_H = YesPlease
-- 
1.9.0.msysgit.0.31.g74d1b9a.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]