Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix -Wcast-function-type build issues #1972

Merged
merged 2 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion crypto/rand_extra/windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Loading