summaryrefslogtreecommitdiff
path: root/tools/ccanlint/file_analysis.c
AgeCommit message (Collapse)Author
2015-04-10ccanlint: avoid segfault when module_builds' linking failsPeter Barker
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.
2012-12-03ccanlint: remove redundant num_lines in struct ccan_file.Rusty Russell
We can use tal_count. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-12-03tools: use tal instead of talloc.Rusty Russell
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-12-03tools: use rbuf instead of grab_file.Rusty Russell
Slowly removing the talloc dependency. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-12-03tools: don't abort on malformed documentation lines.Rusty Russell
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>
2012-09-10tools: more intelligent caching for compile _info.Rusty Russell
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
2012-03-19tools: move config.h reading to its own fileRusty Russell
Move ccan_dir determination out to its own function, rather than implying it by the first time we get the manifest of a module.
2012-03-19tools: split out manifest from ccanlintRusty Russell
Other tools will soon want to use this, so make it independent. (eg. ccantool).
2011-09-27htable: clean up interface, document htable_type better.Rusty Russell
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_.
2011-08-30ccanlint: add coverage variant of files.Rusty Russell
Rather than a separate cov_compiled member, we can add to the compiled[] array, and we reduce duplication significantly.
2011-08-30ccanlint: keep separate array of compiled versions.Rusty Russell
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.
2011-07-21ccanlint: handle DOS-style \r\n lines when parsing.Rusty Russell
We don't correctly detect pure-comment lines in ccan/ttxml/ttxml.c without this.
2011-07-21ccanlint: add simple check for comment referring to LICENSE file.Rusty Russell
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.
2011-04-02asort: Use qsort_r if the system provides it.Andreas Schlick
tools/ccanlint/file_analysis.c needs to include config.h to set _GNU_SOURCE before any other header file includes stdlib.h.
2011-03-22ccanlint: roughly handle multiple conditions on #if line.Rusty Russell
Just grab the tokens for the simple case: this allows the ccanlint reduce_features test to work on eg. ccan/cast.
2011-03-17tools: fix ctype.h and string usage.Rusty Russell
Enable CCAN_STR_DEBUG in the default flags, so our tools get checked, and fix up the resulting errors.
2011-03-16tools: actually add non-source files to other_files in manifestRusty Russell
We don't use it for the moment, but Brad Hards noted that assigning to dest ten continuing was pointless, revealing this bug.
2011-03-01ccanlint: handle weird directories.Rusty Russell
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.
2011-01-18strsplit: remove nump argumentRusty Russell
You can use talloc_array_length() to get the length of a tallocated array.
2011-01-17ccanlint: score_file_error() takes printf-formatRusty Russell
We simply build up the error string in score_file_error; a bit different but simpler than current behaviour. We keep around struct file_error because some tests need it.
2011-01-13htable: fix type of cmpfn in htable_typeRusty Russell
It in fact takes an object and a key to compare, not two keys. The test case had the key as first element of the object, so it worked, but ccanlint lost track of module dependencies due to this bug, and thus would build submodules multiple times.
2011-01-04ccanlint: make get_manifest cache manifestsRusty Russell
As we start doing more building of dependencies, this saves us effort.
2010-11-23ccanlint: build depends if necessaryRusty Russell
Now it will build copies of other ccan deps if it can't find them.
2010-11-17ccanlint: run tests in alphabetical orderRusty Russell
This allows tests (like in tdb2) to run the simpler tests first and build up, making it easier to spot the root cause of errors.
2010-11-10ccanlint: list file errors in order they are encountered.Rusty Russell
2010-11-09ccanlint: rework so checks have more structure.Rusty Russell
Previously each check returned a void *, but in fact most of them fell into similar patterns. So define 'struct score' and a helper to add files to it, and use that. Under these rules, you get 0/1 if you skip a test because a dependency failed which in theory means your score (as a percentage) could drop if you fix a test.
2010-11-04ccanlint: try running example code.Rusty Russell
Comments of form "// [given x] outputs y" we can check the examples do as expected.
2010-10-06ccanlint: load file contents on demand, fix names for extracted examples.Rusty Russell
We had example names like "example-opt.h-opt_parse", which got trimmed to "example-opt". By using a basename of example-opt.h-opt_parse.c, we only strip the final ".c" not the middle ".h".
2010-09-25tools/ccanlint: extract examples in separate test.Rusty Russell
This is a precursor to doing something useful with them.
2010-06-07ccanlint: make sure fullname is always full path name.Rusty Russell
2010-02-02ccanlint: fix directory issues properly.Rusty Russell
2010-01-19Make manifest code do chdir into appropriate directory.Rusty Russell
2009-09-25ccanlint: compile and run tests.Rusty Russell
This means we should skip building if there are no C files in module: running tests requires building the module, but not necessarily that it has any C files.
2009-09-12Build tests for ccan.Rusty Russell
More sophisticated skipping: skip dependencies when one fails as well. Allow tests to change their total_score; only access it after running (other than to check it's non-zero).
2009-09-08Dependency checking (make sure .o files exist, prereq to building)Rusty Russell
2009-05-28Rename _info.c to _info: this means we can simple compile *.c.Rusty Russell
2009-05-28Store pristine contents of files: based on Joey's patch.Rusty Russell
2009-03-29Enhance file_analysis preprocessor a little more, use in idempotent test.Rusty Russell
2009-03-29Somewhat decent cpp analysis for ccanlint.Rusty Russell
2009-02-14Teach ccanlint about API tests.Rusty Russell
2008-11-13Broaden use of doc_extract code, put in ccanlint, and fix ccanlint Rusty Russell
compile.
2008-11-10Rename string to str, and split into three modules.Rusty Russell
2008-08-15grab_fd and grab_file: add a size arg, use everywhere.Rusty Russell
2008-06-02Move modules to ccan/ tools to tools/Rusty Russell
Requires minor fixups. "depends" now prefixes ccan/ (allows for non-ccan deps later).