]> git.ozlabs.org Git - ccan/blobdiff - tools/ccanlint/tests/examples_compile.c
tools/ccanlint: add args to main.
[ccan] / tools / ccanlint / tests / examples_compile.c
index 745860668beddc8e158d3d5226dc3a4d0b4b849b..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;
 }
 
@@ -485,7 +490,7 @@ static struct ccan_file *mangle_example(struct manifest *m,
                return NULL;
 
        contents = mangle(m, lines);
-       if (write(fd, contents, strlen(contents)) != strlen(contents)) {
+       if (write(fd, contents, strlen(contents)) != (int)strlen(contents)) {
                close(fd);
                return NULL;
        }
@@ -550,7 +555,7 @@ static unsigned int try_compiling(struct manifest *m,
 }
 
 static void build_examples(struct manifest *m,
-                          unsigned int *timeleft, struct score *score)
+                          unsigned int *timeleft UNNEEDED, struct score *score)
 {
        struct ccan_file *i;
        char **prev = NULL;