Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cheri_compartment: Warn if return type is void or return value is unused #47

Open
wants to merge 2 commits into
base: cheriot
Choose a base branch
from

Conversation

v01dXYZ
Copy link

@v01dXYZ v01dXYZ commented Nov 15, 2024

Fixes #34.

v01dxyz added 2 commits November 15, 2024 18:32
The current implementation has a little shortcoming: the warning
message for void return type is shown twice because cheri_compartment
is a function type attribute (cf SemaType.cpp) that is added to both
the attribute list of the declarator and the one of the function type.
@v01dXYZ v01dXYZ marked this pull request as ready for review November 15, 2024 23:12
@davidchisnall
Copy link

Thanks for doing this. We are in the middle of rebasing our changes on a newer LLVM, so I’d like to hold off merging until that’s done.

The warning would be better if it is explicit about why it’s a bad idea, rather than saying that it’s unsupported. I’d recommend something like:

void return on a cross-compartment call makes it impossible for callers to detect failure.

A fixit hint that changed the type to int and changed return statements to return 0 (and adds one at the end of the function) would be ideal.

@v01dXYZ
Copy link
Author

v01dXYZ commented Nov 21, 2024

Thank you. I'll look at FixItHint.

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.

Warn if compartment call returns void
2 participants