Browse Source

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
nifty/pset-pre
niftynei 4 years ago
committed by Rusty Russell
parent
commit
66f59659a7
  1. 2
      Makefile
  2. 2
      tools/check-setup_locale.sh

2
Makefile

@ -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

2
tools/check-setup_locale.sh

@ -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

Loading…
Cancel
Save