Commit f24a8d30 authored by Rusty Russell's avatar Rusty Russell

ccanlint: add somefunc() to help examples compile.

And don't require the module.o to already exist: link against generated .o files.
parent c0d13d46
...@@ -21,8 +21,9 @@ static char *obj_list(const struct manifest *m) ...@@ -21,8 +21,9 @@ static char *obj_list(const struct manifest *m)
char *list; char *list;
struct ccan_file *i; struct ccan_file *i;
/* This CCAN module. */ /* Object files for this module. */
list = talloc_asprintf(m, " %s.o", m->dir); list_for_each(&m->c_files, i, list)
list = talloc_asprintf_append(list, " %s", i->compiled);
/* Other ccan modules we depend on. */ /* Other ccan modules we depend on. */
list_for_each(&m->dep_dirs, i, list) { list_for_each(&m->dep_dirs, i, list) {
...@@ -97,6 +98,10 @@ static char *mangle(struct manifest *m, struct ccan_file *example) ...@@ -97,6 +98,10 @@ static char *mangle(struct manifest *m, struct ccan_file *example)
"#include <ccan/%s/%s.h>\n", "#include <ccan/%s/%s.h>\n",
m->basename, m->basename); 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. */ /* Starts indented? Wrap it in a main() function. */
if (lines[0] && isblank(lines[0][0])) { if (lines[0] && isblank(lines[0][0])) {
ret = start_main(ret); ret = start_main(ret);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment