-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Honor library ignorefunction() settings when reporting unused functions. #8130
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
base: main
Are you sure you want to change the base?
Conversation
This change updates CheckUnusedFunctions to skip functions explicitly marked as ignored by the library configuration, both during per-file checks and whole-program analysis. This prevents false positives for known framework hooks, callbacks, or externally-used symbols that should be intentionally excluded from unused-function diagnostics. Signed-off-by: Robin Getz <[email protected]>
b08bd93 to
cd49158
Compare
|
|
Currently, the attribute is used in |
|
Thanks for pointing this out. You’re right that which implies this attribute is intended to be a general library configuration signal rather than something check-specific or accidental. (happy to be corrected in my understanding if I'm wrong). Given that:
…using it to suppress unused-function diagnostics seems consistent with the schema-level intent: “this function should be ignored by certain analyses.” Today, unused-function reporting ignores that signal, which leads to false positives even when the user has explicitly annotated the function in the library config... That said, I agree on two points:
If folks prefer to keep Just let me know. |
|
@danmar Do you know anything about the |
|
I don't remember specifics about I don't know if that is OK for you but can't some "maybe_unused" attribute be used on functions? |
|
yeah, on further reflection, I don't want the function to be ignored (all tests should run), I just didn't want it to show up in the I think what would be more natural is something that maybe reuses where the suppress is similar to the inline comment Let me know the preferred direction, and I will see what I can do... |



This change updates CheckUnusedFunctions to skip functions explicitly marked as ignored by the library configuration, both during per-file checks and whole-program analysis. This prevents false positives for known framework hooks, callbacks, or externally-used symbols that should be intentionally excluded from unused-function diagnostics.
I have found this very useful when looking at libraries, and creating a
self.cfgfile which looks like: