Skip to content

Fix #12989: Honor attribute cleanup in unusedFunction#6656

Merged
chrchr-github merged 2 commits intocppcheck-opensource:mainfrom
mptre:attribute-cleanup
Aug 6, 2024
Merged

Fix #12989: Honor attribute cleanup in unusedFunction#6656
chrchr-github merged 2 commits intocppcheck-opensource:mainfrom
mptre:attribute-cleanup

Conversation

@mptre
Copy link
Copy Markdown
Contributor

@mptre mptre commented Aug 3, 2024

Gets rid of FPs when a static function is only used with attribute cleanup.

@mptre mptre force-pushed the attribute-cleanup branch from 4e16bfa to 6f8f9a7 Compare August 3, 2024 10:18
@chrchr-github chrchr-github changed the title Honor attribute cleanup in unusedFunction Fix #12989: Honor attribute cleanup in unusedFunction Aug 6, 2024
{
check("void clean(void *ptr) {}\n"
"void * __attribute__((cleanup(clean))) p;\n");
ASSERT_EQUALS("", errout_str());
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The example compiles but results in

<source>:2:27: warning: 'cleanup' attribute only applies to local variables [-Wignored-attributes]
    2 |     void * __attribute__((cleanup(clean))) p;

But it probably doesn't matter for the test.

mptre added 2 commits August 6, 2024 20:42
Gets rid of FPs when a static function is only used with the attribute cleanup.
@mptre mptre force-pushed the attribute-cleanup branch from 6f8f9a7 to d690b9b Compare August 6, 2024 18:42
@mptre
Copy link
Copy Markdown
Contributor Author

mptre commented Aug 6, 2024 via email

@chrchr-github chrchr-github merged commit 7ece4f6 into cppcheck-opensource:main Aug 6, 2024
@mptre mptre deleted the attribute-cleanup branch November 14, 2024 07:44
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