Hi Duy,

On Sat, 24 Mar 2018, Nguyễn Thái Ngọc Duy wrote:

> diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
> new file mode 100644
> index 0000000000..c730f718ca
> --- /dev/null
> +++ b/t/helper/test-tool.c
> @@ -0,0 +1,27 @@
> +#include "git-compat-util.h"
> +#include "test-tool.h"
> +
> +struct test_cmd {
> +     const char *name;
> +     int (*main)(int argc, const char **argv);

This makes the build fail on Windows, as we override `main` in
compat/mingw.h:

        /*
         * A replacement of main() that adds win32 specific initialization.
         */

        void mingw_startup(void);
        #define main(c,v) dummy_decl_mingw_main(void); \
        static int mingw_main(c,v); \
        int main(int argc, const char **argv) \
        { \
                mingw_startup(); \
                return mingw_main(__argc, (void *)__argv); \
        } \
        static int mingw_main(c,v)


I know, I know, now that common-main.c is a thing, we could simply pluck a
`platform_specific_pre_main()` or some such, which is overridden in
compat/mingw.h to `mingw_startup` and to a no-op in git-compat-util.h as a
fall-back.

The truth is: I simply did not get around to doing this yet.

In the meantime, could we have this SQUASH???, please?

-- snipsnap --
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index cd5e28b045a..87066ced62a 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -3,7 +3,7 @@
 
 struct test_cmd {
        const char *name;
-       int (*main)(int argc, const char **argv);
+       int (*fn)(int argc, const char **argv);
 };
 
 static struct test_cmd cmds[] = {
@@ -55,7 +55,7 @@ int cmd_main(int argc, const char **argv)
                if (!strcmp(cmds[i].name, argv[1])) {
                        argv++;
                        argc--;
-                       return cmds[i].main(argc, argv);
+                       return cmds[i].fn(argc, argv);
                }
        }
        die("There is no test named '%s'", argv[1]);

Reply via email to