Default initialize the statep pointer in the resolv compile check

Initialize the variable with the default value, to avoid the type
mismatch warnings.

Fixes: QTBUG-135648
Pick-to: 6.8
Change-Id: I3ae2c59fb42676b373bcbbe06d3e6636203e283b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 52e2a89c63a059935f438209242a0065d5ac3cf5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Alexey Edelev 2025-04-06 19:17:28 +02:00 committed by Qt Cherry-pick Bot
parent 7cd587aff1
commit 1f2f5ee08c

View File

@ -25,13 +25,22 @@ if(LIBRESOLV)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${LIBRESOLV}")
endif()
cmake_policy(PUSH)
if(POLICY CMP0067)
cmake_policy(SET CMP0067 NEW)
endif()
if(DEFINED CMAKE_CXX_STANDARD)
set(_WrapResolv_CMAKE_CXX_STANDARD_back ${CMAKE_CXX_STANDARD})
endif()
set(CMAKE_CXX_STANDARD 11)
check_cxx_source_compiles("
#include <netinet/in.h>
#include <resolv.h>
int main(int, char **argv)
{
res_state statep = 0;
res_state statep = {};
int n = res_nmkquery(statep, 0, argv[1], 0, 0, NULL, 0, NULL, NULL, 0);
n = res_nsend(statep, NULL, 0, NULL, 0);
n = dn_expand(NULL, NULL, NULL, NULL, 0);
@ -39,6 +48,14 @@ int main(int, char **argv)
}
" HAVE_LIBRESOLV_FUNCTIONS)
if(DEFINED _WrapResolv_CMAKE_CXX_STANDARD_back)
set(CMAKE_CXX_STANDARD ${_WrapResolv_CMAKE_CXX_STANDARD_back})
unset(_WrapResolv_CMAKE_CXX_STANDARD_back)
else()
unset(CMAKE_CXX_STANDARD)
endif()
cmake_policy(POP)
cmake_pop_check_state()
if(HAVE_LIBRESOLV_FUNCTIONS)