From 650c775ff00cccd03fc84e7789a03c51d9839004 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 2 Jun 2008 12:39:51 +1000 Subject: [PATCH] Move modules to ccan/ tools to tools/ Requires minor fixups. "depends" now prefixes ccan/ (allows for non-ccan deps later). --- Makefile | 16 +++++----- README | 4 +-- {alignof => ccan/alignof}/_info.c | 2 +- {alignof => ccan/alignof}/alignof.h | 0 {alignof => ccan/alignof}/test/run.c | 0 {alloc => ccan/alloc}/_info.c | 2 +- {alloc => ccan/alloc}/alloc.c | 0 {alloc => ccan/alloc}/alloc.h | 0 {alloc => ccan/alloc}/test/run.c | 0 {build_assert => ccan/build_assert}/_info.c | 0 .../build_assert}/build_assert.h | 0 .../build_assert}/test/compile_fail-expr.c | 0 .../build_assert}/test/compile_fail.c | 0 .../build_assert}/test/compile_ok.c | 0 .../test/run-EXPR_BUILD_ASSERT.c | 0 {check_type => ccan/check_type}/_info.c | 2 +- {check_type => ccan/check_type}/check_type.h | 0 .../test/compile_fail-check_type.c | 0 .../test/compile_fail-check_type_unsigned.c | 0 .../test/compile_fail-check_types_match.c | 0 {check_type => ccan/check_type}/test/run.c | 0 {container_of => ccan/container_of}/_info.c | 2 +- .../container_of}/container_of.h | 0 .../test/compile_fail-bad-type.c | 0 .../container_of}/test/compile_fail-types.c | 0 .../test/compile_fail-var-types.c | 0 .../container_of}/test/run.c | 0 {list => ccan/list}/_info.c | 2 +- {list => ccan/list}/list.c | 0 {list => ccan/list}/list.h | 0 {list => ccan/list}/test/run.c | 0 {noerr => ccan/noerr}/_info.c | 0 {noerr => ccan/noerr}/noerr.c | 0 {noerr => ccan/noerr}/noerr.h | 0 {noerr => ccan/noerr}/test/run.c | 0 {string => ccan/string}/_info.c | 2 +- {string => ccan/string}/string.h | 0 {string => ccan/string}/test/run.c | 0 {talloc => ccan/talloc}/TODO | 0 {talloc => ccan/talloc}/_info.c | 2 +- {talloc => ccan/talloc}/talloc.3.xml | 0 {talloc => ccan/talloc}/talloc.c | 0 {talloc => ccan/talloc}/talloc.h | 2 +- {talloc => ccan/talloc}/test/run.c | 0 {tap => ccan/tap}/_info.c | 3 -- {tap => ccan/tap}/tap.3 | 0 {tap => ccan/tap}/tap.c | 0 {tap => ccan/tap}/tap.h | 0 {tap => ccan/tap}/test/run.c | 21 ++++++------ {typesafe_cb => ccan/typesafe_cb}/_info.c | 0 .../test/compile_fail-cast_if_type.c | 0 .../test/compile_fail-typesafe_cb-int.c | 0 .../test/compile_fail-typesafe_cb.c | 0 .../test/compile_fail-typesafe_cb_postargs.c | 0 .../test/compile_fail-typesafe_cb_preargs.c | 0 {typesafe_cb => ccan/typesafe_cb}/test/run.c | 0 .../typesafe_cb}/typesafe_cb.h | 0 ccan_tools/Makefile | 10 ------ ccan_tools/ccanlint/Makefile | 31 ------------------ tools/Makefile | 10 ++++++ tools/ccanlint/Makefile | 32 +++++++++++++++++++ {ccan_tools => tools}/ccanlint/ccanlint.c | 0 {ccan_tools => tools}/ccanlint/ccanlint.h | 0 .../ccanlint/file_analysis.c | 0 .../ccanlint/get_file_lines.c | 0 .../ccanlint/get_file_lines.h | 0 .../ccanlint/has_main_header.c | 0 {ccan_tools => tools}/ccanlint/has_tests.c | 0 {ccan_tools => tools}/ccanlint/idempotent.c | 0 {ccan_tools => tools}/ccanlint/no_info.c | 0 .../ccanlint/trailing_whitespace.c | 0 {ccan_tools => tools}/doc_extract.c | 0 {ccan_tools => tools}/namespacize.c | 0 {ccan_tools => tools}/run_tests.c | 10 +++--- {ccan_tools => tools}/test_all.sh | 0 75 files changed, 76 insertions(+), 77 deletions(-) rename {alignof => ccan/alignof}/_info.c (96%) rename {alignof => ccan/alignof}/alignof.h (100%) rename {alignof => ccan/alignof}/test/run.c (100%) rename {alloc => ccan/alloc}/_info.c (98%) rename {alloc => ccan/alloc}/alloc.c (100%) rename {alloc => ccan/alloc}/alloc.h (100%) rename {alloc => ccan/alloc}/test/run.c (100%) rename {build_assert => ccan/build_assert}/_info.c (100%) rename {build_assert => ccan/build_assert}/build_assert.h (100%) rename {build_assert => ccan/build_assert}/test/compile_fail-expr.c (100%) rename {build_assert => ccan/build_assert}/test/compile_fail.c (100%) rename {build_assert => ccan/build_assert}/test/compile_ok.c (100%) rename {build_assert => ccan/build_assert}/test/run-EXPR_BUILD_ASSERT.c (100%) rename {check_type => ccan/check_type}/_info.c (95%) rename {check_type => ccan/check_type}/check_type.h (100%) rename {check_type => ccan/check_type}/test/compile_fail-check_type.c (100%) rename {check_type => ccan/check_type}/test/compile_fail-check_type_unsigned.c (100%) rename {check_type => ccan/check_type}/test/compile_fail-check_types_match.c (100%) rename {check_type => ccan/check_type}/test/run.c (100%) rename {container_of => ccan/container_of}/_info.c (97%) rename {container_of => ccan/container_of}/container_of.h (100%) rename {container_of => ccan/container_of}/test/compile_fail-bad-type.c (100%) rename {container_of => ccan/container_of}/test/compile_fail-types.c (100%) rename {container_of => ccan/container_of}/test/compile_fail-var-types.c (100%) rename {container_of => ccan/container_of}/test/run.c (100%) rename {list => ccan/list}/_info.c (97%) rename {list => ccan/list}/list.c (100%) rename {list => ccan/list}/list.h (100%) rename {list => ccan/list}/test/run.c (100%) rename {noerr => ccan/noerr}/_info.c (100%) rename {noerr => ccan/noerr}/noerr.c (100%) rename {noerr => ccan/noerr}/noerr.h (100%) rename {noerr => ccan/noerr}/test/run.c (100%) rename {string => ccan/string}/_info.c (95%) rename {string => ccan/string}/string.h (100%) rename {string => ccan/string}/test/run.c (100%) rename {talloc => ccan/talloc}/TODO (100%) rename {talloc => ccan/talloc}/_info.c (98%) rename {talloc => ccan/talloc}/talloc.3.xml (100%) rename {talloc => ccan/talloc}/talloc.c (100%) rename {talloc => ccan/talloc}/talloc.h (99%) rename {talloc => ccan/talloc}/test/run.c (100%) rename {tap => ccan/tap}/_info.c (96%) rename {tap => ccan/tap}/tap.3 (100%) rename {tap => ccan/tap}/tap.c (100%) rename {tap => ccan/tap}/tap.h (100%) rename {tap => ccan/tap}/test/run.c (80%) rename {typesafe_cb => ccan/typesafe_cb}/_info.c (100%) rename {typesafe_cb => ccan/typesafe_cb}/test/compile_fail-cast_if_type.c (100%) rename {typesafe_cb => ccan/typesafe_cb}/test/compile_fail-typesafe_cb-int.c (100%) rename {typesafe_cb => ccan/typesafe_cb}/test/compile_fail-typesafe_cb.c (100%) rename {typesafe_cb => ccan/typesafe_cb}/test/compile_fail-typesafe_cb_postargs.c (100%) rename {typesafe_cb => ccan/typesafe_cb}/test/compile_fail-typesafe_cb_preargs.c (100%) rename {typesafe_cb => ccan/typesafe_cb}/test/run.c (100%) rename {typesafe_cb => ccan/typesafe_cb}/typesafe_cb.h (100%) delete mode 100644 ccan_tools/Makefile delete mode 100644 ccan_tools/ccanlint/Makefile create mode 100644 tools/Makefile create mode 100644 tools/ccanlint/Makefile rename {ccan_tools => tools}/ccanlint/ccanlint.c (100%) rename {ccan_tools => tools}/ccanlint/ccanlint.h (100%) rename {ccan_tools => tools}/ccanlint/file_analysis.c (100%) rename {ccan_tools => tools}/ccanlint/get_file_lines.c (100%) rename {ccan_tools => tools}/ccanlint/get_file_lines.h (100%) rename {ccan_tools => tools}/ccanlint/has_main_header.c (100%) rename {ccan_tools => tools}/ccanlint/has_tests.c (100%) rename {ccan_tools => tools}/ccanlint/idempotent.c (100%) rename {ccan_tools => tools}/ccanlint/no_info.c (100%) rename {ccan_tools => tools}/ccanlint/trailing_whitespace.c (100%) rename {ccan_tools => tools}/doc_extract.c (100%) rename {ccan_tools => tools}/namespacize.c (100%) rename {ccan_tools => tools}/run_tests.c (96%) rename {ccan_tools => tools}/test_all.sh (100%) diff --git a/Makefile b/Makefile index 76b79e33..b60874d7 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,9 @@ # Hacky makefile to compile everything and run the tests in some kind of sane order. # V=--verbose for verbose tests. -CFLAGS=-O3 -Wall -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Werror -I. +CFLAGS=-O3 -Wall -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Werror -Iccan -I. -ALL=$(patsubst %/test, %, $(wildcard */test)) +ALL=$(patsubst ccan/%/test, ccan/%, $(wildcard ccan/*/test)) ALL_DEPENDS=$(patsubst %, %/.depends, $(ALL)) test-all: $(ALL_DEPENDS) @@ -16,13 +16,13 @@ distclean: clean $(ALL_DEPENDS): %/.depends: %/_info @$< depends > $@ || ( rm -f $@; exit 1 ) -test-%: ccan_tools/run_tests +test-ccan/%: tools/run_tests @echo Testing $*... - @if ccan_tools/run_tests $(V) $* | grep ^'not ok'; then exit 1; else exit 0; fi + @if tools/run_tests $(V) ccan/$* | grep ^'not ok'; then exit 1; else exit 0; fi -ccanlint: ccan_tools/ccanlint/ccanlint +ccanlint: tools/ccanlint/ccanlint -clean: ccan_tools-clean - rm -f `find . -name '*.o'` +clean: tools-clean + rm -f `find . -name '*.o'` `find . -name '.depends'` -include ccan_tools/Makefile +include tools/Makefile diff --git a/README b/README index 65bb8531..9019fbb2 100644 --- a/README +++ b/README @@ -1,8 +1,8 @@ -ccan_tools: +tools: This is currently a bootstrap junkyard for ccan tools. It is expected that some of this code, being generally useful, will be shuffled out to their own modules over time. -other: +ccan: The beginnings of a ccan repository. diff --git a/alignof/_info.c b/ccan/alignof/_info.c similarity index 96% rename from alignof/_info.c rename to ccan/alignof/_info.c index b5afa025..4cccba33 100644 --- a/alignof/_info.c +++ b/ccan/alignof/_info.c @@ -37,7 +37,7 @@ int main(int argc, char *argv[]) return 1; if (strcmp(argv[1], "depends") == 0) { - printf("build_assert\n"); + printf("ccan/build_assert\n"); return 0; } diff --git a/alignof/alignof.h b/ccan/alignof/alignof.h similarity index 100% rename from alignof/alignof.h rename to ccan/alignof/alignof.h diff --git a/alignof/test/run.c b/ccan/alignof/test/run.c similarity index 100% rename from alignof/test/run.c rename to ccan/alignof/test/run.c diff --git a/alloc/_info.c b/ccan/alloc/_info.c similarity index 98% rename from alloc/_info.c rename to ccan/alloc/_info.c index 59a66380..03e20afc 100644 --- a/alloc/_info.c +++ b/ccan/alloc/_info.c @@ -95,7 +95,7 @@ int main(int argc, char *argv[]) return 1; if (strcmp(argv[1], "depends") == 0) { - printf("build_assert\n"); + printf("ccan/build_assert\n"); return 0; } diff --git a/alloc/alloc.c b/ccan/alloc/alloc.c similarity index 100% rename from alloc/alloc.c rename to ccan/alloc/alloc.c diff --git a/alloc/alloc.h b/ccan/alloc/alloc.h similarity index 100% rename from alloc/alloc.h rename to ccan/alloc/alloc.h diff --git a/alloc/test/run.c b/ccan/alloc/test/run.c similarity index 100% rename from alloc/test/run.c rename to ccan/alloc/test/run.c diff --git a/build_assert/_info.c b/ccan/build_assert/_info.c similarity index 100% rename from build_assert/_info.c rename to ccan/build_assert/_info.c diff --git a/build_assert/build_assert.h b/ccan/build_assert/build_assert.h similarity index 100% rename from build_assert/build_assert.h rename to ccan/build_assert/build_assert.h diff --git a/build_assert/test/compile_fail-expr.c b/ccan/build_assert/test/compile_fail-expr.c similarity index 100% rename from build_assert/test/compile_fail-expr.c rename to ccan/build_assert/test/compile_fail-expr.c diff --git a/build_assert/test/compile_fail.c b/ccan/build_assert/test/compile_fail.c similarity index 100% rename from build_assert/test/compile_fail.c rename to ccan/build_assert/test/compile_fail.c diff --git a/build_assert/test/compile_ok.c b/ccan/build_assert/test/compile_ok.c similarity index 100% rename from build_assert/test/compile_ok.c rename to ccan/build_assert/test/compile_ok.c diff --git a/build_assert/test/run-EXPR_BUILD_ASSERT.c b/ccan/build_assert/test/run-EXPR_BUILD_ASSERT.c similarity index 100% rename from build_assert/test/run-EXPR_BUILD_ASSERT.c rename to ccan/build_assert/test/run-EXPR_BUILD_ASSERT.c diff --git a/check_type/_info.c b/ccan/check_type/_info.c similarity index 95% rename from check_type/_info.c rename to ccan/check_type/_info.c index 06e90eb4..176e445a 100644 --- a/check_type/_info.c +++ b/ccan/check_type/_info.c @@ -21,7 +21,7 @@ int main(int argc, char *argv[]) if (strcmp(argv[1], "depends") == 0) { #if !HAVE_TYPEOF - printf("build_assert\n"); + printf("ccan/build_assert\n"); #endif return 0; } diff --git a/check_type/check_type.h b/ccan/check_type/check_type.h similarity index 100% rename from check_type/check_type.h rename to ccan/check_type/check_type.h diff --git a/check_type/test/compile_fail-check_type.c b/ccan/check_type/test/compile_fail-check_type.c similarity index 100% rename from check_type/test/compile_fail-check_type.c rename to ccan/check_type/test/compile_fail-check_type.c diff --git a/check_type/test/compile_fail-check_type_unsigned.c b/ccan/check_type/test/compile_fail-check_type_unsigned.c similarity index 100% rename from check_type/test/compile_fail-check_type_unsigned.c rename to ccan/check_type/test/compile_fail-check_type_unsigned.c diff --git a/check_type/test/compile_fail-check_types_match.c b/ccan/check_type/test/compile_fail-check_types_match.c similarity index 100% rename from check_type/test/compile_fail-check_types_match.c rename to ccan/check_type/test/compile_fail-check_types_match.c diff --git a/check_type/test/run.c b/ccan/check_type/test/run.c similarity index 100% rename from check_type/test/run.c rename to ccan/check_type/test/run.c diff --git a/container_of/_info.c b/ccan/container_of/_info.c similarity index 97% rename from container_of/_info.c rename to ccan/container_of/_info.c index 7705e38c..96c12d88 100644 --- a/container_of/_info.c +++ b/ccan/container_of/_info.c @@ -39,7 +39,7 @@ int main(int argc, char *argv[]) return 1; if (strcmp(argv[1], "depends") == 0) { - printf("check_type\n"); + printf("ccan/check_type\n"); return 0; } diff --git a/container_of/container_of.h b/ccan/container_of/container_of.h similarity index 100% rename from container_of/container_of.h rename to ccan/container_of/container_of.h diff --git a/container_of/test/compile_fail-bad-type.c b/ccan/container_of/test/compile_fail-bad-type.c similarity index 100% rename from container_of/test/compile_fail-bad-type.c rename to ccan/container_of/test/compile_fail-bad-type.c diff --git a/container_of/test/compile_fail-types.c b/ccan/container_of/test/compile_fail-types.c similarity index 100% rename from container_of/test/compile_fail-types.c rename to ccan/container_of/test/compile_fail-types.c diff --git a/container_of/test/compile_fail-var-types.c b/ccan/container_of/test/compile_fail-var-types.c similarity index 100% rename from container_of/test/compile_fail-var-types.c rename to ccan/container_of/test/compile_fail-var-types.c diff --git a/container_of/test/run.c b/ccan/container_of/test/run.c similarity index 100% rename from container_of/test/run.c rename to ccan/container_of/test/run.c diff --git a/list/_info.c b/ccan/list/_info.c similarity index 97% rename from list/_info.c rename to ccan/list/_info.c index 0402b490..dc3c3e64 100644 --- a/list/_info.c +++ b/ccan/list/_info.c @@ -55,7 +55,7 @@ int main(int argc, char *argv[]) return 1; if (strcmp(argv[1], "depends") == 0) { - printf("container_of\n"); + printf("ccan/container_of\n"); return 0; } diff --git a/list/list.c b/ccan/list/list.c similarity index 100% rename from list/list.c rename to ccan/list/list.c diff --git a/list/list.h b/ccan/list/list.h similarity index 100% rename from list/list.h rename to ccan/list/list.h diff --git a/list/test/run.c b/ccan/list/test/run.c similarity index 100% rename from list/test/run.c rename to ccan/list/test/run.c diff --git a/noerr/_info.c b/ccan/noerr/_info.c similarity index 100% rename from noerr/_info.c rename to ccan/noerr/_info.c diff --git a/noerr/noerr.c b/ccan/noerr/noerr.c similarity index 100% rename from noerr/noerr.c rename to ccan/noerr/noerr.c diff --git a/noerr/noerr.h b/ccan/noerr/noerr.h similarity index 100% rename from noerr/noerr.h rename to ccan/noerr/noerr.h diff --git a/noerr/test/run.c b/ccan/noerr/test/run.c similarity index 100% rename from noerr/test/run.c rename to ccan/noerr/test/run.c diff --git a/string/_info.c b/ccan/string/_info.c similarity index 95% rename from string/_info.c rename to ccan/string/_info.c index 2d1709f7..9cb691ce 100644 --- a/string/_info.c +++ b/ccan/string/_info.c @@ -9,7 +9,7 @@ * the standard string.h. * * Example: - * #include "ccan/string.h" + * #include "string/string.h" * * int main(int argc, char *argv[]) * { diff --git a/string/string.h b/ccan/string/string.h similarity index 100% rename from string/string.h rename to ccan/string/string.h diff --git a/string/test/run.c b/ccan/string/test/run.c similarity index 100% rename from string/test/run.c rename to ccan/string/test/run.c diff --git a/talloc/TODO b/ccan/talloc/TODO similarity index 100% rename from talloc/TODO rename to ccan/talloc/TODO diff --git a/talloc/_info.c b/ccan/talloc/_info.c similarity index 98% rename from talloc/_info.c rename to ccan/talloc/_info.c index 18da417f..bc48736f 100644 --- a/talloc/_info.c +++ b/ccan/talloc/_info.c @@ -95,7 +95,7 @@ int main(int argc, char *argv[]) return 1; if (strcmp(argv[1], "depends") == 0) { - printf("typesafe_cb\n"); + printf("ccan/typesafe_cb\n"); return 0; } diff --git a/talloc/talloc.3.xml b/ccan/talloc/talloc.3.xml similarity index 100% rename from talloc/talloc.3.xml rename to ccan/talloc/talloc.3.xml diff --git a/talloc/talloc.c b/ccan/talloc/talloc.c similarity index 100% rename from talloc/talloc.c rename to ccan/talloc/talloc.c diff --git a/talloc/talloc.h b/ccan/talloc/talloc.h similarity index 99% rename from talloc/talloc.h rename to ccan/talloc/talloc.h index 5566a040..7da8d975 100644 --- a/talloc/talloc.h +++ b/ccan/talloc/talloc.h @@ -27,7 +27,7 @@ #include #include #include "config.h" -#include "typesafe_cb/typesafe_cb.h" +#include "ccan/typesafe_cb/typesafe_cb.h" /* this uses a little trick to allow __LINE__ to be stringified diff --git a/talloc/test/run.c b/ccan/talloc/test/run.c similarity index 100% rename from talloc/test/run.c rename to ccan/talloc/test/run.c diff --git a/tap/_info.c b/ccan/tap/_info.c similarity index 96% rename from tap/_info.c rename to ccan/tap/_info.c index 7f415a23..2e628914 100644 --- a/tap/_info.c +++ b/ccan/tap/_info.c @@ -51,8 +51,5 @@ int main(int argc, char *argv[]) if (strcmp(argv[1], "depends") == 0) return 0; - if (strcmp(argv[1], "license") == 0) - return "BSD"; - return 1; } diff --git a/tap/tap.3 b/ccan/tap/tap.3 similarity index 100% rename from tap/tap.3 rename to ccan/tap/tap.3 diff --git a/tap/tap.c b/ccan/tap/tap.c similarity index 100% rename from tap/tap.c rename to ccan/tap/tap.c diff --git a/tap/tap.h b/ccan/tap/tap.h similarity index 100% rename from tap/tap.h rename to ccan/tap/tap.h diff --git a/tap/test/run.c b/ccan/tap/test/run.c similarity index 80% rename from tap/test/run.c rename to ccan/tap/test/run.c index 97af45c8..2f718cc2 100644 --- a/tap/test/run.c +++ b/ccan/tap/test/run.c @@ -11,6 +11,7 @@ #include #include #include +#include /* We dup stderr to here. */ static int stderrfd; @@ -32,18 +33,18 @@ static void failmsg(const char *fmt, ...) _exit(1); } -static void expect(int fd, const char *str) +static void expect(int fd, const char *pattern) { - char buffer[PIPE_BUF]; + char buffer[PIPE_BUF+1]; int r; - r = read(fd, buffer, sizeof(buffer)); + r = read(fd, buffer, sizeof(buffer)-1); if (r < 0) failmsg("reading from pipe"); + buffer[r] = '\0'; - if (strlen(str) != r || strncmp(str, buffer, r) != 0) - failmsg("Expected '%s' got '%.*s'", - str, r, buffer); + if (fnmatch(pattern, buffer, 0) != 0) + failmsg("Expected '%s' got '%s'", pattern, buffer); } int main(int argc, char *argv[]) @@ -75,21 +76,21 @@ int main(int argc, char *argv[]) ok(0, "msg2"); expect(p[0], "not ok 2 - msg2\n" - "# Failed test (tap/test/run.c:main() at line 76)\n"); + "# Failed test (*tap/test/run.c:main() at line 77)\n"); ok1(true); expect(p[0], "ok 3 - true\n"); ok1(false); expect(p[0], "not ok 4 - false\n" - "# Failed test (tap/test/run.c:main() at line 83)\n"); + "# Failed test (*tap/test/run.c:main() at line 84)\n"); pass("passed"); expect(p[0], "ok 5 - passed\n"); fail("failed"); expect(p[0], "not ok 6 - failed\n" - "# Failed test (tap/test/run.c:main() at line 90)\n"); + "# Failed test (*tap/test/run.c:main() at line 91)\n"); skip(2, "skipping %s", "test"); expect(p[0], "ok 7 # skip skipping test\n" @@ -98,7 +99,7 @@ int main(int argc, char *argv[]) todo_start("todo"); ok1(false); expect(p[0], "not ok 9 - false # TODO todo\n" - "# Failed (TODO) test (tap/test/run.c:main() at line 99)\n"); + "# Failed (TODO) test (*tap/test/run.c:main() at line 100)\n"); ok1(true); expect(p[0], "ok 10 - true # TODO todo\n"); todo_end(); diff --git a/typesafe_cb/_info.c b/ccan/typesafe_cb/_info.c similarity index 100% rename from typesafe_cb/_info.c rename to ccan/typesafe_cb/_info.c diff --git a/typesafe_cb/test/compile_fail-cast_if_type.c b/ccan/typesafe_cb/test/compile_fail-cast_if_type.c similarity index 100% rename from typesafe_cb/test/compile_fail-cast_if_type.c rename to ccan/typesafe_cb/test/compile_fail-cast_if_type.c diff --git a/typesafe_cb/test/compile_fail-typesafe_cb-int.c b/ccan/typesafe_cb/test/compile_fail-typesafe_cb-int.c similarity index 100% rename from typesafe_cb/test/compile_fail-typesafe_cb-int.c rename to ccan/typesafe_cb/test/compile_fail-typesafe_cb-int.c diff --git a/typesafe_cb/test/compile_fail-typesafe_cb.c b/ccan/typesafe_cb/test/compile_fail-typesafe_cb.c similarity index 100% rename from typesafe_cb/test/compile_fail-typesafe_cb.c rename to ccan/typesafe_cb/test/compile_fail-typesafe_cb.c diff --git a/typesafe_cb/test/compile_fail-typesafe_cb_postargs.c b/ccan/typesafe_cb/test/compile_fail-typesafe_cb_postargs.c similarity index 100% rename from typesafe_cb/test/compile_fail-typesafe_cb_postargs.c rename to ccan/typesafe_cb/test/compile_fail-typesafe_cb_postargs.c diff --git a/typesafe_cb/test/compile_fail-typesafe_cb_preargs.c b/ccan/typesafe_cb/test/compile_fail-typesafe_cb_preargs.c similarity index 100% rename from typesafe_cb/test/compile_fail-typesafe_cb_preargs.c rename to ccan/typesafe_cb/test/compile_fail-typesafe_cb_preargs.c diff --git a/typesafe_cb/test/run.c b/ccan/typesafe_cb/test/run.c similarity index 100% rename from typesafe_cb/test/run.c rename to ccan/typesafe_cb/test/run.c diff --git a/typesafe_cb/typesafe_cb.h b/ccan/typesafe_cb/typesafe_cb.h similarity index 100% rename from typesafe_cb/typesafe_cb.h rename to ccan/typesafe_cb/typesafe_cb.h diff --git a/ccan_tools/Makefile b/ccan_tools/Makefile deleted file mode 100644 index 7cf228ee..00000000 --- a/ccan_tools/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -ccan_tools/run_tests: ccan_tools/run_tests.o tap/tap.o talloc/talloc.o - -ccan_tools/doc_extract: ccan_tools/doc_extract.c talloc/talloc.o - -ccan_tools/namespacize: ccan_tools/namespacize.c talloc/talloc.o - -ccan_tools-clean: ccanlint-clean - rm -f run_tests doc_extract - -include ccan_tools/ccanlint/Makefile diff --git a/ccan_tools/ccanlint/Makefile b/ccan_tools/ccanlint/Makefile deleted file mode 100644 index ddc5534b..00000000 --- a/ccan_tools/ccanlint/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -OBJS := ccan_tools/ccanlint/no_info.o \ - ccan_tools/ccanlint/has_main_header.o \ - ccan_tools/ccanlint/has_tests.o \ - ccan_tools/ccanlint/trailing_whitespace.o \ - ccan_tools/ccanlint/idempotent.o \ - -FUTURE:=ccan_tools/ccanlint/if_have_not_ifdef.o \ - ccan_tools/ccanlint/needs_depends.o \ - ccan_tools/ccanlint/has_info_documentation.o \ - ccan_tools/ccanlint/has_header_documentation.o \ - ccan_tools/ccanlint/has_tests.o \ - ccan_tools/ccanlint/builds_ok.o \ - ccan_tools/ccanlint/builds_ok_all_have_variants.o \ - ccan_tools/ccanlint/run_tests.o \ - ccan_tools/ccanlint/test_coverage.o \ - -ccan_tools/ccanlint/generated-init-tests: $(OBJS) - cat $(OBJS:.o=.c) | sed -n 's/^struct ccanlint \([A-Za-z0-9_]*\) = {/{ extern struct ccanlint \1; list_add(\&tests, \&\1.list); }/p' >$@ - -ccan_tools/ccanlint/ccanlint.o: ccan_tools/ccanlint/generated-init-tests - -ccan_tools/ccanlint/ccanlint: \ - $(OBJS) \ - ccan_tools/ccanlint/ccanlint.o \ - ccan_tools/ccanlint/get_file_lines.o \ - ccan_tools/ccanlint/file_analysis.o \ - talloc/talloc.o noerr/noerr.o - -ccanlint-clean: - $(RM) ccan_tools/ccanlint/generated-init-tests - diff --git a/tools/Makefile b/tools/Makefile new file mode 100644 index 00000000..a9ed7fd6 --- /dev/null +++ b/tools/Makefile @@ -0,0 +1,10 @@ +tools/run_tests: tools/run_tests.o ccan/tap/tap.o ccan/talloc/talloc.o + +tools/doc_extract: tools/doc_extract.c ccan/talloc/talloc.o + +tools/namespacize: tools/namespacize.c ccan/talloc/talloc.o + +tools-clean: ccanlint-clean + rm -f run_tests doc_extract namespacize + +include tools/ccanlint/Makefile diff --git a/tools/ccanlint/Makefile b/tools/ccanlint/Makefile new file mode 100644 index 00000000..f3f00a6f --- /dev/null +++ b/tools/ccanlint/Makefile @@ -0,0 +1,32 @@ +OBJS := tools/ccanlint/no_info.o \ + tools/ccanlint/has_main_header.o \ + tools/ccanlint/has_tests.o \ + tools/ccanlint/trailing_whitespace.o \ + tools/ccanlint/idempotent.o \ + +FUTURE:=tools/ccanlint/if_have_not_ifdef.o \ + tools/ccanlint/needs_depends.o \ + tools/ccanlint/has_info_documentation.o \ + tools/ccanlint/has_header_documentation.o \ + tools/ccanlint/has_tests.o \ + tools/ccanlint/builds_ok.o \ + tools/ccanlint/builds_ok_all_have_variants.o \ + tools/ccanlint/run_tests.o \ + tools/ccanlint/test_coverage.o \ + +tools/ccanlint/generated-init-tests: $(OBJS) + cat $(OBJS:.o=.c) | sed -n 's/^struct ccanlint \([A-Za-z0-9_]*\) = {/{ extern struct ccanlint \1; list_add(\&tests, \&\1.list); }/p' >$@ + +tools/ccanlint/ccanlint.o: tools/ccanlint/generated-init-tests + +tools/ccanlint/ccanlint: \ + $(OBJS) \ + tools/ccanlint/ccanlint.o \ + tools/ccanlint/get_file_lines.o \ + tools/ccanlint/file_analysis.o \ + talloc/talloc.o noerr/noerr.o + +ccanlint-clean: + $(RM) tools/ccanlint/generated-init-tests + $(RM) tools/ccanlint/ccanlint + diff --git a/ccan_tools/ccanlint/ccanlint.c b/tools/ccanlint/ccanlint.c similarity index 100% rename from ccan_tools/ccanlint/ccanlint.c rename to tools/ccanlint/ccanlint.c diff --git a/ccan_tools/ccanlint/ccanlint.h b/tools/ccanlint/ccanlint.h similarity index 100% rename from ccan_tools/ccanlint/ccanlint.h rename to tools/ccanlint/ccanlint.h diff --git a/ccan_tools/ccanlint/file_analysis.c b/tools/ccanlint/file_analysis.c similarity index 100% rename from ccan_tools/ccanlint/file_analysis.c rename to tools/ccanlint/file_analysis.c diff --git a/ccan_tools/ccanlint/get_file_lines.c b/tools/ccanlint/get_file_lines.c similarity index 100% rename from ccan_tools/ccanlint/get_file_lines.c rename to tools/ccanlint/get_file_lines.c diff --git a/ccan_tools/ccanlint/get_file_lines.h b/tools/ccanlint/get_file_lines.h similarity index 100% rename from ccan_tools/ccanlint/get_file_lines.h rename to tools/ccanlint/get_file_lines.h diff --git a/ccan_tools/ccanlint/has_main_header.c b/tools/ccanlint/has_main_header.c similarity index 100% rename from ccan_tools/ccanlint/has_main_header.c rename to tools/ccanlint/has_main_header.c diff --git a/ccan_tools/ccanlint/has_tests.c b/tools/ccanlint/has_tests.c similarity index 100% rename from ccan_tools/ccanlint/has_tests.c rename to tools/ccanlint/has_tests.c diff --git a/ccan_tools/ccanlint/idempotent.c b/tools/ccanlint/idempotent.c similarity index 100% rename from ccan_tools/ccanlint/idempotent.c rename to tools/ccanlint/idempotent.c diff --git a/ccan_tools/ccanlint/no_info.c b/tools/ccanlint/no_info.c similarity index 100% rename from ccan_tools/ccanlint/no_info.c rename to tools/ccanlint/no_info.c diff --git a/ccan_tools/ccanlint/trailing_whitespace.c b/tools/ccanlint/trailing_whitespace.c similarity index 100% rename from ccan_tools/ccanlint/trailing_whitespace.c rename to tools/ccanlint/trailing_whitespace.c diff --git a/ccan_tools/doc_extract.c b/tools/doc_extract.c similarity index 100% rename from ccan_tools/doc_extract.c rename to tools/doc_extract.c diff --git a/ccan_tools/namespacize.c b/tools/namespacize.c similarity index 100% rename from ccan_tools/namespacize.c rename to tools/namespacize.c diff --git a/ccan_tools/run_tests.c b/tools/run_tests.c similarity index 96% rename from ccan_tools/run_tests.c rename to tools/run_tests.c index c7526449..1a8d75ea 100644 --- a/ccan_tools/run_tests.c +++ b/tools/run_tests.c @@ -4,11 +4,11 @@ #include #include #include -#include "tap/tap.h" -#include "talloc/talloc.h" -#include "../string/string.h" +#include "ccan/tap/tap.h" +#include "ccan/talloc/talloc.h" +#include "ccan/string/string.h" -#define CFLAGS "-O3 -Wall -Wundef -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Werror -I." +#define CFLAGS "-O3 -Wall -Wundef -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Werror -Iccan -I." /* FIXME: Use build bug later. */ #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) @@ -56,7 +56,7 @@ static char *obj_list(void) list = talloc_asprintf_append(list, "%s ", i->name); /* FIXME */ - list = talloc_asprintf_append(list, "tap/tap.o"); + list = talloc_asprintf_append(list, "ccan/tap/tap.o"); return list; } diff --git a/ccan_tools/test_all.sh b/tools/test_all.sh similarity index 100% rename from ccan_tools/test_all.sh rename to tools/test_all.sh -- 2.39.2