mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-14 10:34:31 +01:00
tools/check-includes.sh: test that c files include their .h files.
This is best-practice (to ensure prototypes match up), but there were a few places we didn't (at least, directly). Make it a requirement, either of form "foo.h" or <dir/foo.h>. The noise is the change to our print templates. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -56,6 +56,12 @@ for C_FILE in $(filter_suffix c); do
|
||||
echo
|
||||
EXIT_CODE=1
|
||||
fi
|
||||
H_FILE="${C_FILE%.c}.h"
|
||||
H_BASE="$(basename "$H_FILE")"
|
||||
if [ -f "$H_FILE" ] && ! grep -E '#include (<'"$H_FILE"'>|"'"$H_BASE"'")' "$C_FILE" > /dev/null; then
|
||||
echo "${C_FILE} does not include $H_FILE" >& 2
|
||||
EXIT_CODE=1
|
||||
fi
|
||||
done
|
||||
|
||||
exit ${EXIT_CODE}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* This file was generated by generate-wire.py */
|
||||
/* Do not modify this file! Modify the .csv file it was generated from. */
|
||||
|
||||
#include "${options.header_filename}"
|
||||
#include <${header_filename}>
|
||||
#include <ccan/array_size/array_size.h>
|
||||
#include <ccan/mem/mem.h>
|
||||
#include <ccan/tal/str/str.h>
|
||||
|
||||
Reference in New Issue
Block a user