From: Rusty Russell Date: Wed, 6 Oct 2010 02:25:38 +0000 (+1030) Subject: ccanlint: add somefunc() to help examples compile. X-Git-Url: https://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=f24a8d30f5b6b8c0e642a357e4dae6f9277d041f ccanlint: add somefunc() to help examples compile. And don't require the module.o to already exist: link against generated .o files. --- diff --git a/tools/ccanlint/tests/examples_compile.c b/tools/ccanlint/tests/examples_compile.c index e2bcaa87..7e1f14f3 100644 --- a/tools/ccanlint/tests/examples_compile.c +++ b/tools/ccanlint/tests/examples_compile.c @@ -21,8 +21,9 @@ static char *obj_list(const struct manifest *m) char *list; struct ccan_file *i; - /* This CCAN module. */ - list = talloc_asprintf(m, " %s.o", m->dir); + /* Object files for this module. */ + list_for_each(&m->c_files, i, list) + list = talloc_asprintf_append(list, " %s", i->compiled); /* Other ccan modules we depend on. */ list_for_each(&m->dep_dirs, i, list) { @@ -97,6 +98,10 @@ static char *mangle(struct manifest *m, struct ccan_file *example) "#include \n", m->basename, m->basename); + ret = talloc_asprintf_append(ret, "/* Useful dummmy functions. */\n" + "int somefunc(void);\n" + "int somefunc(void) { return 0; }\n"); + /* Starts indented? Wrap it in a main() function. */ if (lines[0] && isblank(lines[0][0])) { ret = start_main(ret);