Re: [PATCH v2 01/36] t/helper: add an empty test-tool program
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Mar 26, 2018, 15:27 UTC
- Message-ID
- <nycvar.QRO.7.76.6.1803261722350.77@ZVAVAG-6OXH6DA.rhebcr.pbec.zvpebfbsg.pbz>
- In-Reply-To
- <20180324074505.19100-2-pclouds@gmail.com>
Hi Duy,
On Sat, 24 Mar 2018, Nguyễn Thái Ngọc Duy wrote:
Show 12 quoted lines
> 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]);