Browse Source

tools: fix tlv generation

We need to hand -s to both header and body generation, or neither:

wire/gen_peer_wire.c:53:13: error: static declaration of ‘towire_channel_update_timestamps’ follows non-static declaration
In file included from wire/gen_peer_wire.c:5:
./wire/gen_peer_wire.h:78:6: note: previous declaration of ‘towire_channel_update_timestamps’ was here

We also need it for printwire, otherwise we get static unused functions for subtypes:

devtools/gen_print_wire.c:155:13: error: ‘printwire_channel_update_checksums’ defined but not used [-Werror=unused-function]
 static void printwire_channel_update_checksums(const char *fieldname, const u8 **cursor, size_t *plen)
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
devtools/gen_print_wire.c:133:13: error: ‘printwire_channel_update_timestamps’ defined but not used [-Werror=unused-function]
 static void printwire_channel_update_timestamps(const char *fieldname, const u8 **cursor, size_t *plen)
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
pull/2938/head
Rusty Russell 5 years ago
committed by neil saitug
parent
commit
2e68b88be8
  1. 8
      devtools/Makefile
  2. 6
      tools/gen/print_header_template
  3. 5
      tools/gen/print_impl_template
  4. 4
      wire/Makefile

8
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

6
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} */

5
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')}
}

4
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/%)

Loading…
Cancel
Save