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:
Rusty Russell 2021-09-16 14:20:02 +09:30
parent d970cc070e
commit 00a0d09340
47 changed files with 55 additions and 45 deletions

View File

@ -1179,4 +1179,4 @@ bool fromwire_channeld_blockheight(const void *p, u32 *blockheight)
*blockheight = fromwire_u32(&cursor, &plen);
return cursor != NULL;
}
// SHA256STAMP:d00ca466d1339c66bbed6afc95227ca89177dab02344de8e333cc11f85e82cd9
// SHA256STAMP:f02f2fc72a5382fd545bdcd1789d873d1619baefea7f26d0bde92b5091b5b880

View File

@ -241,4 +241,4 @@ bool fromwire_channeld_blockheight(const void *p, u32 *blockheight);
#endif /* LIGHTNING_CHANNELD_CHANNELD_WIREGEN_H */
// SHA256STAMP:d00ca466d1339c66bbed6afc95227ca89177dab02344de8e333cc11f85e82cd9
// SHA256STAMP:f02f2fc72a5382fd545bdcd1789d873d1619baefea7f26d0bde92b5091b5b880

View File

@ -235,4 +235,4 @@ bool fromwire_closingd_complete(const void *p)
return false;
return cursor != NULL;
}
// SHA256STAMP:0602a002b81e43b45a8c40a15cb4af6c5e7ea66d6f95b7ba89f386b2fe73bd0e
// SHA256STAMP:8b3f45f8221281390e4e8883d07c55f9723f4bf08356dcd63f537dc30ca7b75f

View File

@ -64,4 +64,4 @@ bool fromwire_closingd_complete(const void *p);
#endif /* LIGHTNING_CLOSINGD_CLOSINGD_WIREGEN_H */
// SHA256STAMP:0602a002b81e43b45a8c40a15cb4af6c5e7ea66d6f95b7ba89f386b2fe73bd0e
// SHA256STAMP:8b3f45f8221281390e4e8883d07c55f9723f4bf08356dcd63f537dc30ca7b75f

View File

@ -1,5 +1,6 @@
#include <ccan/array_size/array_size.h>
#include <common/htlc.h>
#include <common/htlc_state.h>
#include "htlc_state_names_gen.h"
const char *htlc_state_name(enum htlc_state s)

View File

@ -3,6 +3,7 @@
#include <ccan/array_size/array_size.h>
#include <ccan/cast/cast.h>
#include <common/ecdh.h>
#include <common/onion.h>
#include <common/sphinx.h>
#include <sodium/crypto_aead_chacha20poly1305.h>
#include <wire/onion_wire.h>

View File

@ -80,4 +80,4 @@ bool fromwire_status_peer_error(const tal_t *ctx, const void *p, struct channel_
fromwire_u8_array(&cursor, &plen, *error_for_them, len);
return cursor != NULL;
}
// SHA256STAMP:a247441c5a012c0dcaab043780943604354ff5c4f360f83b87fcea94816eab8e
// SHA256STAMP:3e1d1ae6327232326b2a08f788c59485e0c4abd37bdb55604f111e087f605520

View File

@ -34,4 +34,4 @@ bool fromwire_status_peer_error(const tal_t *ctx, const void *p, struct channel_
#endif /* LIGHTNING_COMMON_PEER_STATUS_WIREGEN_H */
// SHA256STAMP:a247441c5a012c0dcaab043780943604354ff5c4f360f83b87fcea94816eab8e
// SHA256STAMP:3e1d1ae6327232326b2a08f788c59485e0c4abd37bdb55604f111e087f605520

View File

@ -1,6 +1,6 @@
#include "common/psbt_internal.h"
#include <bitcoin/script.h>
#include <ccan/ccan/tal/tal.h>
#include <common/psbt_internal.h>
#include <common/psbt_open.h>
#include <wally_psbt.h>
#include <wire/peer_wire.h>

View File

@ -1,4 +1,4 @@
#include "common/psbt_open.h"
#include "config.h"
#include <assert.h>
#include <bitcoin/psbt.h>
#include <bitcoin/script.h>
@ -6,6 +6,7 @@
#include <ccan/asort/asort.h>
#include <ccan/ccan/endian/endian.h>
#include <ccan/ccan/mem/mem.h>
#include <common/psbt_open.h>
#include <common/pseudorand.h>
#include <common/utils.h>

View File

@ -214,4 +214,4 @@ bool fromwire_status_version(const tal_t *ctx, const void *p, wirestring **versi
*version = fromwire_wirestring(ctx, &cursor, &plen);
return cursor != NULL;
}
// SHA256STAMP:9a7b4598fad40c5df016c17464c3c8f7b067a17eb993cc65fea42486e3ffb3f7
// SHA256STAMP:83a462b28754c5b0c5a496b7e719f15ef6f6c1560f0eea12f76fa4b114189caa

View File

@ -58,4 +58,4 @@ bool fromwire_status_version(const tal_t *ctx, const void *p, wirestring **versi
#endif /* LIGHTNING_COMMON_STATUS_WIREGEN_H */
// SHA256STAMP:9a7b4598fad40c5df016c17464c3c8f7b067a17eb993cc65fea42486e3ffb3f7
// SHA256STAMP:83a462b28754c5b0c5a496b7e719f15ef6f6c1560f0eea12f76fa4b114189caa

View File

@ -161,4 +161,4 @@ bool fromwire_gossipd_get_addrs_reply(const tal_t *ctx, const void *p, struct wi
fromwire_wireaddr(&cursor, &plen, *addrs + i);
return cursor != NULL;
}
// SHA256STAMP:69dd930932c97655f56c92bd396446582b149e27ca26e0dcd3a29005ea078158
// SHA256STAMP:a03f3546c6a3dc0ee7055ba912fffd6acf9dc86bb9dc4472ecfc240582709481

View File

@ -54,4 +54,4 @@ bool fromwire_gossipd_get_addrs_reply(const tal_t *ctx, const void *p, struct wi
#endif /* LIGHTNING_CONNECTD_CONNECTD_GOSSIPD_WIREGEN_H */
// SHA256STAMP:69dd930932c97655f56c92bd396446582b149e27ca26e0dcd3a29005ea078158
// SHA256STAMP:a03f3546c6a3dc0ee7055ba912fffd6acf9dc86bb9dc4472ecfc240582709481

View File

@ -443,4 +443,4 @@ bool fromwire_connectd_dev_memleak_reply(const void *p, bool *leak)
*leak = fromwire_bool(&cursor, &plen);
return cursor != NULL;
}
// SHA256STAMP:3b0f7e87bf73dc1fd4f7181f61fc648f2fc0c4aad946edc9d9c80d90c99e9bcf
// SHA256STAMP:f10d8c579846bdad3caee38596f5b3a89af7f0be89ab569175045e9375ada5d0

View File

@ -110,4 +110,4 @@ bool fromwire_connectd_dev_memleak_reply(const void *p, bool *leak);
#endif /* LIGHTNING_CONNECTD_CONNECTD_WIREGEN_H */
// SHA256STAMP:3b0f7e87bf73dc1fd4f7181f61fc648f2fc0c4aad946edc9d9c80d90c99e9bcf
// SHA256STAMP:f10d8c579846bdad3caee38596f5b3a89af7f0be89ab569175045e9375ada5d0

View File

@ -1,5 +1,5 @@
#include "libhsmd_python.h"
#include <ccan/str/hex/hex.h>
#include <libhsmd_python.h>
#include <common/setup.h>
char *init(char *hex_hsm_secret, char *network_name) {

View File

@ -210,4 +210,4 @@ bool fromwire_gossipd_local_add_channel_obs(const tal_t *ctx, const void *p, str
fromwire_u8_array(&cursor, &plen, *features, flen);
return cursor != NULL;
}
// SHA256STAMP:f145d927f4dfe0434bf705f22e3cfae212f96ef95c1cd4dc31fe53c000ef5adb
// SHA256STAMP:15e0760c876736aaf08229c33e7615b20e6a35790fb8d72d09ecc31a472bf783

View File

@ -63,4 +63,4 @@ bool fromwire_gossipd_local_add_channel_obs(const tal_t *ctx, const void *p, str
#endif /* LIGHTNING_GOSSIPD_GOSSIP_STORE_WIREGEN_H */
// SHA256STAMP:f145d927f4dfe0434bf705f22e3cfae212f96ef95c1cd4dc31fe53c000ef5adb
// SHA256STAMP:15e0760c876736aaf08229c33e7615b20e6a35790fb8d72d09ecc31a472bf783

View File

@ -161,4 +161,4 @@ bool fromwire_gossipd_local_channel_announcement(const tal_t *ctx, const void *p
fromwire_u8_array(&cursor, &plen, *cannount, len);
return cursor != NULL;
}
// SHA256STAMP:b3c6474e393f3aa6427a63a1b1ad873badc6d0592ae8247add28a099815cdbdd
// SHA256STAMP:01c31e7629455bd51aa1e3b5180ac28a195700762dd1854f17785894ad330c17

View File

@ -57,4 +57,4 @@ bool fromwire_gossipd_local_channel_announcement(const tal_t *ctx, const void *p
#endif /* LIGHTNING_GOSSIPD_GOSSIPD_PEERD_WIREGEN_H */
// SHA256STAMP:b3c6474e393f3aa6427a63a1b1ad873badc6d0592ae8247add28a099815cdbdd
// SHA256STAMP:01c31e7629455bd51aa1e3b5180ac28a195700762dd1854f17785894ad330c17

View File

@ -777,4 +777,4 @@ bool fromwire_gossipd_new_lease_rates(const void *p, struct lease_rates *rates)
fromwire_lease_rates(&cursor, &plen, rates);
return cursor != NULL;
}
// SHA256STAMP:1e4178d4f98e129e7779fd49321404eb7ec8bad4ca58655ed7e3039be9b24fe0
// SHA256STAMP:ff8acca08dcaf1e1347cfd49c575c2df6ab9eb9c85a25b15ad7dbb6c181213b6

View File

@ -188,4 +188,4 @@ bool fromwire_gossipd_new_lease_rates(const void *p, struct lease_rates *rates);
#endif /* LIGHTNING_GOSSIPD_GOSSIPD_WIREGEN_H */
// SHA256STAMP:1e4178d4f98e129e7779fd49321404eb7ec8bad4ca58655ed7e3039be9b24fe0
// SHA256STAMP:ff8acca08dcaf1e1347cfd49c575c2df6ab9eb9c85a25b15ad7dbb6c181213b6

View File

@ -1331,4 +1331,4 @@ bool fromwire_hsmd_sign_option_will_fund_offer_reply(const void *p, secp256k1_ec
fromwire_secp256k1_ecdsa_signature(&cursor, &plen, rsig);
return cursor != NULL;
}
// SHA256STAMP:a4574dbaca95afe998846ff0252826cb9ec827a614eb8018c7decfb2c863f377
// SHA256STAMP:739903bb8c5fedb86d1d35fea7b926f35b117d9cfdb5e3e8e1f62ddca731f54b

View File

@ -295,4 +295,4 @@ bool fromwire_hsmd_sign_option_will_fund_offer_reply(const void *p, secp256k1_ec
#endif /* LIGHTNING_HSMD_HSMD_WIREGEN_H */
// SHA256STAMP:a4574dbaca95afe998846ff0252826cb9ec827a614eb8018c7decfb2c863f377
// SHA256STAMP:739903bb8c5fedb86d1d35fea7b926f35b117d9cfdb5e3e8e1f62ddca731f54b

View File

@ -1,4 +1,4 @@
#include "lightningd/io_loop_with_timers.h"
#include "io_loop_with_timers.h"
#include <ccan/io/io.h>
#include <ccan/timer/timer.h>

View File

@ -18,6 +18,7 @@
#include <common/utils.h>
#include <gossipd/routing.h>
#include <lightningd/chaintopology.h>
#include <lightningd/json.h>
#include <lightningd/jsonrpc.h>
#include <lightningd/options.h>
#include <sys/socket.h>

View File

@ -639,4 +639,4 @@ bool fromwire_onchaind_notify_coin_mvt(const void *p, struct chain_coin_mvt *mvt
fromwire_chain_coin_mvt(&cursor, &plen, mvt);
return cursor != NULL;
}
// SHA256STAMP:bc0704404825187064ec3c7721098bdf5f2ccf07e9b7c3262474f3c8275f5a40
// SHA256STAMP:407c8ab97dba44866916b0c6285f608a26f727a7bc575365b7e48729594121e1

View File

@ -161,4 +161,4 @@ bool fromwire_onchaind_notify_coin_mvt(const void *p, struct chain_coin_mvt *mvt
#endif /* LIGHTNING_ONCHAIND_ONCHAIND_WIREGEN_H */
// SHA256STAMP:bc0704404825187064ec3c7721098bdf5f2ccf07e9b7c3262474f3c8275f5a40
// SHA256STAMP:407c8ab97dba44866916b0c6285f608a26f727a7bc575365b7e48729594121e1

View File

@ -1051,4 +1051,4 @@ bool fromwire_dualopend_validate_lease_reply(const tal_t *ctx, const void *p, wi
}
return cursor != NULL;
}
// SHA256STAMP:4f00f3d34c3e8137837cf975ff52c868901b17ce0bc72efa61a561b0bb29fb07
// SHA256STAMP:da973afd41ef15546d902945a3108aa3c02571d13ffaff0aed63c1ac39740f04

View File

@ -225,4 +225,4 @@ bool fromwire_dualopend_validate_lease_reply(const tal_t *ctx, const void *p, wi
#endif /* LIGHTNING_OPENINGD_DUALOPEND_WIREGEN_H */
// SHA256STAMP:4f00f3d34c3e8137837cf975ff52c868901b17ce0bc72efa61a561b0bb29fb07
// SHA256STAMP:da973afd41ef15546d902945a3108aa3c02571d13ffaff0aed63c1ac39740f04

View File

@ -608,4 +608,4 @@ bool fromwire_openingd_dev_memleak_reply(const void *p, bool *leak)
*leak = fromwire_bool(&cursor, &plen);
return cursor != NULL;
}
// SHA256STAMP:f1728e2b3e5e2001e7620e23b0d1c1d359569684fd7d585b6f4471d1abeb332c
// SHA256STAMP:728c4fe1f57fe55a1d7669ec138002ae1ffa61813549bddcc5a07a994ea7211f

View File

@ -129,4 +129,4 @@ bool fromwire_openingd_dev_memleak_reply(const void *p, bool *leak);
#endif /* LIGHTNING_OPENINGD_OPENINGD_WIREGEN_H */
// SHA256STAMP:f1728e2b3e5e2001e7620e23b0d1c1d359569684fd7d585b6f4471d1abeb332c
// SHA256STAMP:728c4fe1f57fe55a1d7669ec138002ae1ffa61813549bddcc5a07a994ea7211f

View File

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

View File

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

View File

@ -1684,4 +1684,4 @@ bool invoice_error_is_valid(const struct tlv_invoice_error *record, size_t *err_
return tlv_fields_valid(record->fields, NULL, err_index);
}
// SHA256STAMP:148a2f3fb6e0148409b1a86d22febab73d290e33b697b803f2d46ddcb61290ac
// SHA256STAMP:a2c41aa239904c7cbfe50e576e6724eedb50fff1e1014ac80912aa195ed8e912

View File

@ -323,4 +323,4 @@ struct fallback_address *fromwire_fallback_address(const tal_t *ctx, const u8 **
#endif /* LIGHTNING_WIRE_BOLT12_WIREGEN_H */
// SHA256STAMP:148a2f3fb6e0148409b1a86d22febab73d290e33b697b803f2d46ddcb61290ac
// SHA256STAMP:a2c41aa239904c7cbfe50e576e6724eedb50fff1e1014ac80912aa195ed8e912

View File

@ -100,4 +100,4 @@ bool fromwire_custommsg_out(const tal_t *ctx, const void *p, u8 **msg)
fromwire_u8_array(&cursor, &plen, *msg, msg_len);
return cursor != NULL;
}
// SHA256STAMP:fbe11d774ac183c6d77a14e451214f167d0d7205f656ddff1d6a96c40bfd0326
// SHA256STAMP:c605fef4b00d9d261397e1e1decd2b59ee06e64cec4fc0d175c56aa598e0fc31

View File

@ -41,4 +41,4 @@ bool fromwire_custommsg_out(const tal_t *ctx, const void *p, u8 **msg);
#endif /* LIGHTNING_WIRE_COMMON_WIREGEN_H */
// SHA256STAMP:fbe11d774ac183c6d77a14e451214f167d0d7205f656ddff1d6a96c40bfd0326
// SHA256STAMP:c605fef4b00d9d261397e1e1decd2b59ee06e64cec4fc0d175c56aa598e0fc31

View File

@ -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 "wire/onion_printgen.h"
#include <wire/onion_printgen.h>
#include <ccan/array_size/array_size.h>
#include <ccan/mem/mem.h>
#include <ccan/tal/str/str.h>
@ -859,4 +859,4 @@ void printonion_wire_tlv_message(const char *tlv_name, const u8 *msg) {
printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_encmsg_tlvs, ARRAY_SIZE(print_tlvs_encmsg_tlvs));
}
}
// SHA256STAMP:fd460361e76105eb612f69f2a3f27e70115c0ebdad82785f2c852c13f9c08c8d
// SHA256STAMP:1425ef44095bc90c4b405497ade727e41d6cde27c1f6e64c8d7239036410dd30

View File

@ -58,4 +58,4 @@ void printwire_mpp_timeout(const char *fieldname, const u8 *cursor);
void printwire_onionmsg_path(const char *fieldname, const u8 **cursor, size_t *plen);
#endif /* LIGHTNING_WIRE_ONION_PRINTGEN_H */
// SHA256STAMP:fd460361e76105eb612f69f2a3f27e70115c0ebdad82785f2c852c13f9c08c8d
// SHA256STAMP:1425ef44095bc90c4b405497ade727e41d6cde27c1f6e64c8d7239036410dd30

View File

@ -1026,4 +1026,4 @@ bool fromwire_mpp_timeout(const void *p)
return false;
return cursor != NULL;
}
// SHA256STAMP:fd460361e76105eb612f69f2a3f27e70115c0ebdad82785f2c852c13f9c08c8d
// SHA256STAMP:1425ef44095bc90c4b405497ade727e41d6cde27c1f6e64c8d7239036410dd30

View File

@ -317,4 +317,4 @@ bool fromwire_mpp_timeout(const void *p);
#endif /* LIGHTNING_WIRE_ONION_WIREGEN_H */
// SHA256STAMP:fd460361e76105eb612f69f2a3f27e70115c0ebdad82785f2c852c13f9c08c8d
// SHA256STAMP:1425ef44095bc90c4b405497ade727e41d6cde27c1f6e64c8d7239036410dd30

View File

@ -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 "wire/peer_printgen.h"
#include <wire/peer_printgen.h>
#include <ccan/array_size/array_size.h>
#include <ccan/mem/mem.h>
#include <ccan/tal/str/str.h>
@ -3139,4 +3139,4 @@ void printpeer_wire_tlv_message(const char *tlv_name, const u8 *msg) {
printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_onion_message_tlvs, ARRAY_SIZE(print_tlvs_onion_message_tlvs));
}
}
// SHA256STAMP:d2dbf0b5768a6a6c940a353621f8a0521f49104c99d7f5d350c500587a7d54c4
// SHA256STAMP:80b32650a8208ef15d83ebecbb3bae3c321fdc8594802de10847ae95f2169952

View File

@ -99,4 +99,4 @@ void printwire_channel_update_checksums(const char *fieldname, const u8 **cursor
void printwire_channel_update_timestamps(const char *fieldname, const u8 **cursor, size_t *plen);
void printwire_witness_stack(const char *fieldname, const u8 **cursor, size_t *plen);
#endif /* LIGHTNING_WIRE_PEER_PRINTGEN_H */
// SHA256STAMP:d2dbf0b5768a6a6c940a353621f8a0521f49104c99d7f5d350c500587a7d54c4
// SHA256STAMP:80b32650a8208ef15d83ebecbb3bae3c321fdc8594802de10847ae95f2169952

View File

@ -2589,4 +2589,4 @@ bool fromwire_channel_update_option_channel_htlc_max(const void *p, secp256k1_ec
*htlc_maximum_msat = fromwire_amount_msat(&cursor, &plen);
return cursor != NULL;
}
// SHA256STAMP:d2dbf0b5768a6a6c940a353621f8a0521f49104c99d7f5d350c500587a7d54c4
// SHA256STAMP:80b32650a8208ef15d83ebecbb3bae3c321fdc8594802de10847ae95f2169952

View File

@ -981,4 +981,4 @@ bool fromwire_channel_update_option_channel_htlc_max(const void *p, secp256k1_ec
#endif /* LIGHTNING_WIRE_PEER_WIREGEN_H */
// SHA256STAMP:d2dbf0b5768a6a6c940a353621f8a0521f49104c99d7f5d350c500587a7d54c4
// SHA256STAMP:80b32650a8208ef15d83ebecbb3bae3c321fdc8594802de10847ae95f2169952