Re: [PATCH iproute2] Add missing headers to the project
From: Maxim Petrov <hidden>
Date: 2021-11-20 20:24:42
Hello Stephen! On 11/20/21 8:26 PM, Stephen Hemminger wrote:
Would be better to do this with an existing tool like IncludeWhatYouUse Is this what you did?
This is my fault, I didn't even think about searching for any existing tools for this task. :) I just wrote a stupid loop over the header files like this:
for hdr in $(find . -name *.h)
do
printf '#include "%s"' $hdr > headertest.c
gcc headertest.c -c -I ./include -I ./include/uapi
done
and then manually patched the files until there are no compilation errors. It seems like I reinvented the wheel and did it not so good. I targeted only header files and fixed only compilation errors, possibly keeping some transitive includes. IWYU looks much better as it targets usage, not just compilation errors. If you can run this tool and fix the whole project automagically, then it is better to ignore my patch. Anyway, thank you for the information, I will definitely try IWYU soon. Max