Various -Wunused-but-set-variable warnings

Hi all,

The newest clang gives some new -Wunused-but-set-variable warnings.

Without knowing the code in question, it’s hard for someone like me to decide if the set value is harmlessly unused or if there is missing code that should be using the values.

Could people that know these classes take a look?

The warnings are:

/Common/Core/Testing/Cxx/TestSparseArrayValidation.cxx:61:9: warning: variable 'status' set but not used
/Filters/Core/Testing/Cxx/TestGlyph3D.cxx:64:7: warning: variable 'status' set but not used
/Filters/HyperTree/Testing/Cxx/TestHyperTreeGridTernary2DFullMaterialBits.cxx:92:13: warning: variable 's' set but not used
/Filters/Sources/vtkHyperTreeGridSource.cxx:1044:13: warning: variable 'nLeaves' set but not used
/IO/Infovis/Testing/Cxx/TestFixedWidthTextReader.cxx:49:7: warning: variable 'status' set but not used
/IO/Parallel/vtkEnSightWriter.cxx:163:7: warning: variable 'blockCount' set but not used
/IO/SQL/Testing/Cxx/TestSQLiteDatabase.cxx:88:7: warning: variable 'status1' set but not used
/Infovis/Layout/vtkAttributeClustering2DLayoutStrategy.cxx:587:7: warning: variable 'totalCollisionOps' set but not used
/Infovis/Layout/vtkClustering2DLayoutStrategy.cxx:542:7: warning: variable 'totalCollisionOps' set but not used
/Infovis/Layout/vtkCommunity2DLayoutStrategy.cxx:531:7: warning: variable 'totalCollisionOps' set but not used
/Infovis/Layout/vtkConstrained2DLayoutStrategy.cxx:497:7: warning: variable 'totalCollisionOps' set but not used
/Infovis/Layout/vtkFast2DLayoutStrategy.cxx:495:7: warning: variable 'totalCollisionOps' set but not used
/Interaction/Widgets/Testing/Cxx/vtkSeedRepresentationTest1.cxx:48:7: warning: variable 'status' set but not used
/Parallel/DIY/vtkDIYGhostUtilities.cxx:4503:13: warning: variable 'numberOfCells' set but not used
/Rendering/Label/vtkLabelHierarchy.cxx:412:13: warning: variable 'R2' set but not used
/Rendering/Label/vtkLabelPlacementMapper.cxx:606:17: warning: variable 'iteratedLabelArea' set but not used
/Rendering/Label/vtkLabelPlacer.cxx:570:17: warning: variable 'iteratedLabelArea' set but not used
/Wrapping/Tools/vtkParseExtras.c:728:7: warning: variable 'm' set but not used

From here: https://open.cdash.org/viewBuildError.php?type=1&buildid=7661978

Thanks,

Sean

Some of them should be removed, other should be used.
For the one you can’t figure out, I’d suggest using git blame and asking the dev on the related MR directly.

Yes, but figuring out which should be removed vs used is exactly why I’ve written here :slight_smile: Me git blaming each one is labourious. Before resorting to that, I’m hoping the code owners of the various classes I listed can do a triage first.

Cheers,

Sean

Nothing will happen unless somenone does tag personnaly the commiters.

@Yohann_Bearzi could you address these?

I just pushed a fix. https://gitlab.kitware.com/vtk/vtk/-/merge_requests/8794

1 Like

OK, I’ve fixed most of the remaining ones. For your review: https://gitlab.kitware.com/vtk/vtk/-/merge_requests/8809

I’ve git blamed the 4 remaining that I dare not change. git blame gives email, not discourse nor gitlab user names, so I’ve put them below, hopefully some of them are reading here:

Emails missing

Mathieu, what do you mean “email missing”? Does discourse strip out email address as some kind of anti-spam measure? Did you still receive the names and SHAa?

Here is what I see:

There is no email list in your previous message.

I guess it is yet another example of discourse not working well with email. :frowning:

It seems it dropped half my message, specifically everything after a series of dash characters. I though discourse expected markdown? Several dash characters in markdown are supposed to generate a horizontal divider line. Oh well. Here it is again in just plain text, hopefully this works:

Filters/HyperTree/Testing/Cxx/TestHyperTreeGridTernary2DFullMaterialBits.cxx:92:13: warning: variable ‘s’ set but not used

commit 34d55b7fd7c7e0aa210c7b3f0a54e7edebc1dc45
Author: Joachim Pouderoux joachim.pouderoux@kitware.com

Rendering/Label/vtkLabelHierarchy.cxx:412:13: warning: variable ‘R2’ set but not used

commit 6fcb3c2101e35173852afb16b178c5a0af2f97de
Author: Dave Partyka dave.partyka@kitware.com

Rendering/Label/vtkLabelPlacementMapper.cxx:606:17: warning: variable ‘iteratedLabelArea’ set but not used

commit b80680603754890977978c2b92313fea109f8b08
Author: Jeffrey Baumes jeff.baumes@kitware.com

Rendering/Label/vtkLabelPlacer.cxx:570:17: warning: variable ‘iteratedLabelArea’ set but not used

commit 6fcb3c2101e35173852afb16b178c5a0af2f97de
Author: Dave Partyka dave.partyka@kitware.com

https://gitlab.kitware.com/vtk/vtk/-/merge_requests/8811