diff --git a/CMakeLists.txt b/CMakeLists.txt index 7225a0f183..ce0070e629 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -404,8 +404,10 @@ if(GCC OR CLANG) endif() set(C_CXX_FLAGS "${C_CXX_FLAGS} -Werror -Wformat=2 -Wsign-compare -Wmissing-field-initializers -Wwrite-strings") - if(GCC AND CMAKE_C_COMPILER_VERSION VERSION_GREATER "8") + if((GCC AND CMAKE_C_COMPILER_VERSION VERSION_GREATER "8") OR + (CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS "13")) # GCC 8.x added a warning called -Wcast-function-type to the -Wextra umbrella. + # Also suppress for all clang versions supporting this warning. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-cast-function-type") endif() diff --git a/crypto/rand_extra/windows.c b/crypto/rand_extra/windows.c index 6b407b7c0f..d1cacf1b8c 100644 --- a/crypto/rand_extra/windows.c +++ b/crypto/rand_extra/windows.c @@ -65,7 +65,7 @@ static void init_processprng(void) { if (hmod == NULL) { abort(); } - g_processprng_fn = (ProcessPrngFunction)GetProcAddress(hmod, "ProcessPrng"); + g_processprng_fn = (ProcessPrngFunction)(void(*)(void))GetProcAddress(hmod, "ProcessPrng"); if (g_processprng_fn == NULL) { abort(); }