git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 9/9] sparse: Fix argument number/type warnings caused by the main() macro

From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Date
Apr 7, 2011, 18:51 UTC
Message-ID
<4D9E07A1.4000707@ramsay1.demon.co.uk>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 compat/mingw.h       |    4 ++--
 fast-import.c        |    3 ++-
 git.c                |    3 ++-
 test-chmtime.c       |    2 +-
 test-index-version.c |    2 +-
 test-parse-options.c |    3 ++-
 6 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/compat/mingw.h b/compat/mingw.h
index 62eccd3..ddcf365 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -316,8 +316,8 @@ void free_environ(char **env);
  */
 
 #define main(c,v) dummy_decl_mingw_main(); \
-static int mingw_main(); \
-int main(int argc, const char **argv) \
+static int mingw_main(c,v); \
+int main(int argc, char **argv) \
 { \
 	extern CRITICAL_SECTION pinfo_cs; \
 	_fmode = _O_BINARY; \
diff --git a/fast-import.c b/fast-import.c
index 65d65bf..7ba98c5 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -3247,8 +3247,9 @@ static void parse_argv(void)
 		read_marks();
 }
 
-int main(int argc, const char **argv)
+int main(int argc, char **av)
 {
+	const char **argv = (const char **) av;
 	unsigned int i;
 
 	git_extract_argv0_path(argv[0]);
diff --git a/git.c b/git.c
index ef598c3..31fc678 100644
--- a/git.c
+++ b/git.c
@@ -507,8 +507,9 @@ static int run_argv(int *argcp, const char ***argv)
 }
 
 
-int main(int argc, const char **argv)
+int main(int argc, char **av)
 {
+	const char **argv = (const char **) av;
 	const char *cmd;
 
 	startup_info = &git_startup_info;
diff --git a/test-chmtime.c b/test-chmtime.c
index 92713d1..8532743 100644
--- a/test-chmtime.c
+++ b/test-chmtime.c
@@ -56,7 +56,7 @@ static int timespec_arg(const char *arg, long int *set_time, int *set_eq)
 	return 1;
 }
 
-int main(int argc, const char *argv[])
+int main(int argc, char *argv[])
 {
 	static int verbose;
 
diff --git a/test-index-version.c b/test-index-version.c
index bfaad9e..05d4699 100644
--- a/test-index-version.c
+++ b/test-index-version.c
@@ -1,6 +1,6 @@
 #include "cache.h"
 
-int main(int argc, const char **argv)
+int main(int argc, char **argv)
 {
 	struct cache_header hdr;
 	int version;
diff --git a/test-parse-options.c b/test-parse-options.c
index 4e3710b..925704c 100644
--- a/test-parse-options.c
+++ b/test-parse-options.c
@@ -27,8 +27,9 @@ static int number_callback(const struct option *opt, const char *arg, int unset)
 	return 0;
 }
 
-int main(int argc, const char **argv)
+int main(int argc, char **av)
 {
+	const char **argv = (const char **) av;
 	const char *prefix = "prefix/";
 	const char *usage[] = {
 		"test-parse-options <options>",
-- 
1.7.4
Message 1 of 1 in “sparse: Fix argument number/type warnings caused by the main() macro”
  1. 9/9 sparse: Fix argument number/type warnings caused by the main() macroRamsay Jones, Apr 7, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.