Bug 413384 - [checker] Add checker for functions that are declared but not defined
Summary: [checker] Add checker for functions that are declared but not defined
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-codan (show other bugs)
Version: Next   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: CDT Codan Inbox CLA
QA Contact: Elena Laskavaia CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-20 03:40 EDT by Nathan Ridge CLA
Modified: 2016-12-16 12:51 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nathan Ridge CLA 2013-07-20 03:40:09 EDT
When working on a library project, it is useful to be able to check that every function that the library declares is actually implemented somewhere. A codan checker could give a warning for a function that is declared but whose definition cannot be found anywhere in the project.

This checker should probably be off by default as there are many use cases where this checking would not be desirable.
Comment 1 Elena Laskavaia CLA 2014-06-18 20:51:13 EDT
I don't know if generic checker like this really would be useful. 
C/C++ has tons on headers
that declare lots of functions which are not defined in project you
are working on. How does checker would know that this header belong to your
project vs not? Even header physically located in your project it is not guarantee that it does belong to your project. Could be more heuristical approach, like
header declares 10 functions, and 9 of them are defined in the same project and one is not. That probably a good reason to report this kind of issue.
Comment 2 Nathan Ridge CLA 2016-12-16 12:51:31 EST
We could also limit the warning to functions that are called inside the project. That increases the chances that a definition in the project is needed / the absence of a definition would produce a linker error.