Skip to content

Use standard C++ timer for long timeouts (#1327), remove unused code#1328

Merged
uweseimet merged 9 commits intodevelopfrom
issue_1327
Nov 14, 2023
Merged

Use standard C++ timer for long timeouts (#1327), remove unused code#1328
uweseimet merged 9 commits intodevelopfrom
issue_1327

Conversation

@uweseimet
Copy link
Copy Markdown
Contributor

No description provided.

@uweseimet uweseimet linked an issue Nov 9, 2023 that may be closed by this pull request
@uweseimet uweseimet requested a review from dialtr November 9, 2023 17:48
@uweseimet uweseimet changed the title Use standard C++ timer for long timeouts (#1327) Use standard C++ timer for long timeouts (#1327), remove unused code Nov 11, 2023
@uweseimet uweseimet marked this pull request as ready for review November 11, 2023 15:44
@sonarqubecloud
Copy link
Copy Markdown

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

Copy link
Copy Markdown
Member

@rdmark rdmark left a comment

Choose a reason for hiding this comment

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

Was it Sonar that made you aware of the bitrotted code?

enum class mode_e {
TARGET = 0,
INITIATOR = 1,
MONITOR = 2,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is not used by scsimon?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No, it is not. Otherwise it would already break when compiling. You know how much I like to repeat that there is a lot of unused code ;-).

@uweseimet
Copy link
Copy Markdown
Contributor Author

uweseimet commented Nov 14, 2023

Was it Sonar that made you aware of the bitrotted code?

No, I stumble upon this when reviewing and cleaning up the existing code. Only recently I also started with that for the code in hal. Often, as soon as you remove an unused method, for instance, another unused method or field pops up, which before was only used by the unused code you have just removed. And so on ...
And code I do not immediately understand is also quite often not needed. This is not a joke.

@uweseimet uweseimet merged commit baf89dc into develop Nov 14, 2023
@uweseimet uweseimet deleted the issue_1327 branch November 14, 2023 15:03
@rdmark
Copy link
Copy Markdown
Member

rdmark commented Nov 14, 2023

Was it Sonar that made you aware of the bitrotted code?

No, I stumble upon this when reviewing and cleaning up the existing code. Only recently I also started with that for the code in hal. Often, as soon as you remove an unused method, for instance, another unused method or field pops up, which before was only used by the unused code you have just removed. And so on ...

And code I do not immediately understand is also quite often not needed. This is not a joke.

Have you tried using cppcheck for finding dead code through static analysis? I've seen it being effective in another project with a very old code base.

@uweseimet
Copy link
Copy Markdown
Contributor Author

Was it Sonar that made you aware of the bitrotted code?

No, I stumble upon this when reviewing and cleaning up the existing code. Only recently I also started with that for the code in hal. Often, as soon as you remove an unused method, for instance, another unused method or field pops up, which before was only used by the unused code you have just removed. And so on ...
And code I do not immediately understand is also quite often not needed. This is not a joke.

Have you tried using cppcheck for finding dead code through static analysis? I've seen it being effective in another project with a very old code base.

I have never heard of cppcheck. Sounds like it is something I should try.

uweseimet added a commit that referenced this pull request Nov 14, 2023
…1328)

* Replace timer in WaitSignal()

' Remove unused code

* Remove unused file
uweseimet added a commit that referenced this pull request Nov 14, 2023
…1328)

* Replace timer in WaitSignal()

' Remove unused code

* Remove unused file
uweseimet added a commit that referenced this pull request Nov 15, 2023
…1328)

* Replace timer in WaitSignal()

' Remove unused code

* Remove unused file
@uweseimet
Copy link
Copy Markdown
Contributor Author

uweseimet commented Nov 17, 2023

Was it Sonar that made you aware of the bitrotted code?

No, I stumble upon this when reviewing and cleaning up the existing code. Only recently I also started with that for the code in hal. Often, as soon as you remove an unused method, for instance, another unused method or field pops up, which before was only used by the unused code you have just removed. And so on ...
And code I do not immediately understand is also quite often not needed. This is not a joke.

Have you tried using cppcheck for finding dead code through static analysis? I've seen it being effective in another project with a very old code base.

Just tried gcccheck. It takes less than 4 seconds on my PC. And indeed it found unused code and redundant assignments and a redundant condition. Not that many code locations, but SonarCloud did not find them.
Not surprisingly almost everything reported refered to cfilesystem.c, where SonarCloud also reports about 100 issues.

rdmark pushed a commit that referenced this pull request May 1, 2024
…1328)

* Replace timer in WaitSignal()

' Remove unused code

* Remove unused file
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.

Use standard C++ timer for long timeouts

2 participants