tools/ccanlint: add args to main.
[ccan] / tools / ccanlint / tests / examples_compile.c
index cb71bf8329db7e54227b7c26af94e97cfb2b18e6..2ca2f34c6970a520c7b8cc3b18cbfc132bdf8c85 100644 (file)
@@ -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;
 }