InsightSoftwareConsortium / ITK

Insight Toolkit (ITK) -- Official Repository. ITK builds on a proven, spatially-oriented architecture for processing, segmentation, and registration of scientific images in two, three, or more dimensions.
https://itk.org
Apache License 2.0
1.37k stars 660 forks source link

COMP: Fix implicit copy constructor definition deprecation warnings #4639

Closed jhlegarreta closed 2 months ago

jhlegarreta commented 2 months ago

Fix implicit copy constructor definition deprecation warnings in image/mesh file reader exception classes by using explicitly the compiler-provided default implementation (together with the assignment assignment and move semantics).

Fixes:

[CTest: warning matched]
 /Users/builder/externalModules/IO/ImageBase/include/itkImageFileReaderException.h:54:3:
 warning: definition of implicit copy constructor for 'ImageFileReaderException' is deprecated because it has a user-declared destructor [-Wdeprecated]
  ~ImageFileReaderException() noexcept override;
  ^

and

[CTest: warning matched]
 /Users/builder/externalModules/IO/ImageBase/include/itkImageFileWriter.h:57:3:
 warning: definition of implicit copy constructor for 'ImageFileWriterException' is deprecated because it has a user-declared destructor [-Wdeprecated]
  ~ImageFileWriterException() noexcept override;
  ^

and

[CTest: warning matched]
 /Users/builder/externalModules/IO/MeshBase/include/itkMeshFileReaderException.h:36:3:
 warning: definition of implicit copy constructor for 'MeshFileReaderException' is deprecated because it has a user-declared destructor [-Wdeprecated]
  ~MeshFileReaderException() noexcept override;
  ^

and

[CTest: warning matched]
 /Users/builder/externalModules/IO/MeshBase/include/itkMeshFileWriterException.h:36:3:
 warning: definition of implicit copy constructor for 'MeshFileWriterException' is deprecated because it has a user-declared destructor [-Wdeprecated]
  ~MeshFileWriterException() noexcept override;
  ^

Raised for example in: https://open.cdash.org/viewBuildError.php?type=1&buildid=9587875

PR Checklist

jhlegarreta commented 2 months ago

Re https://github.com/InsightSoftwareConsortium/ITK/pull/4626#issuecomment-2083812472 and https://github.com/InsightSoftwareConsortium/ITK/pull/4627#issuecomment-2083813278: 199 new warnings appeared today on RogueResearch22. Maybe the compiler does not show more than that many warnings. This addresses a few of them.

jhlegarreta commented 2 months ago

~Format issues are not related to this patch set: https://github.com/InsightSoftwareConsortium/ITK/actions/runs/8931230755/job/24532913042?pr=4639~

Edit: Solved in PR #4640. Thanks Matt.

jhlegarreta commented 2 months ago

Tried to use the copy and move disallow macro first, but the compiler was complaining: https://open.cdash.org/viewBuildError.php?buildid=9589284

Rather that trying with the defaults only for the image file reader/writer exceptions only (or the constructor vs assignment only), decided to be consistent across all 4.

Maybe some more investigation on which can be deleted vs defaulted, and developing a macro would be useful in a separate PR. I don't have the bandwidth for that, unfortunately.

jhlegarreta commented 2 months ago

Failures on macOS arm64 are unrelated: itkNiftiSpatialTemporalUnitsTest2 is failing. The dashboard shows that this test is failing on a number of sites as well (notified in the original PR https://github.com/InsightSoftwareConsortium/ITK/pull/4595#issuecomment-2092965413).