Repository navigation
Conversation
This branch has not been deployed
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.
Fixes #3489. Thanks to @lwz23 for the report.
For
void (__attribute__((noreturn)) *take(int t))(int);libclang spells the function type asvoid (*(int))(int) __attribute__((noreturn)).FunctionSig::from_tylooks for__attribute__((noreturn))at parenthesis depth 0 of that spelling, but here the attribute belongs to the pointed-to function type, not totake, sotakewas emitted as-> !.When the return type is spelled as a raw function pointer, the function's own attributes follow its parameters inside the
(*...)group, e.g.void (*(int) __attribute__((noreturn)))(int) __attribute__((noreturn))for a function that is noreturn itself. So in that case the check now looks at depth 1 instead of 0. A return type spelled through a typedef (fp (int) __attribute__((noreturn))) and plain functions keep the depth-0 check, and argument attributes (the #2715/#2716 case) stay at depth 2+.The header test covers
take, a noreturn function returning a noreturn function pointer, the typedef'd return with and without noreturn, and a plain noreturn function. Onlytakechanges compared to main; the test fails without the change.Replaces #3537, which got closed when my fork was accidentally detached.