Skip to content

Commit ba6e4aa

Browse files
authored
Some clangarm64 fixes (#5439)
Most notably, this fixes #5431, i.e. that the ARM64 flavor of Git for Windows does not use `/etc/gitconfig` by mistake, but `/clangarm64/etc/gitconfig` instead. My original intention was to fix only that issue, but when I fired up a Git for Windows/ARM64 SDK and tried to build, I immediately ran into trouble, then noticed places where ARM64 was not yet handled, and one thing led to another and now it's a 6-patch PR instead of a single-patch one.
2 parents 3003038 + d16eadf commit ba6e4aa

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

compat/win32/fscache.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,17 @@ struct fsentry {
7878
};
7979
#pragma GCC diagnostic pop
8080

81+
#pragma GCC diagnostic push
82+
#ifdef __clang__
83+
#pragma GCC diagnostic ignored "-Wflexible-array-extensions"
84+
#endif
8185
struct heap_fsentry {
8286
union {
8387
struct fsentry ent;
8488
char dummy[sizeof(struct fsentry) + MAX_LONG_PATH];
8589
} u;
8690
};
91+
#pragma GCC diagnostic pop
8792

8893
/*
8994
* Compares the paths of two fsentry structures for equality.
@@ -596,7 +601,12 @@ void fscache_flush(void)
596601
int fscache_lstat(const char *filename, struct stat *st)
597602
{
598603
int dirlen, base, len;
604+
#pragma GCC diagnostic push
605+
#ifdef __clang__
606+
#pragma GCC diagnostic ignored "-Wflexible-array-extensions"
607+
#endif
599608
struct heap_fsentry key[2];
609+
#pragma GCC diagnostic pop
600610
struct fsentry *fse;
601611
struct fscache *cache = fscache_getcache();
602612

@@ -659,7 +669,12 @@ int fscache_lstat(const char *filename, struct stat *st)
659669
int fscache_is_mount_point(struct strbuf *path)
660670
{
661671
int dirlen, base, len;
672+
#pragma GCC diagnostic push
673+
#ifdef __clang__
674+
#pragma GCC diagnostic ignored "-Wflexible-array-extensions"
675+
#endif
662676
struct heap_fsentry key[2];
677+
#pragma GCC diagnostic pop
663678
struct fsentry *fse;
664679
struct fscache *cache = fscache_getcache();
665680

config.mak.uname

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,11 @@ ifeq ($(uname_S),Windows)
432432
ifeq (MINGW32,$(MSYSTEM))
433433
prefix = /mingw32
434434
else
435-
prefix = /mingw64
435+
ifeq (CLANGARM64,$(MSYSTEM))
436+
prefix = /clangarm64
437+
else
438+
prefix = /mingw64
439+
endif
436440
endif
437441
# Prepend MSVC 64-bit tool-chain to PATH.
438442
#
@@ -486,7 +490,7 @@ ifeq ($(uname_S),Windows)
486490
NATIVE_CRLF = YesPlease
487491
DEFAULT_HELP_FORMAT = html
488492
SKIP_DASHED_BUILT_INS = YabbaDabbaDoo
489-
ifeq (/mingw64,$(subst 32,64,$(prefix)))
493+
ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix))))
490494
# Move system config into top-level /etc/
491495
ETC_GITCONFIG = ../etc/gitconfig
492496
ETC_GITATTRIBUTES = ../etc/gitattributes
@@ -724,8 +728,7 @@ ifeq ($(uname_S),MINGW)
724728
prefix = /mingw32
725729
HOST_CPU = i686
726730
BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup
727-
endif
728-
ifeq (MINGW64,$(MSYSTEM))
731+
else ifeq (MINGW64,$(MSYSTEM))
729732
prefix = /mingw64
730733
HOST_CPU = x86_64
731734
BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
@@ -749,17 +752,12 @@ ifeq ($(uname_S),MINGW)
749752
USE_LIBPCRE = YesPlease
750753
USE_MIMALLOC = YesPlease
751754
NO_PYTHON =
752-
ifeq (/mingw64,$(subst 32,64,$(prefix)))
755+
ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix))))
753756
# Move system config into top-level /etc/
754757
ETC_GITCONFIG = ../etc/gitconfig
755758
ETC_GITATTRIBUTES = ../etc/gitattributes
756759
endif
757-
ifeq (i686,$(uname_M))
758-
MINGW_PREFIX := mingw32
759-
endif
760-
ifeq (x86_64,$(uname_M))
761-
MINGW_PREFIX := mingw64
762-
endif
760+
MINGW_PREFIX := $(subst /,,$(prefix))
763761

764762
DESTDIR_WINDOWS = $(shell cygpath -aw '$(DESTDIR_SQ)')
765763
DESTDIR_MIXED = $(shell cygpath -am '$(DESTDIR_SQ)')

0 commit comments

Comments
 (0)