win32: allow building with pedantic mode enabled

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>

Carlo Marcelo Arenas Belón committed Sep 3, 2021 at 10:02 UTC 27e0c3c6cfead8fccd16105be497dba7ccd0ec6b
3 files changed +10 -7
compat/nedmalloc/nedmalloc.c
+1 -1
@@ -510,7 +510,7 @@ static void threadcache_free(nedpool *p, threadcache *tc, int mymspace, void *me
510 assert(idx<=THREADCACHEMAXBINS);
511 if(tck==*binsptr)
512 {
513 - fprintf(stderr, "Attempt to free already freed memory block %p - aborting!\n", tck);
513 + fprintf(stderr, "Attempt to free already freed memory block %p - aborting!\n", (void *)tck);
514 abort();
515 }
516 #ifdef FULLSANITYCHECKS
compat/win32/lazyload.h
+1 -1
@@ -37,7 +37,7 @@ struct proc_addr {
37 #define INIT_PROC_ADDR(function) \
38 (function = get_proc_addr(&proc_addr_##function))
39
40 -static inline void *get_proc_addr(struct proc_addr *proc)
40 +static inline FARPROC get_proc_addr(struct proc_addr *proc)
41 {
42 /* only do this once */
43 if (!proc->initialized) {
config.mak.dev
+8 -5
@@ -1,11 +1,18 @@
1 +ifndef COMPILER_FEATURES
2 +COMPILER_FEATURES := $(shell ./detect-compiler $(CC))
3 +endif
4 +
5 ifeq ($(filter no-error,$(DEVOPTS)),)
6 DEVELOPER_CFLAGS += -Werror
7 SPARSE_FLAGS += -Wsparse-error
8 endif
9 +DEVELOPER_CFLAGS += -Wall
10 ifneq ($(filter pedantic,$(DEVOPTS)),)
11 DEVELOPER_CFLAGS += -pedantic
12 +ifneq ($(filter gcc5,$(COMPILER_FEATURES)),)
13 +DEVELOPER_CFLAGS += -Wno-incompatible-pointer-types
14 +endif
15 endif
8 -DEVELOPER_CFLAGS += -Wall
16 DEVELOPER_CFLAGS += -Wdeclaration-after-statement
17 DEVELOPER_CFLAGS += -Wformat-security
18 DEVELOPER_CFLAGS += -Wold-style-definition
@@ -16,10 +23,6 @@ DEVELOPER_CFLAGS += -Wunused
23 DEVELOPER_CFLAGS += -Wvla
24 DEVELOPER_CFLAGS += -fno-common
25
19 -ifndef COMPILER_FEATURES
20 -COMPILER_FEATURES := $(shell ./detect-compiler $(CC))
21 -endif
22 -
26 ifneq ($(filter clang4,$(COMPILER_FEATURES)),)
27 DEVELOPER_CFLAGS += -Wtautological-constant-out-of-range-compare
28 endif