Closed
Description
Affected rules
A16-2-2
Description
The query currently reports redundant includes - e.g. includes which provide used symbols which are provided by earlier includes. I don't believe redundant includes are intended to be flagged by this rule per the justification.
Note: this doesn't occur if a declaration is used in the directly included file. In that case we assume the redundancy is intended. However, if a library is structured so that the public header forwards to an internal header, we can get "spurious" redundancy results.
Example
source.c
#include "a.h"
#include "lib.h" // Seen as useless
void test() {
f();
g();
}
a.h
#include "lib.h"
void g() {
f();
}
lib.h
#include "lib_internal.h"
lib_internal.h
void f();