Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@mazunki
Copy link
Contributor

@mazunki mazunki commented Oct 18, 2025

This PR silences several benign warnings related to unused variables and parameters, and fixes a misuse of assert() in vmbuild.

There are still two cases of unused parameters/variables:

/build/source/src/kernel/events.cpp:42:19: warning: unused variable 'lock' [-Wunused-variable]
/build/source/src/musl/getrandom.cpp:5:63: warning: unused parameter 'flags' [-Wunused-parameter]

Both of these are bugs (if not, this must be documented!), and not the compiler being wrong. I have added proper TODO: and FIXME: label to them.

@mazunki
Copy link
Contributor Author

mazunki commented Oct 18, 2025

These were discovered by running nix-build 2>&1 | grep -v 'supplying the --target x86_64' | grep -i -e error: -e warning:

Running tests exposes even more unused stuff. That said, this passes all tests still.

I have opened martinmoene/lest#82 to handle some warnings which aren't our fault.

@mazunki mazunki force-pushed the fix-silence-unused-parameters branch from f16b27a to a3e65a9 Compare October 18, 2025 17:14
@mazunki
Copy link
Contributor Author

mazunki commented Oct 18, 2025

All is still good. I will push some more changes related to tests on another PR.

@mazunki mazunki force-pushed the fix-silence-unused-parameters branch from a3e65a9 to 597213b Compare October 18, 2025 17:27
@mazunki mazunki force-pushed the fix-silence-unused-parameters branch from 597213b to b6e034a Compare October 18, 2025 17:28
@mazunki
Copy link
Contributor Author

mazunki commented Oct 18, 2025

Something weird happened with the last rebase, sorry about that. Fixed and tested.

@mazunki mazunki force-pushed the fix-silence-unused-parameters branch from b6e034a to 7e9d8ce Compare October 18, 2025 18:18
@mazunki
Copy link
Contributor Author

mazunki commented Oct 18, 2025

Missed one. tests == ✨

@mazunki
Copy link
Contributor Author

mazunki commented Oct 19, 2025

It got merged, yippie! Last tagged release was 2023. I don't expect they'll update anytime soon. We just pin the version to the commit hash. Tests are still ok with this.

@mazunki mazunki force-pushed the fix-silence-unused-parameters branch from 4259c9d to 90e5410 Compare October 21, 2025 11:00
@mazunki
Copy link
Contributor Author

mazunki commented Oct 21, 2025

lest got a tagged release. No need to pick reference an arbitrary commit anymore. This should be ready for merge now :)

Copy link
Contributor

@alfreb alfreb left a comment

Choose a reason for hiding this comment

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

This is great! We were waiting for [[maybe_unused]] to arrive.

I don't understand the (void) found_kernel_start; - do you? If you do and can explain it we're all good.

#ifdef PLATFORM_x86_solo5
solo5_exec(blob.data(), blob.size());
throw std::runtime_error("solo5_exec returned");
(void) found_kernel_start;
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand this code 😅 what does it do

Copy link
Contributor Author

@mazunki mazunki Oct 22, 2025

Choose a reason for hiding this comment

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

(void) anything; just casts it to nothing. It's an explicit way of marking a variable used without actually doing anything with it at runtime.

I would have added [[maybe_unused]] to it at the top level, but I am not sure if found_kernel_start makes sense on systems other than x86. If new architectures are added, it should be up to them to mark it as irrelevant for the corresponding subsystems.

I added these void-casts under the assumption that the previous code here actually is correct in ignoring it. That could be wrong.

@MagnusS MagnusS merged commit c8ae3ff into includeos:main Oct 27, 2025
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.

3 participants