ccan includes many modules which use macro wrappers to make typesafe pseudo-templated versions of a basic algorithm or data structure.
This series implements several extensions to the tcon module to enable yet another approach to this. The advantage of this new method is that it's able to store a variety of "template" information into a type or variable declaration. That means that a module using this technique can implement typesafe wrappers which can obtain the type information they need from that initial declaration avoiding the need to respecify types or field members in multiple places. The last two patches in the series apply this approach to the lstack and lqueue modules, giving them a nicer typesafe interface. Changes since v1: * More macros to access the normal tcon options for the type canaries built into TCON_CONTAINER * Macro ti directly access to the offset stored in a TCON_CONTAINER * TCON_CONTAINER stores the type canaries as the type itself, rather than a pointer to it. That matches the rest of tcon better, and plays nicer in conjuction with total_order_cast() from the order module. * Fixed the problem that broke ccanlint. It was a ": " where there should have been a " - ". Really. David Gibson (6): tcon: Add an alternate way of building type canaries tcon: Add tcon_sizeof() helper tcon: Encode integer values into "type" canaries tcon: Encode information on container members in "type" canaries lstack: Streamline interface with TCON_CONTAINER lqueue: Streamline interface with TCON_CONTAINER ccan/aga/bfs.c | 18 +- ccan/aga/dfs.c | 18 +- ccan/lqueue/_info | 8 +- ccan/lqueue/lqueue.h | 154 ++++++++-------- ccan/lqueue/test/run.c | 44 ++--- ccan/lstack/_info | 8 +- ccan/lstack/lstack.h | 141 ++++++++------- ccan/lstack/test/run.c | 31 ++-- ccan/tcon/_info | 5 + ccan/tcon/tcon.h | 252 +++++++++++++++++++++++++++ ccan/tcon/test/compile_fail-container1.c | 39 +++++ ccan/tcon/test/compile_fail-container1w.c | 35 ++++ ccan/tcon/test/compile_fail-container2.c | 39 +++++ ccan/tcon/test/compile_fail-container2w.c | 35 ++++ ccan/tcon/test/compile_fail-container3.c | 40 +++++ ccan/tcon/test/compile_fail-container3w.c | 36 ++++ ccan/tcon/test/compile_fail-container4.c | 40 +++++ ccan/tcon/test/compile_fail-container4w.c | 36 ++++ ccan/tcon/test/compile_fail-tcon_cast_wrap.c | 25 +++ ccan/tcon/test/compile_fail-wrap.c | 20 +++ ccan/tcon/test/compile_ok-sizeof.c | 35 ++++ ccan/tcon/test/compile_ok-value.c | 51 ++++++ ccan/tcon/test/compile_ok-void.c | 6 + ccan/tcon/test/compile_ok.c | 11 ++ ccan/tcon/test/run-container.c | 59 +++++++ ccan/tcon/test/run-wrap.c | 18 ++ 26 files changed, 1015 insertions(+), 189 deletions(-) create mode 100644 ccan/tcon/test/compile_fail-container1.c create mode 100644 ccan/tcon/test/compile_fail-container1w.c create mode 100644 ccan/tcon/test/compile_fail-container2.c create mode 100644 ccan/tcon/test/compile_fail-container2w.c create mode 100644 ccan/tcon/test/compile_fail-container3.c create mode 100644 ccan/tcon/test/compile_fail-container3w.c create mode 100644 ccan/tcon/test/compile_fail-container4.c create mode 100644 ccan/tcon/test/compile_fail-container4w.c create mode 100644 ccan/tcon/test/compile_fail-tcon_cast_wrap.c create mode 100644 ccan/tcon/test/compile_fail-wrap.c create mode 100644 ccan/tcon/test/compile_ok-sizeof.c create mode 100644 ccan/tcon/test/compile_ok-value.c create mode 100644 ccan/tcon/test/run-container.c create mode 100644 ccan/tcon/test/run-wrap.c -- 2.4.3 _______________________________________________ ccan mailing list ccan@lists.ozlabs.org https://lists.ozlabs.org/listinfo/ccan