[ccan] [PATCH 0/4] Replace TCON() with TCON_WRAP()

David Gibson david at gibson.dropbear.id.au
Thu Jul 27 17:27:48 AEST 2017


On Sun, Jul 23, 2017 at 10:29:03PM +1000, David Gibson wrote:
> ccan/tcon has two basic ways to be used.  With TCON() which adds a
> type canary to a user's existing structure, or with TCON_WRAP(), which
> wraps a user's structure creating a new structure with the canaries.
> 
> TCON() is older and has several modules already using it.
> Unfortunately, it uses flexible-array members which aren't allowed in
> the middle of structures, except as a gcc extension.  That means with
> a "normal" compiler TCON() invocations can only appear at the end of a
> structure.  More importantly it also means a structure including them
> can never be embedded in another structure except at the end.
> 
> In short, using TCON() is either non-portable, or badly violates
> principle of least surprise.  So, this series removes use of it from
> all existing ccan modules.

Rusty,  any thoughts on this?

Unless there's an objection, I'm inclined to commit it.

> David Gibson (4):
>   tlist: Use TCON_WRAP instead of TCON
>   jset: Use TCON_WRAP instead of TCON
>   jmap: Use TCON_WRAP instead of TCON
>   objset: Use TCON_WRAP instead of TCON
> 
>  ccan/jmap/jmap.h      | 59 +++++++++++++++++++++++++++++----------------------
>  ccan/jmap/test/run.c  |  8 +++----
>  ccan/jset/jset.h      | 45 ++++++++++++++++++++++++---------------
>  ccan/jset/test/run.c  |  9 ++++----
>  ccan/objset/objset.h  | 31 +++++++++++++++------------
>  ccan/tlist/_info      |  6 +-----
>  ccan/tlist/test/run.c | 24 ++++++++++-----------
>  ccan/tlist/tlist.h    | 25 +++++++++++-----------
>  8 files changed, 114 insertions(+), 93 deletions(-)
> 

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/ccan/attachments/20170727/e0f5b464/attachment.sig>


More information about the ccan mailing list