Skip to content

Commit 4ae0bc7

Browse files
committed
Merge branch 'js/win-lazyload-buildfix'
Compilation fix. * js/win-lazyload-buildfix: Makefile: restrict -Wpedantic and -Wno-pedantic-ms-format better lazyload.h: use an even more generic function pointer than FARPROC lazyload.h: fix warnings about mismatching function pointer types
2 parents ed4d535 + ebd2e4a commit 4ae0bc7

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

compat/win32/lazyload.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,21 @@
1515
* source, target);
1616
*/
1717

18+
typedef void (*FARVOIDPROC)(void);
19+
1820
struct proc_addr {
1921
const char *const dll;
2022
const char *const function;
21-
FARPROC pfunction;
23+
FARVOIDPROC pfunction;
2224
unsigned initialized : 1;
2325
};
2426

2527
/* Declares a function to be loaded dynamically from a DLL. */
2628
#define DECLARE_PROC_ADDR(dll, rettype, function, ...) \
2729
static struct proc_addr proc_addr_##function = \
2830
{ #dll, #function, NULL, 0 }; \
29-
static rettype (WINAPI *function)(__VA_ARGS__)
31+
typedef rettype (WINAPI *proc_type_##function)(__VA_ARGS__); \
32+
static proc_type_##function function
3033

3134
/*
3235
* Loads a function from a DLL (once-only).
@@ -35,9 +38,9 @@ struct proc_addr {
3538
* This function is not thread-safe.
3639
*/
3740
#define INIT_PROC_ADDR(function) \
38-
(function = get_proc_addr(&proc_addr_##function))
41+
(function = (proc_type_##function)get_proc_addr(&proc_addr_##function))
3942

40-
static inline FARPROC get_proc_addr(struct proc_addr *proc)
43+
static inline FARVOIDPROC get_proc_addr(struct proc_addr *proc)
4144
{
4245
/* only do this once */
4346
if (!proc->initialized) {
@@ -46,7 +49,8 @@ static inline FARPROC get_proc_addr(struct proc_addr *proc)
4649
hnd = LoadLibraryExA(proc->dll, NULL,
4750
LOAD_LIBRARY_SEARCH_SYSTEM32);
4851
if (hnd)
49-
proc->pfunction = GetProcAddress(hnd, proc->function);
52+
proc->pfunction = (FARVOIDPROC)GetProcAddress(hnd,
53+
proc->function);
5054
}
5155
/* set ENOSYS if DLL or function was not found */
5256
if (!proc->pfunction)

config.mak.dev

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@ ifeq ($(filter no-error,$(DEVOPTS)),)
66
DEVELOPER_CFLAGS += -Werror
77
SPARSE_FLAGS += -Wsparse-error
88
endif
9+
910
DEVELOPER_CFLAGS += -Wall
1011
ifeq ($(filter no-pedantic,$(DEVOPTS)),)
1112
DEVELOPER_CFLAGS += -pedantic
13+
ifneq (($or $(filter gcc5,$(COMPILER_FEATURES)),$(filter clang4,$(COMPILER_FEATURES))),)
1214
DEVELOPER_CFLAGS += -Wpedantic
13-
ifneq ($(filter gcc5,$(COMPILER_FEATURES)),)
15+
ifneq ($(filter gcc10,$(COMPILER_FEATURES)),)
16+
ifeq ($(uname_S),MINGW)
1417
DEVELOPER_CFLAGS += -Wno-pedantic-ms-format
15-
DEVELOPER_CFLAGS += -Wno-incompatible-pointer-types
18+
endif
19+
endif
1620
endif
1721
endif
1822
DEVELOPER_CFLAGS += -Wdeclaration-after-statement

config.mak.uname

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
1111
uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
1212
uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
1313

14+
ifneq ($(findstring MINGW,$(uname_S)),)
15+
uname_S := MINGW
16+
endif
17+
1418
ifdef MSVC
1519
# avoid the MingW and Cygwin configuration sections
1620
uname_S := Windows
@@ -588,7 +592,7 @@ ifeq ($(uname_S),NONSTOP_KERNEL)
588592
SANE_TOOL_PATH = /usr/coreutils/bin:/usr/local/bin
589593
SHELL_PATH = /usr/coreutils/bin/bash
590594
endif
591-
ifneq (,$(findstring MINGW,$(uname_S)))
595+
ifeq ($(uname_S),MINGW)
592596
pathsep = ;
593597
HAVE_ALLOCA_H = YesPlease
594598
NO_PREAD = YesPlease

0 commit comments

Comments
 (0)