Skip to content

COMP: Drop unused InputPixelType typedefs in CopyIterationBenchmark#114

Merged
hjmjohnson merged 1 commit intoInsightSoftwareConsortium:masterfrom
hjmjohnson:fix-unused-typedef-copyiteration
Apr 23, 2026
Merged

COMP: Drop unused InputPixelType typedefs in CopyIterationBenchmark#114
hjmjohnson merged 1 commit intoInsightSoftwareConsortium:masterfrom
hjmjohnson:fix-unused-typedef-copyiteration

Conversation

@hjmjohnson
Copy link
Copy Markdown
Member

Remove two unused using InputPixelType = ...; local typedefs in examples/Core/itkCopyIterationBenchmark.cxx to silence -Wunused-local-typedefs warnings.

Warning text
examples/Core/itkCopyIterationBenchmark.cxx:119:9: warning: typedef 'using InputPixelType = typename TInputImage::PixelType' locally defined but not used [-Wunused-local-typedefs]
  119 |   using InputPixelType = typename TInputImage::PixelType;
      |         ^~~~~~~~~~~~~~
examples/Core/itkCopyIterationBenchmark.cxx:142:9: warning: typedef 'using InputPixelType = typename TInputImage::PixelType' locally defined but not used [-Wunused-local-typedefs]
  142 |   using InputPixelType = typename TInputImage::PixelType;
      |         ^~~~~~~~~~~~~~
Why these two only

CopyRegionIterator and CopyScanlineIterator cast directly via static_cast<OutputPixelType>(inputIt.Get()) and never reference InputPixelType inside the function body — the typedef is dead.

The two other copy variants in the same file legitimately use both:

  • Method 3 (line 187): *outputIt = OutputPixelType(InputPixelType(*inputIt));
  • Method 4 (line 208): for (const InputPixelType & inputPixel : itk::ImageRegionRange<const TInputImage>(...))

Left unchanged.

CopyRegionIterator and CopyScanlineIterator (examples/Core/itkCopyIterationBenchmark.cxx)
each declared a local `using InputPixelType = typename TInputImage::PixelType;`
that was never referenced — the loop bodies cast directly via
`static_cast<OutputPixelType>(inputIt.Get())`, so InputPixelType is dead.

Triggers -Wunused-local-typedefs at lines 119 and 142 under gcc.
Remove the two unused typedefs; the other two functions in this file
(CopyImageRegionRange, and the * / * typed-copy variant at line 187)
legitimately use both InputPixelType and OutputPixelType and are left
unchanged.
@hjmjohnson hjmjohnson marked this pull request as ready for review April 23, 2026 11:29
@hjmjohnson hjmjohnson merged commit 63fec30 into InsightSoftwareConsortium:master Apr 23, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant