Skip to content

Kingxukai/check-unused-headers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Introduction

This is a simple script to check whether there are any unsed headers in C code file.

Demonstrate

Linux driver code Test project

Install

git clone https://github.com/Kingxukai/check-unused-headers.git

Usage

$ cuh --help
  1. First method
$ which python3
/path/to/python3

use this path in the script first line and then

$ ./cuh file.c
or
$ mkdir -p /usr/local/script
$ cp cuh /usr/local/script/
$ export PATH=/usr/local/script/:$PATH
$ cuh file.c
  1. Second method
python3 ./cuh file.c

Current Problem

This tool cannot detect structures defined like this:

/* headers.h */
struct values {
	int a;
	int b;
};

Instead, it incorrectly detects the following:

{'struct values;', 'int a;', 'int b;' }

If you encounter any other issues, feel free to open an issue!

Compare to include-what-you-use

This tool is simpler but less stable
include-what-you-use
include-what-you-use

About

A small script to check unused headers in C code files.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages