Skip to content

COMP: Make VariableLengthVector::AllocateElements ITK_FUTURE_DEPRECATED#5869

Merged
hjmjohnson merged 1 commit intoInsightSoftwareConsortium:mainfrom
N-Dekker:Make-VariableLengthVector-AllocateElements-ITK_FUTURE_DEPRECATED
Mar 6, 2026
Merged

COMP: Make VariableLengthVector::AllocateElements ITK_FUTURE_DEPRECATED#5869
hjmjohnson merged 1 commit intoInsightSoftwareConsortium:mainfrom
N-Dekker:Make-VariableLengthVector-AllocateElements-ITK_FUTURE_DEPRECATED

Conversation

@N-Dekker
Copy link
Contributor

@N-Dekker N-Dekker commented Mar 6, 2026

This member function is only marked ITK_FUTURE_LEGACY_REMOVE, so using this member function should only trigger a warning when legacy support is removed and ITK_LEGACY_SILENT is off.

Aims to fix warnings like:

itkVariableLengthVectorPython.cpp(5150): warning C4996: 'itk::VariableLengthVector::AllocateElements': Please consider calling `std::make_unique<TValue[]>(size)` instead.

At Windows_NT-Build4935-main-Python

This member function is only marked `ITK_FUTURE_LEGACY_REMOVE`, so using this
member function should only trigger a warning when legacy support is removed
_and_ `ITK_LEGACY_SILENT` is off.

Aims to fix warnings like:

    itkVariableLengthVectorPython.cpp(5150): warning C4996: 'itk::VariableLengthVector::AllocateElements': Please consider calling `std::make_unique<TValue[]>(size)` instead.

At Windows_NT-Build4935-main-Python (https://open.cdash.org/builds/11095793)

As reported by Matt McCormick at pull request InsightSoftwareConsortium#5863
@github-actions github-actions bot added type:Compiler Compiler support or related warnings area:Core Issues affecting the Core module labels Mar 6, 2026
Copy link
Member

@dzenanz dzenanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When was this deprecated? If it made its way into a released version, we should probably not walk back its "full" deprecation.

@N-Dekker
Copy link
Contributor Author

N-Dekker commented Mar 6, 2026

When was this deprecated? If it made its way into a released version, we should probably not walk back its "full" deprecation.

Copy link
Member

@dzenanz dzenanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we have to eventually do a "full" deprecation. Will these warning not appear then?

@blowekamp
Copy link
Member

But we have to eventually do a "full" deprecation. Will these warning not appear then?

I believe the expectation of ITK_LEGACY_SILENT is to suppress all deprecation warnings. This is useful for dashboard builds.

@N-Dekker
Copy link
Contributor Author

N-Dekker commented Mar 6, 2026

But we have to eventually do a "full" deprecation. Will these warning not appear then?

There are 3 phases, right?

  1. ITK_FUTURE_LEGACY_REMOVE: intended to become legacy-only with the next major release.
  2. ITK_LEGACY_REMOVE: legacy-only (intended to be removed with the next major release)
  3. Completely removed from ITK, unconditionally!

I think the warning should only appear for users who choose to make one step forward, by setting ITK_LEGACY_REMOVE = ON.

Once the functionality has become "legacy-only" (ITK_LEGACY_REMOVE), it becomes fully deprecated.

Right?

Copy link
Member

@dzenanz dzenanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine with the change, just making sure you though about these considerations.

@hjmjohnson hjmjohnson merged commit 9b60aa2 into InsightSoftwareConsortium:main Mar 6, 2026
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Core Issues affecting the Core module type:Compiler Compiler support or related warnings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants