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 6.9 Change-Id: I3ae2c59fb42676b373bcbbe06d3e6636203e283b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
0435aaccdc
commit
52e2a89c63
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user