Browse Source

update-mocks: make mocks compile with -Wunused

Do this by scattering UNNEEDED everywhere, except in the case of (void).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 9 years ago
parent
commit
6fe5ecb2ac
  1. 8
      daemon/test/run-maxfee.c
  2. 2
      daemon/test/scripts/mockup.sh

8
daemon/test/run-maxfee.c

@ -5,14 +5,14 @@
/* AUTOGENERATED MOCKS START */
/* Generated stub for db_new_htlc */
bool db_new_htlc(struct peer *peer, const struct htlc *htlc)
bool db_new_htlc(struct peer *peer UNNEEDED, const struct htlc *htlc UNNEEDED)
{ fprintf(stderr, "db_new_htlc called!\n"); abort(); }
/* Generated stub for db_update_htlc_state */
bool db_update_htlc_state(struct peer *peer, const struct htlc *htlc,
enum htlc_state oldstate)
bool db_update_htlc_state(struct peer *peer UNNEEDED, const struct htlc *htlc UNNEEDED,
enum htlc_state oldstate UNNEEDED)
{ fprintf(stderr, "db_update_htlc_state called!\n"); abort(); }
/* Generated stub for log_ */
void log_(struct log *log, enum log_level level, const char *fmt, ...)
void log_(struct log *log UNNEEDED, enum log_level level UNNEEDED, const char *fmt UNNEEDED, ...)
{ fprintf(stderr, "log_ called!\n"); abort(); }
/* AUTOGENERATED MOCKS END */

2
daemon/test/scripts/mockup.sh

@ -35,5 +35,5 @@ for SYMBOL; do
END=$(tail -n +$LINE < $FILE | grep -n ';$');
NUM=${END%%:*}
tail -n +$LINE < $FILE | head -n $NUM | sed 's/^extern *//' | sed 's/PRINTF_FMT([^)]*)//' | sed "s/;\$/$STUB/"
tail -n +$LINE < $FILE | head -n $NUM | sed 's/^extern *//' | sed 's/PRINTF_FMT([^)]*)//' | sed 's/,/ UNNEEDED,/g' | sed 's/\([a-z0-9A-Z*_]* [a-z0-9A-Z*_]*\));/\1 UNNEEDED);/' | sed "s/;\$/$STUB/"
done

Loading…
Cancel
Save