]> git.ozlabs.org Git - ccan/log
ccan
13 years agoalignof, array_size, crc: provide comments to allow testing examples.
Rusty Russell [Thu, 4 Nov 2010 04:32:13 +0000 (15:02 +1030)]
alignof, array_size, crc: provide comments to allow testing examples.

13 years agoccanlint: try running example code.
Rusty Russell [Thu, 4 Nov 2010 03:25:15 +0000 (13:55 +1030)]
ccanlint: try running example code.

Comments of form "// [given x] outputs y" we can check the examples do as expected.

13 years agoopt: fix junk after string in opt_show_charp.
Rusty Russell [Thu, 4 Nov 2010 02:11:13 +0000 (12:41 +1030)]
opt: fix junk after string in opt_show_charp.

13 years agocleanup: get rid of unwanted tap/ toplevel which crept in.
Rusty Russell [Wed, 3 Nov 2010 22:34:58 +0000 (09:04 +1030)]
cleanup: get rid of unwanted tap/ toplevel which crept in.

13 years agoweb: point to the configurator to generate config.h
Rusty Russell [Wed, 3 Nov 2010 13:14:48 +0000 (23:44 +1030)]
web: point to the configurator to generate config.h

13 years ago.gitignore: ignore configurator
Rusty Russell [Wed, 3 Nov 2010 13:07:33 +0000 (23:37 +1030)]
.gitignore: ignore configurator

13 years agomakefiles: add "scores" target.
Rusty Russell [Wed, 3 Nov 2010 12:48:10 +0000 (23:18 +1030)]
makefiles: add "scores" target.

13 years agoalloc: fix missing header in compilation of example.
Rusty Russell [Wed, 3 Nov 2010 12:48:10 +0000 (23:18 +1030)]
alloc: fix missing header in compilation of example.

13 years agoccanlint: make tests non-compulsory, always print score.
Rusty Russell [Wed, 3 Nov 2010 12:55:57 +0000 (23:25 +1030)]
ccanlint: make tests non-compulsory, always print score.

No longer abort ccanlint because a test fails, but you will get a low
score if there are no tests.

(Note: total_score is filled in, even if it's overridden when the test is
 run.  This means that if the prereq fails, that total counts so there is
 still a penalty!)

13 years agoccanlint: with -vv, give details on attempts to compile examples.
Rusty Russell [Wed, 3 Nov 2010 12:51:18 +0000 (23:21 +1030)]
ccanlint: with -vv, give details on attempts to compile examples.

The heuristics can be hinky, so tell people what we're doing.

13 years agotools: new "configurator" tool.
Rusty Russell [Wed, 3 Nov 2010 00:21:07 +0000 (10:51 +1030)]
tools: new "configurator" tool.

A simple C program to generate config.h.  It also saves the compiler and
flags for use by ccanlint (though they have to accept -c and -o).

13 years agotdb2: fix gcc -O3 warnings on test/layout.c
Rusty Russell [Wed, 3 Nov 2010 00:20:03 +0000 (10:50 +1030)]
tdb2: fix gcc -O3 warnings on test/layout.c

Warnings about ignored returns, and uninitialized len after case statement.

13 years agotdb: fix warnings with gcc -O3, and one test crash.
Rusty Russell [Wed, 3 Nov 2010 00:17:39 +0000 (10:47 +1030)]
tdb: fix warnings with gcc -O3, and one test crash.

unsigned char * is allowed to alias, so we use that for byte reversing
rather than uint32_t.  This is portable.

Remove warnings about ignoring pread/pwrite return values.

And initialize tdb before setjmp: with optimization, gcc validly saw this
as NULL and crashed.

13 years agotalloc: fix gcc -O3 aliasing warnings
Rusty Russell [Wed, 3 Nov 2010 00:16:42 +0000 (10:46 +1030)]
talloc: fix gcc -O3 aliasing warnings

A void * could point to anything, but a void ** can't point to any pointer.
So we use a void * and memcpy, which I believe is safe.

13 years agoopt: fix gcc -O3 warnings.
Rusty Russell [Wed, 3 Nov 2010 00:16:02 +0000 (10:46 +1030)]
opt: fix gcc -O3 warnings.

13 years agojmap: fix aliasing issues, one real testcase bug
Rusty Russell [Wed, 3 Nov 2010 00:11:07 +0000 (10:41 +1030)]
jmap: fix aliasing issues, one real testcase bug

Compiling with gcc -O3 added some more warnings, especially about aliasing.

By setting Word_t to size_t we fix some of them, but jmap_@name_firstval
in JMAP_DEFINE_PTRIDX_TYPE we need to use a real size_t rather than lazily
casting our index to a size_t *.

Gcc also spotted taht we used idx[NUM] in test/run-ptridx-type.c; allocate
that and make the usage explicit.

13 years agoforeach: new module
Rusty Russell [Tue, 2 Nov 2010 01:25:33 +0000 (11:55 +1030)]
foreach: new module

13 years agoMerge branch 'judy'
Rusty Russell [Sat, 30 Oct 2010 10:15:59 +0000 (20:45 +1030)]
Merge branch 'judy'

13 years agojmap: new module
Rusty Russell [Sat, 30 Oct 2010 10:15:36 +0000 (20:45 +1030)]
jmap: new module

13 years agojbitset: new module.
Rusty Russell [Sat, 30 Oct 2010 10:14:42 +0000 (20:44 +1030)]
jbitset: new module.

13 years agoweb: don't try to link to old bzr repository, use git.
Rusty Russell [Fri, 29 Oct 2010 09:16:33 +0000 (19:46 +1030)]
web: don't try to link to old bzr repository, use git.

13 years agotap: restore buffering to stdout
Rusty Russell [Wed, 27 Oct 2010 11:49:44 +0000 (22:19 +1030)]
tap: restore buffering to stdout

I noticed this when I straced something; we're doing 1-byte writes.
This reduced the time for "make check" from 12m37s to 11m48s.

13 years agogitify the tree, especially the web makefile.
Rusty Russell [Tue, 26 Oct 2010 07:37:22 +0000 (18:07 +1030)]
gitify the tree, especially the web makefile.

13 years agoweb: clean up directory
Rusty Russell [Tue, 26 Oct 2010 09:00:27 +0000 (19:30 +1030)]
web: clean up directory

13 years agoilog: rework to reduce interface.
Rusty Russell [Tue, 26 Oct 2010 03:59:36 +0000 (14:29 +1030)]
ilog: rework to reduce interface.

If you've not got gcc, this is a bit of a lose.  But for everyone else,
it's far simpler.

13 years agoopt: wean off getopt_long, beef up tests.
Rusty Russell [Mon, 25 Oct 2010 03:28:50 +0000 (13:58 +1030)]
opt: wean off getopt_long, beef up tests.

Doing our own parsing lost a few lines of code, too.

Our coverage is over 99% now.

13 years agotdb2: extend test/layout to be able to place in file.
Rusty Russell [Mon, 25 Oct 2010 00:08:55 +0000 (10:38 +1030)]
tdb2: extend test/layout to be able to place in file.

This was for lockcheck, but that didn't work very well.  Seems like a useful
addition nonetheless.

13 years agotdb2: fix intermittent test fail.
Rusty Russell [Sun, 24 Oct 2010 22:51:51 +0000 (09:21 +1030)]
tdb2: fix intermittent test fail.

With correct seed, we could expand hash and break test.

13 years agoopt: change / separator to |
Rusty Russell [Fri, 22 Oct 2010 01:25:43 +0000 (11:55 +1030)]
opt: change / separator to |

Paul Wayper points out that "or" has a better mental mapping, and more
importantly that this is how Perl's Getopt::Long does it.

I'm still leaving the - and -- in there, for reasons previously articulated
(grep-friendly and harder to get wrong).

13 years agoavl: I attached a patch changing the AVL module to the MIT license.
Joey Adams [Thu, 21 Oct 2010 07:55:46 +0000 (18:25 +1030)]
avl: I attached a patch changing the AVL module to the MIT license.

13 years agolicense: more changing of licence -> license.
Rusty Russell [Thu, 21 Oct 2010 07:54:19 +0000 (18:24 +1030)]
license: more changing of licence -> license.

13 years agowebpages: make sure target of licence links is included in tarballs.
Rusty Russell [Thu, 21 Oct 2010 07:51:27 +0000 (18:21 +1030)]
webpages: make sure target of licence links is included in tarballs.

13 years agoavl: new module
Rusty Russell [Wed, 20 Oct 2010 05:40:16 +0000 (16:10 +1030)]
avl: new module

13 years agotdb2: 64 bit fixes.
Rusty Russell [Wed, 20 Oct 2010 03:49:11 +0000 (14:19 +1030)]
tdb2: 64 bit fixes.

13 years agotypesafe_cb: 64 bit fixes.
Rusty Russell [Wed, 20 Oct 2010 02:28:49 +0000 (12:58 +1030)]
typesafe_cb: 64 bit fixes.

In particular, gcc warns about cast from int to pointer.

13 years agotdb: 64-bit fixes.
Rusty Russell [Wed, 20 Oct 2010 02:28:20 +0000 (12:58 +1030)]
tdb: 64-bit fixes.

13 years agotally: fixes for 64 bit machines.
Rusty Russell [Wed, 20 Oct 2010 02:21:50 +0000 (12:51 +1030)]
tally: fixes for 64 bit machines.

13 years agoread_write_all: don't rely on write to pipe blocking in tests.
Rusty Russell [Wed, 20 Oct 2010 02:20:18 +0000 (12:50 +1030)]
read_write_all: don't rely on write to pipe blocking in tests.

Instead, directly control write().

13 years agoopt: 64-bit compile fixes
Rusty Russell [Wed, 20 Oct 2010 02:10:00 +0000 (12:40 +1030)]
opt: 64-bit compile fixes

%.* => unsigned, not size_t.

13 years agoccan_tokenizer: 64-bit compile fixes.
Rusty Russell [Wed, 20 Oct 2010 02:09:21 +0000 (12:39 +1030)]
ccan_tokenizer: 64-bit compile fixes.

%zu for size_t printf.

13 years agoalloc: fix 64-bit
Rusty Russell [Wed, 20 Oct 2010 02:08:39 +0000 (12:38 +1030)]
alloc: fix 64-bit

Make sure we use 1UL to bitshift, not 1.

13 years agotools: fixes for 64-bit.
Rusty Russell [Wed, 20 Oct 2010 02:07:45 +0000 (12:37 +1030)]
tools: fixes for 64-bit.

printf's %.* means an unsigned arg, not a size_t.

13 years agotdb2: fix infinite loop in tdb_check
Rusty Russell [Mon, 18 Oct 2010 02:54:20 +0000 (13:24 +1030)]
tdb2: fix infinite loop in tdb_check

check_free_list returns a length, not bool.

13 years agotdb2: add tdb_attribute_seed for setting hash seed.
Rusty Russell [Mon, 18 Oct 2010 02:47:42 +0000 (13:17 +1030)]
tdb2: add tdb_attribute_seed for setting hash seed.

Particularly useful for reproduction, like tdbtorture.

13 years agolicence->license: US English is the standard for code.
Rusty Russell [Sun, 17 Oct 2010 05:33:02 +0000 (16:03 +1030)]
licence->license: US English is the standard for code.

If a Swedish-speaking Finn writes code in English, why should I complain about
a few weird spellings?

13 years agotdb2: clarify locking heirarchy; hashes, freelist, then expand lock.
Rusty Russell [Sun, 17 Oct 2010 04:10:21 +0000 (14:40 +1030)]
tdb2: clarify locking heirarchy; hashes, freelist, then expand lock.

13 years agotdb2: fix run-summary test
Rusty Russell [Fri, 15 Oct 2010 10:38:03 +0000 (21:08 +1030)]
tdb2: fix run-summary test

(Was succeeding in finding "Free bucket 8" string, because of "Free bucket 80:".

13 years agoopt: list ccan/typesafe_cb as a dependency.
Rusty Russell [Thu, 14 Oct 2010 12:30:00 +0000 (23:00 +1030)]
opt: list ccan/typesafe_cb as a dependency.

13 years agoccanlint: use opt package.
Rusty Russell [Fri, 8 Oct 2010 00:56:17 +0000 (11:26 +1030)]
ccanlint: use opt package.

Now we get long options!

13 years agoopt: add opt_log_stderr_exit helper, and opt_usage NULL option.
Rusty Russell [Thu, 7 Oct 2010 23:41:11 +0000 (10:11 +1030)]
opt: add opt_log_stderr_exit helper, and opt_usage NULL option.

The former encapsulates a common "just exit on error" case, the latter
avoids having to repeat the extra usage string.

(We actually would have crashed before if someone passed NULL there, even
 though the documentation said you could).

13 years agoopt: fix example to compile.
Rusty Russell [Thu, 7 Oct 2010 04:12:20 +0000 (14:42 +1030)]
opt: fix example to compile.

13 years agoopt: remove gratuitous { } in initializers.
Rusty Russell [Thu, 7 Oct 2010 03:35:20 +0000 (14:05 +1030)]
opt: remove gratuitous { } in initializers.

A little less typing for users.

13 years agocompiler, list, noerr, sparse_bsearch, str, str_talloc, stringmap, talloc_link, tdb...
Rusty Russell [Thu, 7 Oct 2010 03:29:42 +0000 (13:59 +1030)]
compiler, list, noerr, sparse_bsearch, str, str_talloc, stringmap, talloc_link, tdb, tdb2, typesafe_cb: fix examples

Phew, now they call compile!

13 years agoccanlint: yet more modifications to example extraction and compile.
Rusty Russell [Thu, 7 Oct 2010 03:26:11 +0000 (13:56 +1030)]
ccanlint: yet more modifications to example extraction and compile.

Now (with fixes) every ccanlint example compiles!

13 years agoccanlint: rename files on collision even with keep=true.
Rusty Russell [Thu, 7 Oct 2010 02:43:26 +0000 (13:13 +1030)]
ccanlint: rename files on collision even with keep=true.

13 years agotools: fix bug in doc-extract, handle spaces in summary line
Rusty Russell [Thu, 7 Oct 2010 02:42:57 +0000 (13:12 +1030)]
tools: fix bug in doc-extract, handle spaces in summary line

      /**
       * struct foo - some description

So, <identifier> here can have a space in it.

13 years agocompiler, talloc: warn if return from realloc-like functions isn't used.
Rusty Russell [Thu, 7 Oct 2010 02:41:02 +0000 (13:11 +1030)]
compiler, talloc: warn if return from realloc-like functions isn't used.

This hit my doc extraction tool, so fix it!

13 years agotdb: fixed unitialized vars.
Rusty Russell [Wed, 6 Oct 2010 17:11:20 +0000 (03:41 +1030)]
tdb: fixed unitialized vars.

13 years agotdb2: fix uninitialized var.
Rusty Russell [Wed, 6 Oct 2010 17:10:03 +0000 (03:40 +1030)]
tdb2: fix uninitialized var.

13 years agomodules: update documentation examples so they compile under ccanlint.
Rusty Russell [Wed, 6 Oct 2010 17:01:55 +0000 (03:31 +1030)]
modules: update documentation examples so they compile under ccanlint.

This is everything up to the list module... now it's time for sleep.

13 years agoccanlint: yet more heuristics for compiling examples.
Rusty Russell [Wed, 6 Oct 2010 16:59:30 +0000 (03:29 +1030)]
ccanlint: yet more heuristics for compiling examples.

Including intuiting ccan depends based on headers...

13 years agoarray: fix example compile.
Rusty Russell [Wed, 6 Oct 2010 14:33:39 +0000 (01:03 +1030)]
array: fix example compile.

13 years agohash: fix examples so they compile.
Rusty Russell [Wed, 6 Oct 2010 14:30:51 +0000 (01:00 +1030)]
hash: fix examples so they compile.

13 years agotalloc: fix examples so they compile.
Rusty Russell [Wed, 6 Oct 2010 14:30:25 +0000 (01:00 +1030)]
talloc: fix examples so they compile.

13 years agoopt: fix examples so they compile.
Rusty Russell [Wed, 6 Oct 2010 14:29:55 +0000 (00:59 +1030)]
opt: fix examples so they compile.

13 years agoalloc: fix examples so they compile.
Rusty Russell [Wed, 6 Oct 2010 14:29:09 +0000 (00:59 +1030)]
alloc: fix examples so they compile.

13 years agotap: make examples compilable by ccanlint.
Rusty Russell [Wed, 6 Oct 2010 14:27:28 +0000 (00:57 +1030)]
tap: make examples compilable by ccanlint.

In particular, we can assume "somefunc()" exists in our examples.

13 years agoccanlint: more heuristics for compiling examples.
Rusty Russell [Wed, 6 Oct 2010 14:25:49 +0000 (00:55 +1030)]
ccanlint: more heuristics for compiling examples.

Try to glue consecutive examples together if all else fails (works well for
ccan/alloc/alloc.h).  This means we should put examples into list in order.

13 years agotools: "See Also:" can be a section in documentation, so allow it.
Rusty Russell [Wed, 6 Oct 2010 14:25:14 +0000 (00:55 +1030)]
tools: "See Also:" can be a section in documentation, so allow it.

13 years agoccanlint: more heuristics for compiling examples.
Rusty Russell [Wed, 6 Oct 2010 03:31:24 +0000 (14:01 +1030)]
ccanlint: more heuristics for compiling examples.

These are from hash: the entire example is indented, there is no main(), and
there are unused static functions.

13 years agoccanlint: really fix failing test logic.
Rusty Russell [Wed, 6 Oct 2010 03:29:08 +0000 (13:59 +1030)]
ccanlint: really fix failing test logic.

Some of the compulsory tests don't have a total_score; treat that as "1".
And don't print out a score if the total is <= 1.

13 years agoccanlint: link api tests against compiled objects
Rusty Russell [Wed, 6 Oct 2010 03:28:30 +0000 (13:58 +1030)]
ccanlint: link api tests against compiled objects

Don't assume that ../modulename.o already built!

13 years agoccanlint: add somefunc() to help examples compile.
Rusty Russell [Wed, 6 Oct 2010 02:25:38 +0000 (12:55 +1030)]
ccanlint: add somefunc() to help examples compile.

And don't require the module.o to already exist: link against generated .o files.

13 years agoccanlint: actually try to compile examples.
Rusty Russell [Wed, 6 Oct 2010 01:47:47 +0000 (12:17 +1030)]
ccanlint: actually try to compile examples.

Includes primitive attempt to place fragments into appropriate framework to
compile them.

13 years agoccanlint: load file contents on demand, fix names for extracted examples.
Rusty Russell [Wed, 6 Oct 2010 01:45:31 +0000 (12:15 +1030)]
ccanlint: load file contents on demand, fix names for extracted examples.

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".

13 years agoccanlint: make sure we stop on failure of compulsory test.
Rusty Russell [Wed, 6 Oct 2010 01:44:35 +0000 (12:14 +1030)]
ccanlint: make sure we stop on failure of compulsory test.

13 years agoccanlint: fix -k has_examples
Rusty Russell [Tue, 5 Oct 2010 23:11:11 +0000 (09:41 +1030)]
ccanlint: fix -k has_examples

13 years agoopt: fix warnings with gcc and -O.
Rusty Russell [Tue, 5 Oct 2010 12:10:18 +0000 (22:40 +1030)]
opt: fix warnings with gcc and -O.

13 years agoopt: minor API tweaks.
Rusty Russell [Tue, 5 Oct 2010 12:03:56 +0000 (22:33 +1030)]
opt: minor API tweaks.

Don't allow NULL descs, and put them in macro.  Users can use "", but make
sure it's explicit, not an accidental omission.
Use errx() instead of assert() for API usage errors.
Rename opt_flags to opt_type.

13 years agoopt: allow parameter names in arguments.
Rusty Russell [Tue, 5 Oct 2010 07:01:36 +0000 (17:31 +1030)]
opt: allow parameter names in arguments.

13 years agoopt: remove unused debug function and code, test a few more corner cases.
Rusty Russell [Tue, 5 Oct 2010 07:00:30 +0000 (17:30 +1030)]
opt: remove unused debug function and code, test a few more corner cases.

13 years agoopt: clarify option iteration a little.
Rusty Russell [Tue, 5 Oct 2010 06:06:09 +0000 (16:36 +1030)]
opt: clarify option iteration a little.

I still don't like the duplication, but it's clearer and not much longer.

13 years agoopt: fix reporting of arguments when multiple arguments exist.
Rusty Russell [Tue, 5 Oct 2010 05:26:19 +0000 (15:56 +1030)]
opt: fix reporting of arguments when multiple arguments exist.

longidx is not updated in this case.  We should open-code option parsing.

13 years agoopt: Put actual options inside names.
Rusty Russell [Sun, 3 Oct 2010 11:53:29 +0000 (22:23 +1030)]
opt: Put actual options inside names.

This is more explicit than separate short and long (great for grep!) and
simpler.

13 years agoopt: add support for showing default value.
Rusty Russell [Thu, 30 Sep 2010 01:36:10 +0000 (11:06 +0930)]
opt: add support for showing default value.

13 years agoopt: new module to parse commandline options.
Rusty Russell [Wed, 29 Sep 2010 22:57:58 +0000 (08:27 +0930)]
opt: new module to parse commandline options.

13 years agocompiler: use everywhere.
Rusty Russell [Sun, 26 Sep 2010 07:36:09 +0000 (17:06 +0930)]
compiler: use everywhere.

This includes renaming ATTRIBUTE_UNLIKELY_FUNCTION to ATTRIBUTE_COLD,
and removing unlikely_func macro from ccan/likely.

13 years agoread_write_all: use calloc instead of huge stack var in tests.
Rusty Russell [Sun, 26 Sep 2010 07:34:03 +0000 (17:04 +0930)]
read_write_all: use calloc instead of huge stack var in tests.

Valgrind was giving a spurious error.

13 years agoogg_to_pcm: fix build.
Rusty Russell [Sun, 26 Sep 2010 07:33:30 +0000 (17:03 +0930)]
ogg_to_pcm: fix build.

13 years agonoerr: don't leave tmpnam entries in /tmp in tests.
Rusty Russell [Sun, 26 Sep 2010 07:32:25 +0000 (17:02 +0930)]
noerr: don't leave tmpnam entries in /tmp in tests.

13 years agotdb2: another test.
Rusty Russell [Sun, 26 Sep 2010 07:31:22 +0000 (17:01 +0930)]
tdb2: another test.

13 years agotdb2: make sure summary always has a graph in it.
Rusty Russell [Sun, 26 Sep 2010 07:30:32 +0000 (17:00 +0930)]
tdb2: make sure summary always has a graph in it.

We were getting occasional failures: if all values are the same it's a 1-line
graph and there's no "|" anywhere.

13 years agoconfig: more attributes defined.
Rusty Russell [Sun, 26 Sep 2010 06:20:00 +0000 (15:50 +0930)]
config: more attributes defined.

13 years agocompiler: header for compiler-specific wrappers.
Rusty Russell [Sun, 26 Sep 2010 06:01:38 +0000 (15:31 +0930)]
compiler: header for compiler-specific wrappers.

Currently they sit in each module.

13 years agoccanlint: handle gcov where there's actually no C code
Rusty Russell [Sun, 26 Sep 2010 05:58:11 +0000 (15:28 +0930)]
ccanlint: handle gcov where there's actually no C code

Macro packages do this.

13 years agoantithread: flesh out _info, update licence to GPLv3.
Rusty Russell [Sat, 25 Sep 2010 15:18:55 +0000 (00:48 +0930)]
antithread: flesh out _info, update licence to GPLv3.

13 years agoantithread: update example Makefile and arabella example.
Rusty Russell [Sat, 25 Sep 2010 15:18:27 +0000 (00:48 +0930)]
antithread: update example Makefile and arabella example.

13 years agoalloc: fix case where poolsize is not a power of 2.
Rusty Russell [Sat, 25 Sep 2010 15:12:46 +0000 (00:42 +0930)]
alloc: fix case where poolsize is not a power of 2.

13 years agohash: fix overrun in test code.
Rusty Russell [Sat, 25 Sep 2010 14:22:35 +0000 (23:52 +0930)]
hash: fix overrun in test code.

13 years agotools/ccanlint: extract examples in separate test.
Rusty Russell [Sat, 25 Sep 2010 12:36:20 +0000 (22:06 +0930)]
tools/ccanlint: extract examples in separate test.

This is a precursor to doing something useful with them.