]> git.ipfire.org Git - thirdparty/git.git/commitdiff
win32: allow building with pedantic mode enabled
authorCarlo Marcelo Arenas Belón <carenas@gmail.com>
Fri, 3 Sep 2021 17:02:31 +0000 (10:02 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 3 Sep 2021 18:40:30 +0000 (11:40 -0700)
In preparation to building with pedantic mode enabled, change a couple
of places where the current mingw gcc compiler provided with the SDK
reports issues.

A full fix for the incompatible use of (void *) to store function
pointers has been punted, with the minimal change to instead use a
generic function pointer (FARPROC), and therefore the (hopefully)
temporary need to disable incompatible pointer warnings.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
compat/nedmalloc/nedmalloc.c
compat/win32/lazyload.h
config.mak.dev

index 1cc31c350223b84cd97939afccf1bcc1caa070b4..edb438a7776aed1c1559352ce3b32e051cac806a 100644 (file)
@@ -510,7 +510,7 @@ static void threadcache_free(nedpool *p, threadcache *tc, int mymspace, void *me
        assert(idx<=THREADCACHEMAXBINS);
        if(tck==*binsptr)
        {
-               fprintf(stderr, "Attempt to free already freed memory block %p - aborting!\n", tck);
+               fprintf(stderr, "Attempt to free already freed memory block %p - aborting!\n", (void *)tck);
                abort();
        }
 #ifdef FULLSANITYCHECKS
index 9e631c8593ff158ef9b025d76602849a524d1f65..d2056cdadf9e2c72b7a4ee89464b55f988cefa62 100644 (file)
@@ -37,7 +37,7 @@ struct proc_addr {
 #define INIT_PROC_ADDR(function) \
        (function = get_proc_addr(&proc_addr_##function))
 
-static inline void *get_proc_addr(struct proc_addr *proc)
+static inline FARPROC get_proc_addr(struct proc_addr *proc)
 {
        /* only do this once */
        if (!proc->initialized) {
index 41d6345bc0a851a4684c3f4f0cb631c7d13bfb6c..5424db5c2215f39986f13037c1cc3cd866aba0f7 100644 (file)
@@ -1,11 +1,18 @@
+ifndef COMPILER_FEATURES
+COMPILER_FEATURES := $(shell ./detect-compiler $(CC))
+endif
+
 ifeq ($(filter no-error,$(DEVOPTS)),)
 DEVELOPER_CFLAGS += -Werror
 SPARSE_FLAGS += -Wsparse-error
 endif
+DEVELOPER_CFLAGS += -Wall
 ifneq ($(filter pedantic,$(DEVOPTS)),)
 DEVELOPER_CFLAGS += -pedantic
+ifneq ($(filter gcc5,$(COMPILER_FEATURES)),)
+DEVELOPER_CFLAGS += -Wno-incompatible-pointer-types
+endif
 endif
-DEVELOPER_CFLAGS += -Wall
 DEVELOPER_CFLAGS += -Wdeclaration-after-statement
 DEVELOPER_CFLAGS += -Wformat-security
 DEVELOPER_CFLAGS += -Wold-style-definition
@@ -16,10 +23,6 @@ DEVELOPER_CFLAGS += -Wunused
 DEVELOPER_CFLAGS += -Wvla
 DEVELOPER_CFLAGS += -fno-common
 
-ifndef COMPILER_FEATURES
-COMPILER_FEATURES := $(shell ./detect-compiler $(CC))
-endif
-
 ifneq ($(filter clang4,$(COMPILER_FEATURES)),)
 DEVELOPER_CFLAGS += -Wtautological-constant-out-of-range-compare
 endif