]> git.ozlabs.org Git - ccan/commitdiff
strmap: Convert to using TCON_WRAP() instead of plain TCON()
authorDavid Gibson <david@gibson.dropbear.id.au>
Wed, 27 Jan 2016 12:52:12 +0000 (23:52 +1100)
committerDavid Gibson <david@gibson.dropbear.id.au>
Tue, 2 Feb 2016 12:00:06 +0000 (23:00 +1100)
The usual way of construction strmap objects is to use the STRMAP_MEMBERS()
macro which expands to both a raw strmap structure and a tcon type canary.
However, the tcon type canary involves a flexible array member which means
that in standard C99 STRMAP_MEMBERS() must appear only at the end of a
structure definition.  But worse, that structure can then only appear at
the end of any other structure it is included in, which is pretty
inconvenient for the intended purpose of creating type specific strmaps.

gcc extensions allow this to work (somehow), but clang complains loudly
about it.

The tcon module already includes the TCON_WRAP() mechanism, which already
provides this same sort of type-specific definitions in a more general way.
So convert strmap (and its users) to that approach.

This removes STRMAP_MEMBERS() entirely, breaking compatibility.  I'm hoping
strmap is used in few enough places that we can get away with that.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>

No differences found