diff --git a/devtools/Makefile b/devtools/Makefile index 2f088fabb..5defe65b0 100644 --- a/devtools/Makefile +++ b/devtools/Makefile @@ -27,16 +27,16 @@ DEVTOOLS_COMMON_OBJS := \ devtools-all: $(DEVTOOLS) devtools/gen_print_wire.h: $(DEVTOOL_BOLT_DEPS) wire/gen_peer_wire_csv - $(BOLT_GEN) -P --page header $@ wire_type < wire/gen_peer_wire_csv > $@ + $(BOLT_GEN) -P -s --page header $@ wire_type < wire/gen_peer_wire_csv > $@ devtools/gen_print_wire.c: $(DEVTOOL_BOLT_DEPS) wire/gen_peer_wire_csv - $(BOLT_GEN) -P --page impl ${@:.c=.h} wire_type < wire/gen_peer_wire_csv > $@ + $(BOLT_GEN) -P -s --page impl ${@:.c=.h} wire_type < wire/gen_peer_wire_csv > $@ devtools/gen_print_onion_wire.h: $(DEVTOOL_BOLT_DEPS) wire/gen_onion_wire_csv - $(BOLT_GEN) -P --page header $@ onion_type < wire/gen_onion_wire_csv > $@ + $(BOLT_GEN) -P -s --page header $@ onion_type < wire/gen_onion_wire_csv > $@ devtools/gen_print_onion_wire.c: $(DEVTOOL_BOLT_DEPS) wire/gen_onion_wire_csv - $(BOLT_GEN) -P --page impl ${@:.c=.h} onion_type < wire/gen_onion_wire_csv > $@ + $(BOLT_GEN) -P -s --page impl ${@:.c=.h} onion_type < wire/gen_onion_wire_csv > $@ devtools/bolt11-cli: $(DEVTOOLS_OBJS) $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o wire/tlvstream.o devtools/bolt11-cli.o diff --git a/tools/gen/print_header_template b/tools/gen/print_header_template index a0170f37a..c82baafc0 100644 --- a/tools/gen/print_header_template +++ b/tools/gen/print_header_template @@ -17,4 +17,10 @@ void print${options.enum_name}_tlv_message(const char *tlv_name, const u8 *msg); void printwire_${msg.name}(const char *fieldname, const u8 *cursor); % endfor + +% if options.expose_subtypes: +% for subtype in subtypes: +void printwire_${subtype.name}(const char *fieldname, const u8 **cursor, size_t *plen); +% endfor +% endif #endif /* LIGHTNING_${idem} */ diff --git a/tools/gen/print_impl_template b/tools/gen/print_impl_template index e3a0827e7..0da50fdc0 100644 --- a/tools/gen/print_impl_template +++ b/tools/gen/print_impl_template @@ -91,7 +91,10 @@ ${truncate_check(nested)} \ ## Definitions for 'subtypes' % for subtype in subtypes: -static void printwire_${subtype.name}(const char *fieldname, const u8 **cursor, size_t *plen) +<% + static = '' if options.expose_subtypes else 'static ' +%>\ +${static}void printwire_${subtype.name}(const char *fieldname, const u8 **cursor, size_t *plen) { ${print_fieldset(subtype.fields.values(), True, 'cursor', 'plen')} } diff --git a/wire/Makefile b/wire/Makefile index 829571497..efcd99399 100644 --- a/wire/Makefile +++ b/wire/Makefile @@ -71,13 +71,13 @@ wire/gen_peer_wire.h: wire/gen_peer_wire_csv $(WIRE_BOLT_DEPS) $(BOLT_GEN) -s --page header $@ wire_type < $< > $@ wire/gen_peer_wire.c: wire/gen_peer_wire_csv $(WIRE_BOLT_DEPS) - $(BOLT_GEN) --page impl ${@:.c=.h} wire_type < $< > $@ + $(BOLT_GEN) -s --page impl ${@:.c=.h} wire_type < $< > $@ wire/gen_onion_wire.h: wire/gen_onion_wire_csv $(WIRE_BOLT_DEPS) $(BOLT_GEN) -s --page header $@ onion_type < $< > $@ wire/gen_onion_wire.c: wire/gen_onion_wire_csv $(WIRE_BOLT_DEPS) - $(BOLT_GEN) --page impl ${@:.c=.h} onion_type < $< > $@ + $(BOLT_GEN) -s --page impl ${@:.c=.h} onion_type < $< > $@ check-source: $(WIRE_SRC:%=check-src-include-order/%) $(WIRE_HEADERS_NOGEN:%=check-hdr-include-order/%)