[PATCH] D141310: [clang] add -Wcompare-function-pointers
David Blaikie via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 19 10:37:27 PST 2023
dblaikie added a comment.
>>> It's not that noisy compiling clang (eight hits).
>>
>> Good to know - I'm surprised it's that low.
>>
>> Is there some idiom we can use/document/recommend for people to use when the warning is a false positive? (when the user is confident the functions won't be folded together)
>
> How would the user know the warning is a false positive in the first place?
It's certainly no guarantee (a pathalogical compiler could busybox every function into one function, regardless of how different tnhose functions are) - but likely if the functions have different observable behavior they won't be folded (eg: if they write to different global variables, do different arithmetic, etc). It wouldn't surprise me if people were willing to thread that needle.
If @adriandole's intent is to not thread that needle, and actually remove all function pointer comparisons from a codebase using icf=all, I'd be curious to hear experience of that migration on a large codebase, yeah.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141310/new/
https://reviews.llvm.org/D141310
More information about the cfe-commits
mailing list