Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive : does not need to be #included with fields of structure #164

Open
catenacyber opened this issue Jun 20, 2022 · 0 comments · May be fixed by #165
Open

False positive : does not need to be #included with fields of structure #164

catenacyber opened this issue Jun 20, 2022 · 0 comments · May be fixed by #165

Comments

@catenacyber
Copy link

Reproducer is 3 files

  • lol.c :
#include "toto.h"
#include <stdio.h>

int main() {
	toto p;
	p.t = 3;
	printf("loli %llx\n", p.t);
	return 0;
}
  • toto.h :
#include "tata.h"

typedef struct toto {
	tata t;
} toto;
  • tata.h :
#include <stdint.h>

typedef int64_t tata;

Program compiles and behaves as expected cf :

clang lol.c
./a.out 

But running cppclean gives a false positive

cppclean toto.h 
toto.h:1: 'tata.h' does not need to be #included

Removing the include fives compilation error :

clang lol.c
In file included from lol.c:1:
./toto.h:4:2: error: unknown type name 'tata'
        tata t;
        ^
1 error generated.
@catenacyber catenacyber linked a pull request Jun 20, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant