lazyload.h: fix warnings about mismatching function pointer types
commitd2c470f9bc4192a0b33ebea73986d14c32b3a361
authorJohannes Sixt <j6t@kdbg.org>
Sun, 26 Sep 2021 10:05:11 +0000 (26 03:05 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 27 Sep 2021 16:31:59 +0000 (27 09:31 -0700)
treecda7716ff56184e17d02491aee3e8b58ca03bf16
parent99c99ed8259bf070cd8ae7b51a94904b7cf5c161
lazyload.h: fix warnings about mismatching function pointer types

Here, GCC warns about every use of the INIT_PROC_ADDR macro, for example:

In file included from compat/mingw.c:8:
compat/mingw.c: In function 'mingw_strftime':
compat/win32/lazyload.h:38:12: warning: assignment to
   'size_t (*)(char *, size_t,  const char *, const struct tm *)'
   {aka 'long long unsigned int (*)(char *, long long unsigned int,
      const char *, const struct tm *)'} from incompatible pointer type
   'FARPROC' {aka 'long long int (*)()'} [-Wincompatible-pointer-types]
   38 |  (function = get_proc_addr(&proc_addr_##function))
      |            ^
compat/mingw.c:1014:6: note: in expansion of macro 'INIT_PROC_ADDR'
 1014 |  if (INIT_PROC_ADDR(strftime))
      |      ^~~~~~~~~~~~~~

(message wrapped for convenience). Insert a cast to keep the compiler
happy. A cast is fine in these cases because they are generic function
pointer values that have been looked up in a DLL.

Helped-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
compat/win32/lazyload.h