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

Accurately annotate Error system with [[noreturn]] #8564

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

alexreinking
Copy link
Member

This PR splits the ErrorReport type into two types:

  1. WarningReport, which does not throw/abort on destruction.
  2. ErrorReport, which always throws/aborts on destruction, and is annotated with [[noreturn]].

This makes internal_error a valid statement to use at the end of a function that would otherwise fail to return.

Also applies HALIDE_ALWAYS_INLINE to the operator<< overload because it was getting specialized for every size of const char * literal.

@alexreinking alexreinking requested a review from abadams February 6, 2025 19:58
@abadams
Copy link
Member

abadams commented Feb 6, 2025

Should CompileTimeErrorReporter::error also be annotated?

@alexreinking
Copy link
Member Author

Should CompileTimeErrorReporter::error also be annotated?

I think so, but I think this will force downstreams to add the annotation, too. Is that ok?

@abadams
Copy link
Member

abadams commented Feb 6, 2025

Yes, because it needs to be crystal clear that the method must not return, or there is UB. I suspect the only downstream user is our own python bindings.

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.

2 participants