ccanlint: Move ccanlint test options from _info comments to code Currently, _info files can specify options, or note expected failures, for ccanlint checks in the _info file with specially structured comments. That differs from most other things ccanlint gets from _info, where it instead executes the info file with certain parameters. This changes ccanlint and existing _info files to use the normal method for the ccanlint test options as well. This also has the advantage that an info file can alter its test options based on things from config.h - in some cases whether a test can work or not might depend on various things. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
ccan: Correct some poor conventions in _info includes There are a couple of small problems with the includes used in most of ccan's _info files. * _info routinely uses printf(), and so should include <stdio.h>, but only some of them do. We get away with it, because they do include <string.h>, which apparently includes <stdio.h> indirectly, but we should be explicit about it. * Most _info files were including config.h after the system headers. That _seems_ sensible, but actually causes problems. Because config.h defines _GNU_SOURCE it can change the behaviour of the system headers. More specifically it can make them behave differently to how the individual module headers (which have included config.h) expects them to behave. This patch adjusts all the existing _info files and, more importantly, the template constructed by ccanlint. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
minmax: New module, safe min and max macros Add a 'minmax' module with typesafe macros to compute minimum, maximum and clamping. Inspired by the versions used in the Linux kernel, but using a different implementation based on __builtin_types_compatible_p() and the build_assert module. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>