Skip to content

STYLE: Replace Fill(0.) and Fill(0u) with {} initializer for local variables in tests#4884

Merged
dzenanz merged 1 commit intoInsightSoftwareConsortium:masterfrom
N-Dekker:Replace-Fill-0-0
Oct 18, 2024
Merged

STYLE: Replace Fill(0.) and Fill(0u) with {} initializer for local variables in tests#4884
dzenanz merged 1 commit intoInsightSoftwareConsortium:masterfrom
N-Dekker:Replace-Fill-0-0

Conversation

@N-Dekker
Copy link
Copy Markdown
Contributor

Replaced Fill(0.), Fill(0.0), Fill(0.0f), and Fill(0u) calls with {} initializers.

@github-actions github-actions bot added type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct area:Bridge Issues affecting the Bridge module area:Core Issues affecting the Core module area:Filtering Issues affecting the Filtering module area:IO Issues affecting the IO module area:Registration Issues affecting the Registration module type:Style Style changes: no logic impact (indentation, comments, naming) area:Numerics Issues affecting the Numerics module labels Oct 17, 2024
Replaced `Fill(0.)`, `Fill(0.0)`, `Fill(0.0f)`, and `Fill(0u)` calls with `{}`
initializers.

Follow-up to pull request InsightSoftwareConsortium#4881
commit 569a8b6
"STYLE: Replace Fill(0) with {} initializer for local variables in tests"
@N-Dekker N-Dekker marked this pull request as ready for review October 18, 2024 09:59
@dzenanz dzenanz merged commit d36dfc6 into InsightSoftwareConsortium:master Oct 18, 2024
@jhlegarreta
Copy link
Copy Markdown
Member

@N-Dekker Not sure if the dynamic analysis defects are a consequence of this PR,
https://open.cdash.org/builds/9972353/dynamic_analysis

but a quick search of the commit that last modified the files points to this commit.

Dynamic analysis on 2024-10-18:
https://open.cdash.org/builds/9970526/dynamic_analysis

@N-Dekker
Copy link
Copy Markdown
Contributor Author

N-Dekker commented Oct 21, 2024

@N-Dekker Not sure if the dynamic analysis defects are a consequence of this PR, https://open.cdash.org/builds/9972353/dynamic_analysis

but a quick search of the commit that last modified the files points to this commit.

Dynamic analysis on 2024-10-18: https://open.cdash.org/builds/9970526/dynamic_analysis

This one specifically reports a test failure of RelabelComponentImageFilter.big_random. We did some work on RelabelComponentImageFilter recently, but that seemed quite innocent 😇


Update: I see now, there is an irregularity in the default-constructor of QuadEdgeMeshPoint that caused those regression failures! Thanks very much, @jhlegarreta ! 🎉 I'll prepare a PR!

N-Dekker added a commit to N-Dekker/ITK that referenced this pull request Oct 21, 2024
Defaulted the default-constructor of `QuadEdgeMeshPoint`, and added an
initializer to its data member m_Edge, to ensure that an instance of this type
can be properly initialized by an empty initializer list, `{}`.

Aims to fix the dynamic analysis defects reported by Jon Haitz Legarreta Gorroño
at InsightSoftwareConsortium#4884 (comment)
N-Dekker added a commit to N-Dekker/ITK that referenced this pull request Oct 22, 2024
Replaced code of the form

    T var;
    var.Fill(x);

with `auto var = itk::MakeFilled<T>(x);`

Following C++ Core Guidelines, Oct 3, 2024, "Always initialize an object",
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-always

Using Notepad++, Replace in Files, doing:

    Find what: ^( [ ]+)([^ ].*)[ ]+(\w+);[\r\n]+\1\3\.Fill\(
    Replace with: $1auto $3 = itk::MakeFilled<$2>\(
    Filters: itk*Test*.cxx
    [v] Match case
    (*) Regular expression

Follow-up to
- pull request InsightSoftwareConsortium#4881
- pull request InsightSoftwareConsortium#4884
- pull request InsightSoftwareConsortium#4887
N-Dekker added a commit to N-Dekker/ITK that referenced this pull request Oct 24, 2024
Replaced code of the form

    T var;
    var.Fill(x);

with `auto var = itk::MakeFilled<T>(x);`

Following C++ Core Guidelines, Oct 3, 2024, "Always initialize an object",
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-always

Using Notepad++, Replace in Files, doing:

    Find what: ^( [ ]+)([^ ].*)[ ]+(\w+);[\r\n]+\1\3\.Fill\(
    Replace with: $1auto $3 = itk::MakeFilled<$2>\(
    Filters: itk*Test*.cxx
    [v] Match case
    (*) Regular expression

Follow-up to
- pull request InsightSoftwareConsortium#4881
- pull request InsightSoftwareConsortium#4884
- pull request InsightSoftwareConsortium#4887
N-Dekker added a commit to N-Dekker/ITK that referenced this pull request Oct 25, 2024
Replaced code of the form

    T var;
    var.Fill(x);

with `auto var = itk::MakeFilled<T>(x);`

Following C++ Core Guidelines, Oct 3, 2024, "Always initialize an object",
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-always

Using Notepad++, Replace in Files, doing:

    Find what: ^( [ ]+)([^ ].*)[ ]+(\w+);[\r\n]+\1\3\.Fill\(
    Replace with: $1auto $3 = itk::MakeFilled<$2>\(
    Filters: itk*Test*.cxx
    [v] Match case
    (*) Regular expression

Follow-up to
- pull request InsightSoftwareConsortium#4881
- pull request InsightSoftwareConsortium#4884
- pull request InsightSoftwareConsortium#4887
thewtex pushed a commit that referenced this pull request Dec 12, 2024
Defaulted the default-constructor of `QuadEdgeMeshPoint`, and added an
initializer to its data member m_Edge, to ensure that an instance of this type
can be properly initialized by an empty initializer list, `{}`.

Aims to fix the dynamic analysis defects reported by Jon Haitz Legarreta Gorroño
at #4884 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Bridge Issues affecting the Bridge module area:Core Issues affecting the Core module area:Filtering Issues affecting the Filtering module area:IO Issues affecting the IO module area:Numerics Issues affecting the Numerics module area:Registration Issues affecting the Registration module type:Style Style changes: no logic impact (indentation, comments, naming) type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants