Build errors with clang 3.8.1 (Debian 9.1 "Stretch")
Open, HighPublic

Description

Mostly warnings that turned into errors. @reicht probably these errors will affect Mac OS X at some point, so there is probaly some overlap with T23248 .

Details

Differential Revisions
Restricted Differential Revision
Restricted Differential Revision
nolden created this task.Aug 17 2017, 5:06 PM
nolden added a revision: Restricted Differential Revision.Aug 26 2017, 1:32 PM
reicht added a comment.EditedAug 26 2017, 2:50 PM

@nolden changes can be committed beforehand into this MITK branch T23248-test-with-latest-master which has fixes so that DCMTK compiles on macOS with Clang.

Building current version of ITK fails with latest clang on macOS 10.13:

ep/src/ITK/Modules/ThirdParty/VNL/src/vxl/v3p/netlib/linalg/lsqrBase.cxx:565:14: error: ordered comparison between pointer and zero ('std::ostream *' (aka 'basic_ostream<char> *') and 'int')
    if (nout > 0)

In ITK 4.12.1 this is fixed, but for now the affected expression if (nout > 0) could be updated in MITKs ITK-4.11 patch file.

additional patch in ITK-4.11.0.patch

diff --git a/CMakeExternals/ITK-4.11.0.patch b/CMakeExternals/ITK-4.11.0.patch
index 9a285c0..0bf2df5 100644
--- a/CMakeExternals/ITK-4.11.0.patch
+++ b/CMakeExternals/ITK-4.11.0.patch
@@ -20,3 +20,17 @@ index bf2d27d..e321215 100644
  endif()
  
  itk_module_impl()
+ 
+diff --git a/Modules/ThirdParty/VNL/src/vxl/v3p/netlib/linalg/lsqrBase.cxx b/Modules/ThirdParty/VNL/src/vxl/v3p/netlib/linalg/lsqrBase.cxx
+index 1f5f9bf..8c62db4 100644
+--- a/Modules/ThirdParty/VNL/src/vxl/v3p/netlib/linalg/lsqrBase.cxx
++++ b/Modules/ThirdParty/VNL/src/vxl/v3p/netlib/linalg/lsqrBase.cxx
+@@ -562,7 +562,7 @@ Solve( unsigned int m, unsigned int n, const double * b, double * x )
+     // See if it is time to print something.
+     //----------------------------------------------------------------
+     bool prnt = false;
+-    if (nout > 0)
++    if (nout > (void*)0)
+       {
+       if (n     <=        40) prnt = true;
+       if (this->itn   <=        10) prnt = true;
\ No newline at end of file

An ordered comparison between a pointer and zero is very suspicious. Does it change the intended logic when replacing this with a comparison to nullptr, e.g. if (nout != nullptr)? Is it already fixed in ITK 4.12? If not, consider to contribute.

Or is there any other preferred solution?

nolden added a revision: Restricted Differential Revision.Nov 13 2017, 8:28 AM