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)
commitab244401cdba4513f3a3064c5f403fc2a59bf017
tree24eba213514393335e2f3c2eaf673151a62ff860
parent0229ddbf05d402b994133641ecfcdafd4bf73389
strmap: Convert to using TCON_WRAP() instead of plain TCON()

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>
ccan/cdump/cdump.c
ccan/cdump/cdump.h
ccan/strmap/_info
ccan/strmap/strmap.h
ccan/strmap/test/run-iterate-const.c
ccan/strmap/test/run-order.c
ccan/strmap/test/run-prefix.c
ccan/strmap/test/run.c
tools/ccanlint/ccanlint.c