diff options
author | Ramsay Jones <ramsay@ramsay1.demon.co.uk> | 2013-04-27 20:19:47 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-04-28 12:32:08 -0700 |
commit | 84d32bf7678259c08406571cd6ce4b7a6724dcba (patch) | |
tree | d358d8b783ee5b18644d4d17a5c085369a23827c /credential-store.c | |
parent | 657b35f4bef7d25831607882ed7f1f2ced378eb7 (diff) | |
download | git-84d32bf7678259c08406571cd6ce4b7a6724dcba.tar.gz |
sparse: Fix mingw_main() argument number/type errors
Sparse issues 68 errors (two errors for each main() function) such
as the following:
SP git.c
git.c:510:5: error: too many arguments for function mingw_main
git.c:510:5: error: symbol 'mingw_main' redeclared with different type \
(originally declared at git.c:510) - different argument counts
The errors are caused by the 'main' macro used by the MinGW build
to provide a replacement main() function. The original main function
is effectively renamed to 'mingw_main' and is called from the new
main function. The replacement main is used to execute certain actions
common to all git programs on MinGW (e.g. ensure the standard I/O
streams are in binary mode).
In order to suppress the errors, we change the macro to include the
parameters in the declaration of the mingw_main function.
Unfortunately, this change provokes both sparse and gcc to complain
about 9 calls to mingw_main(), such as the following:
CC git.o
git.c: In function 'main':
git.c:510: warning: passing argument 2 of 'mingw_main' from \
incompatible pointer type
git.c:510: note: expected 'const char **' but argument is of \
type 'char **'
In order to suppress these warnings, since both of the main
functions need to be declared with the same prototype, we
change the declaration of the 9 main functions, thus:
int main(int argc, char **argv)
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'credential-store.c')
-rw-r--r-- | credential-store.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/credential-store.c b/credential-store.c index 26f7589a60..f9146e576f 100644 --- a/credential-store.c +++ b/credential-store.c @@ -114,7 +114,7 @@ static int lookup_credential(const char *fn, struct credential *c) return c->username && c->password; } -int main(int argc, const char **argv) +int main(int argc, char **argv) { const char * const usage[] = { "git credential-store [options] <action>", @@ -131,7 +131,7 @@ int main(int argc, const char **argv) umask(077); - argc = parse_options(argc, argv, NULL, options, usage, 0); + argc = parse_options(argc, (const char **)argv, NULL, options, usage, 0); if (argc != 1) usage_with_options(usage, options); op = argv[0]; |