projects
/
ccan
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
ad2ce76
)
tools/ccanlint: add args to main.
author
Rusty Russell
<rusty@rustcorp.com.au>
Sun, 6 Nov 2016 04:35:17 +0000
(15:05 +1030)
committer
Rusty Russell
<rusty@rustcorp.com.au>
Sun, 6 Nov 2016 05:23:55 +0000
(15:53 +1030)
This allows examples to refer to them, but we cast them to void at the
end to avoid -Wunused warnings.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
tools/ccanlint/tests/examples_compile.c
patch
|
blob
|
history
diff --git
a/tools/ccanlint/tests/examples_compile.c
b/tools/ccanlint/tests/examples_compile.c
index cb71bf8329db7e54227b7c26af94e97cfb2b18e6..2ca2f34c6970a520c7b8cc3b18cbfc132bdf8c85 100644
(file)
--- a/
tools/ccanlint/tests/examples_compile.c
+++ b/
tools/ccanlint/tests/examples_compile.c
@@
-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;
}