From 8d6ba35827bc4025a39acace8b65f2de96613a8a Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Thu, 30 Oct 2014 18:49:09 +0100 Subject: [PATCH] CheckStructHasMember: Avoid clang -Wall breakage (#15203) With CMAKE_C_COMPILER=clang and CMAKE_C_FLAGS='-Wall -Werror', this test breaks with -Werror,-Wuninitialized. Fix this by getting rid of the temporary variable. --- Modules/CheckStructHasMember.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Modules/CheckStructHasMember.cmake b/Modules/CheckStructHasMember.cmake index c8949cf26..de31d2ce2 100644 --- a/Modules/CheckStructHasMember.cmake +++ b/Modules/CheckStructHasMember.cmake @@ -69,8 +69,7 @@ macro (CHECK_STRUCT_HAS_MEMBER _STRUCT _MEMBER _HEADER _RESULT) ${_INCLUDE_FILES} int main() { - ${_STRUCT}* tmp; - (void) tmp->${_MEMBER}; + (void)((${_STRUCT} *)0)->${_MEMBER}; return 0; } ")