On Wed, Sep 22, 2021 at 12:56 PM Johannes Sixt <j6t@xxxxxxxx> wrote: > > 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)) > | ^~~~~~~~~~~~~~ did you have CFLAGS adding -Wincompatible-pointer-types explicitly? This is the reason why the code that got merged to master had -Wno for this case. > (message wrapper 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. I have a more complete "fix" which I got stuck testing GGG[1]; you are likely going to also hit -Wcast-function-type otherwise. > > Signed-off-by: Johannes Sixt <j6t@xxxxxxxx> > --- > How can this have worked ever without a warning? POSIX have a specific exception that allows (void *) for this, it is incorrect though in platforms where pointers to code and data might be different (ex DOS with its segmented model) Carlo [1] https://github.com/git/git/pull/1094