-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
9 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
name: ultrascan3-cpp-queries | ||
version: 0.0.1 | ||
dependencies: | ||
codeql/cpp-all: "*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
/** | ||
* @name Unused function | ||
* @description Finds unused functions in C/C++ code. | ||
* @description Finds functions in the codebase that are defined but never called. | ||
* @kind problem | ||
* @problem.severity warning | ||
* @id cpp/unused-function | ||
* @tags performance, maintainability | ||
*/ | ||
import cpp | ||
|
||
from Function func | ||
where not func.isExtern() and | ||
not func.isEntryPoint() and | ||
func.getNumberOfCallers() = 0 | ||
where exists(Location loc | func.getLocation() = loc) and | ||
not exists(Call call | call.getTarget() = func) | ||
select func, "This function is never used." |