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

Wdeprecated #4665

Closed andrei-sandor closed 1 week ago

andrei-sandor commented 1 month ago

Added ITK_DEPRECATED when \deprecated is used in a comment. They must both come together. Applied to structs, classes and functions

seanm commented 1 month ago

So the issue here is that -Wdocumentation warns if a function/class is documented with a \deprecated but isn't also tagged [[deprecated]] for the compiler. Indeed, it generally makes sense that you should have both or neither.

But there are some tricky cases here:

This struct is "deprecated":

/**
   * \brief A structure which enable changing any image class' pixel
   * type to another.
   *
   *
   * \sa Image::Rebind
   * \deprecated Use template alias RebindImageType instead
   */
  template <typename UPixelType, unsigned int VUImageDimension = VImageDimension>
  struct Rebind
  {
    using Type = itk::VectorImage<UPixelType, VUImageDimension>;
  };

but its replacement references the deprecated struct:

using RebindImageType = typename Rebind<UPixelType, VUImageDimension>::Type;

If the struct is tagged [[deprecated]] then using it above triggers a warning about using a deprecated class.


What do you all think of just changing the \deprecated in these cases to just Deprecated:?

seanm commented 2 weeks ago

@andrei-sandor please amend the commit messge, as "COMP: Added ITK_DEPRECATED when \deprecated there" is no longer true.

seanm commented 1 week ago

/azp ITK.macOS