Skip to content

Commit bc44d3c

Browse files
committed
devtools/reduce-includes.sh: don't remove our own .h from .c file includes.
Even if we would currently include it indirectly, we must include it directly. Signed-off-by: Rusty Russell <[email protected]>
1 parent f6a4e79 commit bc44d3c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

devtools/reduce-includes.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ fi
77

88
CCMD=$(make show-flags | sed -n 's/CC://p')
99
for file; do
10+
# We have a rule (and a check!) that a .c includes its own .h directly.
11+
OWN_HDR='<'$(echo "$file" | sed -n 's/\.c$/.h/p')'>'
1012
i=1
1113
echo "$file":
1214
while true; do
1315
# Don't eliminate config.h includes!
14-
LINE="$(grep '^#include <' "$file" | grep -v '[<"]config.h[">]' | tail -n +$i | head -n1)"
16+
LINE="$(grep '^#include <' "$file" | grep -v '[<"]config.h[">]' | grep -F -v "$OWN_HDR" | tail -n +$i | head -n1)"
1517
[ -n "$LINE" ] || break
1618
# Make sure even headers end in .c
1719
grep -F -v "$LINE" "$file" > "$file".c

0 commit comments

Comments
 (0)