Fix missing va_end()s This corrects several places in ccan where stdarg.h is used but there is a missing va_end(). You can get away with this on many platforms, but not all. Caught by Coverity scan. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
tools/ccanlint: compile cleanly with -Wextra. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ccanlint: avoid segfault when module_builds' linking fails In the case that the objects built but linking failed, module_builds.c called score_file_error with a NULL ccan_file object and 0 for line number. score_file_error assumed that the ccan_file object it is passed was not-NULL when appending file errors to the score's aggregate error string. It attempted to dereference it to get "fullname". score_error was factored out from score_file_error. It takes a "source" parameter, which is the file's full name (and possibly line number) in the score_file_error case, and the ccan module name in the case of link failure.
ccanlint: remove redundant num_lines in struct ccan_file. We can use tal_count. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
tools: use tal instead of talloc. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
tools: use rbuf instead of grab_file. Slowly removing the talloc dependency. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
tools: don't abort on malformed documentation lines. ccanlint would abort with 'Malformed line 53' if there was a bad header. That's very poor, and deeply unhelpful. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
tools: more intelligent caching for compile _info. We let the get_deps() caller hand us the compiled _info filename, but what about recursive dependencies? These we re-generate every time. So fix this: hand a generator callback to get_deps(), expose the one which simply compiles it, and add a ccanlint one which looks up the manifest to see if we have one already. Before: $ ccanlint -vvvv ccan/failtest | grep -c 'Creating.*_info' 31 After: $ ccanlint -vvvv ccan/failtest | grep -c 'Creating.*_info' 17
tools: move config.h reading to its own file Move ccan_dir determination out to its own function, rather than implying it by the first time we get the manifest of a module.
tools: split out manifest from ccanlint Other tools will soon want to use this, so make it independent. (eg. ccantool).
htable: clean up interface, document htable_type better. We change from htable_new()/htable_free() to htable_init/htable_clear. We also change HTABLE_DEFINE_TYPE() to be the full name, without automatically prepending htable_.
ccanlint: add coverage variant of files. Rather than a separate cov_compiled member, we can add to the compiled[] array, and we reduce duplication significantly.
ccanlint: keep separate array of compiled versions. Rather than mug the old ->compiled version when we reduce features, keep both in the structure. This makes it clear that we are using the right version (we weren't in all cases, in particular we weren't recompiling the test helpers correctly.
ccanlint: handle DOS-style \r\n lines when parsing. We don't correctly detect pure-comment lines in ccan/ttxml/ttxml.c without this.
ccanlint: add simple check for comment referring to LICENSE file. After discussion with various developers (particularly the Samba team), there's a consensus that a reference to the license in each source file is useful. Since CCAN modules are designed to be cut and paste, this helps avoid any confusion should the LICENSE file go missing. We also detect standard boilerplates, in which case a one-line summary isn't necessary.
asort: Use qsort_r if the system provides it. tools/ccanlint/file_analysis.c needs to include config.h to set _GNU_SOURCE before any other header file includes stdlib.h.
ccanlint: roughly handle multiple conditions on #if line. Just grab the tokens for the simple case: this allows the ccanlint reduce_features test to work on eg. ccan/cast.
tools: fix ctype.h and string usage. Enable CCAN_STR_DEBUG in the default flags, so our tools get checked, and fix up the resulting errors.
tools: actually add non-source files to other_files in manifest We don't use it for the moment, but Brad Hards noted that assigning to dest ten continuing was pointless, revealing this bug.
ccanlint: handle weird directories. David Gibson reports (and I confirmed) that running ccanlint in /tmp causes an very uninformative segv. Fix that, and add a more useful message, as well as delaying recursing until we're confident there's code around.