Skip to content

Commit 27e0c3c

Browse files
carenasgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 153fb49 commit 27e0c3c

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

compat/nedmalloc/nedmalloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ static void threadcache_free(nedpool *p, threadcache *tc, int mymspace, void *me
510510
assert(idx<=THREADCACHEMAXBINS);
511511
if(tck==*binsptr)
512512
{
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);
514514
abort();
515515
}
516516
#ifdef FULLSANITYCHECKS

compat/win32/lazyload.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct proc_addr {
3737
#define INIT_PROC_ADDR(function) \
3838
(function = get_proc_addr(&proc_addr_##function))
3939

40-
static inline void *get_proc_addr(struct proc_addr *proc)
40+
static inline FARPROC get_proc_addr(struct proc_addr *proc)
4141
{
4242
/* only do this once */
4343
if (!proc->initialized) {

config.mak.dev

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
1+
ifndef COMPILER_FEATURES
2+
COMPILER_FEATURES := $(shell ./detect-compiler $(CC))
3+
endif
4+
15
ifeq ($(filter no-error,$(DEVOPTS)),)
26
DEVELOPER_CFLAGS += -Werror
37
SPARSE_FLAGS += -Wsparse-error
48
endif
9+
DEVELOPER_CFLAGS += -Wall
510
ifneq ($(filter pedantic,$(DEVOPTS)),)
611
DEVELOPER_CFLAGS += -pedantic
12+
ifneq ($(filter gcc5,$(COMPILER_FEATURES)),)
13+
DEVELOPER_CFLAGS += -Wno-incompatible-pointer-types
14+
endif
715
endif
8-
DEVELOPER_CFLAGS += -Wall
916
DEVELOPER_CFLAGS += -Wdeclaration-after-statement
1017
DEVELOPER_CFLAGS += -Wformat-security
1118
DEVELOPER_CFLAGS += -Wold-style-definition
@@ -16,10 +23,6 @@ DEVELOPER_CFLAGS += -Wunused
1623
DEVELOPER_CFLAGS += -Wvla
1724
DEVELOPER_CFLAGS += -fno-common
1825

19-
ifndef COMPILER_FEATURES
20-
COMPILER_FEATURES := $(shell ./detect-compiler $(CC))
21-
endif
22-
2326
ifneq ($(filter clang4,$(COMPILER_FEATURES)),)
2427
DEVELOPER_CFLAGS += -Wtautological-constant-out-of-range-compare
2528
endif

0 commit comments

Comments
 (0)