[ccan] First blood... build_assert, check_types and container_of.

Rusty Russell rusty at rustcorp.com.au
Thu Dec 6 01:09:09 EST 2007


OK, in order to kickstart and get something to poke at, I've coded up three 
reasonably-complete trivial "modules".

What's lacking is the tools to extract the documentation, handle metadata, do 
sane tests (I have some start infrastructure in the tarball though), 
namespace-ize, cross-compile, and much more.

But here's what we have, using container_of as my example (which implements 
the container_of macro):

container_of/_info.c:
	Contains metadata: compile and run.  Currently only takes "depends" which
	spits out direct ccan dependencies one per line (check_type).  Also contains
	kernel-doc style comment which serves as package description.

container_of/container_of.h
	The actual container_of() macro.  Includes "check_type/check_type.h",
        contains kernel-doc style comment describing the macro

container_of/test/compile_fail-bad-type.c
container_of/test/compile_fail-types.c
container_of/test/run.c
	Tests.  compile_fail* tests are expected to fail compile.  compile_ok* tests
 	are expected to succeed, and run* tests are expected to compile and execute,
	outputting their own tap-style reports.  compile_fail tests should compile
	unless FAIL is defined (this reduces the chance that an unrelated typo causes
	the test to fail to compile).  C files of any other name are linked in to all
	the tests.

If you actually want to test this, you'll need to grab my libtap sources from 
http://ozlabs.org/~rusty/tap-modified.tar.bz2 and rename it to "tap/" under 
this directory.

Feedback welcome!
Rusty. 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ccan.tar.bz2
Type: application/x-tbz
Size: 5466 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/ccan/attachments/20071206/76164d12/attachment.bin>


More information about the ccan mailing list