Commit 7307b7ef authored by Rusty Russell's avatar Rusty Russell

tools/ccanlint: add args to main.

This allows examples to refer to them, but we cast them to void at the
end to avoid -Wunused warnings.
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent ad2ce76c
......@@ -442,7 +442,7 @@ static char *mangle(struct manifest *m, char **lines)
if (!has_main) {
ret = tal_strcat(m, take(ret),
"/* Need a main to link successfully. */\n"
"int main(void)\n{\n");
"int main(int argc, char *argv[])\n{\n");
fake_function = true;
}
......@@ -460,8 +460,13 @@ static char *mangle(struct manifest *m, char **lines)
tal_append_fmt(&ret, " %s\n", use_funcs);
}
if (!has_main)
ret = tal_strcat(m, take(ret),
"(void)argc; (void)argv;\n");
if (fake_function)
ret = tal_strcat(m, take(ret), "return 0;\n}\n");
ret = tal_strcat(m, take(ret),
"return 0;\n}\n");
return 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