handler.c:1:6: warning: The function 'DefaultHandler' should have static linkage since it is not used outside of its translation unit. [staticFunction]
Expected:
No warning for DefaultHandler. compare.c takes its address to
compare against the exported table. Giving the definition internal linkage
would leave that external symbol reference unresolved. The function need not
be called directly to require external linkage.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Reproduction
handler.c:compare.c:Run both translation units together:
Cppcheck 2.22.0
Actual:
Expected:
No warning for
DefaultHandler.compare.ctakes its address tocompare against the exported table. Giving the definition internal linkage
would leave that external symbol reference unresolved. The function need not
be called directly to require external linkage.
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/15189