GLIBChecker is a tool designed to check the usage of LibC functions in a C++ project.
It checks if there are LibC functions in your binary which are used without namespace in your code.
It also checks if you are using exit
(see Features to ignore it).
- ripgrep
- nm (should be installed on your system by default)
- CMake (if you want to compile by yourself, 3.27 or higher*)
*if you have lower version, you can try to change the first line of CMakeLists.txt
with your version
Clone the project (or get it in releases)
git clone https://github.com/Clement-Z4RM/GLIBChecker.git
Go to the project directory
cd GLIBChecker
Install the binary
make install
If your cmake executable is not in your PATH, you can do:
make install CMAKE=<your cmake path>
Launch it with binary file as argument
glib_checker <binary>
Set GLIBCHECKER_IGNORE
environment variable with files, function,... like this:
GLIBCHECKER_IGNORE="./src/Foo.cpp" glibchecker foo
Here are the patterns taken into account:
- Function (e.g.: "foo")
- File (e.g.: "./src/Foo.cpp")
- Folder (e.g.: "./src/")
- File:Line (e.g.: "./src/Foo.cpp:42")
- File:Function (e.g.: "./src/Foo.cpp:foo")
- File:Line:Function (e.g.: "./src/Foo.cpp:42:foo") The file must be relative to your current directory, and must have the same format as in the GLIBChecker output.
Patterns must be space-separated.
You can use this tool in your GitHub Actions workflow. To have the error message in the GitHub Actions summary, you can set the GLIBCHECKER_GH_ACTIONS
environment variable:
GLIBCHECKER_GH_ACTIONS= glib_checker <binary>
If you find a bug, you can report it creating an issue or fix it creating a pull request.
Contributions are always welcome!
You can open an issue or create a pull request.
Also, you can check the to-do list to see planned features.