Hi CMake developers,
I like CMake for not generating a ton of warnings. I just tried with a
recent SVN version of Clang 3.5 which learned again new warnings:

> [  6%] Building CXX object 
> Source/kwsys/CMakeFiles/cmsys.dir/SystemInformation.cxx.o                     
>                                                                          
> /opt/cmake-git/cmake/Source/kwsys/SystemInformation.cxx:3786:17: warning: 
> comparison of array 'unameInfo.release' not equal to a null pointer is always 
> true
>       [-Wtautological-pointer-compare]
>   if( unameInfo.release!=0 && strlen(unameInfo.release)>=3 )
>       ~~~~~~~~~~^~~~~~~  ~
> 1 warning generated.

Find attached a patch the removes the condition that is always true.
Maybe you want to keep the condition as an assert?

Bye
Christoph
From 2bbf20357e15e8e5ccd0ec077b838c26f7bac1bd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= <[email protected]>
Date: Fri, 20 Jun 2014 09:28:25 +0200
Subject: [PATCH] Remove condition which is always true.

This resolves a tautological-pointer-compare
warning emitted by Clang 3.5-svn.
---
 Source/kwsys/SystemInformation.cxx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx
index 6544098..5ba500e 100644
--- a/Source/kwsys/SystemInformation.cxx
+++ b/Source/kwsys/SystemInformation.cxx
@@ -3783,7 +3783,7 @@ bool SystemInformationImplementation::QueryLinuxMemory()
     return false;
     }
 
-  if( unameInfo.release!=0 && strlen(unameInfo.release)>=3 )
+  if( strlen(unameInfo.release)>=3 )
     {
     // release looks like "2.6.3-15mdk-i686-up-4GB"
     char majorChar=unameInfo.release[0];
-- 
1.9.3

Attachment: signature.asc
Description: OpenPGP digital signature

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to