Fix #14474: Bad varid for global variable matching function pointer argument#8467
Open
ludviggunne wants to merge 3 commits intocppcheck-opensource:mainfrom
Open
Fix #14474: Bad varid for global variable matching function pointer argument#8467ludviggunne wants to merge 3 commits intocppcheck-opensource:mainfrom
ludviggunne wants to merge 3 commits intocppcheck-opensource:mainfrom
Conversation
|
danmar
reviewed
May 1, 2026
|
|
||
| const char code3[] = "extern void (*arr[10])(uint32_t some);\n"; | ||
| const char expected3[] = "1: extern void ( * arr@1 [ 10 ] ) ( uint32_t some@2 ) ;\n"; | ||
| const char expected3[] = "1: extern void ( * arr@1 [ 10 ] ) ( uint32_t some ) ;\n"; |
Collaborator
There was a problem hiding this comment.
I am not against that no varid is set but it's not clear here in the test why there shouldn't be a varid. We could add a varid tomorrow and feel satisfied that it works properly.
I think the example code in 14474 should be added. Either we should set no varid or we should set a unique varid.
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.



This makes it so that varids for function pointer parameters are not set at all, AFAIK they can't be referred to anywhere else anyway. An alternative would be to always give it a unique varid, for the same reason.