ccan.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Replace TCON() with TCON_WRAP()
@ 2017-07-23 12:29 David Gibson
  2017-07-23 12:29 ` [PATCH 1/4] tlist: Use TCON_WRAP instead of TCON David Gibson
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: David Gibson @ 2017-07-23 12:29 UTC (permalink / raw)
  To: ccan

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.

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(-)

-- 
2.13.3

_______________________________________________
ccan mailing list
ccan@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/ccan

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-08-01  5:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-23 12:29 [PATCH 0/4] Replace TCON() with TCON_WRAP() David Gibson
2017-07-23 12:29 ` [PATCH 1/4] tlist: Use TCON_WRAP instead of TCON David Gibson
2017-07-23 12:29 ` [PATCH 2/4] jset: " David Gibson
2017-07-31  6:25   ` Rusty Russell
2017-08-01  5:17     ` David Gibson
2017-07-23 12:29 ` [PATCH 3/4] jmap: " David Gibson
2017-07-23 12:29 ` [PATCH 4/4] objset: " David Gibson
2017-07-27  7:27 ` [PATCH 0/4] Replace TCON() with TCON_WRAP() David Gibson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).