BUG: Remove return-void-expression that caused dead code (clazy returning-void-expression)#1377
Merged
jamesobutler merged 1 commit intocommontk:masterfrom Mar 28, 2026
Conversation
jamesobutler
approved these changes
Mar 28, 2026
…ning-void-expression) Functions declared as returning void were using 'return f()' where f() is also void. In several cases this pattern prevented signals from ever being emitted: the signal emission appeared after the return statement and was never reached. Affected functions: - ctkErrorLogAbstractModel::setFilePath() — FileLogger signal dead code - ctkDICOMTableView: headerWidget visibility signal unreachable - ctkDICOMVisualBrowserWidget: server removal signals unreachable (3 funcs) - ctkAddRemoveComboBox: combo index/text signals unreachable (2 funcs) - ctkCheckableComboBox: check state signal unreachable - ctkDirectoryButton: icon change signal unreachable - ctkSliderWidget: spinbox alignment signal unreachable Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
6d65d7c to
081e648
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-picked from #1372, part of a systematic clazy static analysis effort to improve CTK for Slicer compatibility and Qt6 migration.
What this changes
Seven functions used
return voidFunc()where the function itself returnsvoid. In several cases, code after the return — includingemitsignal calls — was unreachable dead code. The fix separates the void call from the return statement so all subsequent code executes.Why
Real bugs — signals after
return voidFunc()were silently never emitted. The pattern compiles without warning but is semantically wrong: the return causes an early exit before the signals fire. Identified by the clazyreturning-void-expressioncheck.Testing
🤖 Identified via clazy static analysis using CTK-claude-skills