setup: add setup to make checks

- we've moved tmpctx management to setup.c from daemon.c, so we update
the `check-tmpctx`
- `common_setup(char *)` is now a valid analog for `setup_locale`, so we
check for either in check-setup_locale
This commit is contained in:
niftynei 2020-05-15 17:36:24 -05:00 committed by Rusty Russell
parent fbe50e087a
commit 66f59659a7
2 changed files with 2 additions and 2 deletions

View File

@ -358,7 +358,7 @@ check-setup_locale:
@tools/check-setup_locale.sh
check-tmpctx:
@if git grep -n 'tal_free[(]tmpctx)' | grep -Ev '^ccan/|/test/|^common/daemon.c:|^common/utils.c:'; then echo "Don't free tmpctx!">&2; exit 1; fi
@if git grep -n 'tal_free[(]tmpctx)' | grep -Ev '^ccan/|/test/|^common/setup.c:|^common/utils.c:'; then echo "Don't free tmpctx!">&2; exit 1; fi
check-discouraged-functions:
@if git grep -E "[^a-z_/](fgets|fputs|gets|scanf|sprintf)\(" -- "*.c" "*.h" ":(exclude)ccan/"; then exit 1; fi

View File

@ -2,7 +2,7 @@
EXIT_CODE=0
for FILE in $(git grep -lE 'int main\(' | grep -vE '^ccan/' | grep '.c$'); do
if ! grep -q 'setup_locale();' "${FILE}"; then
if ! grep -q -e 'setup_locale();' -e 'common_setup(argv\[0\]);' "${FILE}"; then
echo "main(...) in ${FILE} does not call setup_locale() (see common/utils.h)"
EXIT_CODE=1
fi