mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-17 19:03:42 +01:00
update-mocks: prefer to find function defs from local includes.
This matters for: - common/wallet.h vs wallet/wallet.h - common/gossip_store.h vs gossipd/gossip_store.h - common/json.h vs lightningd/json.h - common/ping.h vs lightningd/ping.h Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
d868d4470a
commit
2e3e4a50ec
@ -1,5 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ $# = 0 ]; then
|
||||
echo 'Usage: mockup.sh <filename> [SYMBOLS...]' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
UPDIRNAME=$(dirname "$(dirname "$1")")
|
||||
shift
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
# With no args, read stdin to scrape compiler output.
|
||||
# shellcheck disable=SC2046
|
||||
@ -29,7 +37,8 @@ fi
|
||||
for SYMBOL; do
|
||||
# If there are multiple declarations, pick first (eg. common/memleak.h
|
||||
# has notleak_ as a declaration, and then an inline).
|
||||
WHERE=$(grep -nH "^[a-zA-Z0-9_ (),]* [*]*$SYMBOL(" ./*/*.h | head -n1)
|
||||
# Also, prefer local headers over generic ones.
|
||||
WHERE=$(shopt -s nullglob; grep -nH "^[a-zA-Z0-9_ (),]* [*]*$SYMBOL(" "$UPDIRNAME"/*.h ./*/*.h | head -n1)
|
||||
if [ x"$WHERE" = x ]; then
|
||||
echo "/* Could not find declaration for $SYMBOL */"
|
||||
continue
|
||||
|
@ -30,7 +30,7 @@ if [ -n "$START" ]; then
|
||||
if grep -q 'too many errors emitted.*-error-limit=0' "${BASE}.err"; then
|
||||
LDFLAGS=-Wl,-error-limit=0 make_binary || :
|
||||
fi
|
||||
tools/mockup.sh < "${BASE}.err" >> "${BASE}.stubs"
|
||||
tools/mockup.sh "$FILE" < "${BASE}.err" >> "${BASE}.stubs"
|
||||
# If there are no link errors, maybe compile fail for other reason?
|
||||
if ! grep -F -q 'Generated stub for' "${BASE}.stubs"; then
|
||||
cat "${BASE}.err"
|
||||
|
Loading…
Reference in New Issue
Block a user