git/compat
Ramsay Jones 84d32bf767 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>
2013-04-28 12:32:08 -07:00
..
fnmatch compat/fnmatch/fnmatch.c: Fix a sparse error 2013-04-28 12:24:40 -07:00
nedmalloc compat/nedmalloc: Fix compiler warnings on linux 2013-04-28 12:26:09 -07:00
poll compat/poll/poll.c: Fix a sparse warning 2013-04-28 12:27:04 -07:00
regex compat/regex/regexec.c: Fix some sparse warnings 2013-04-28 12:24:18 -07:00
vcbuild msvc: Fix build by adding missing symbol defines 2013-02-25 12:40:03 -08:00
win32 compat/win32/pthread.c: Fix a sparse warning 2013-04-28 12:26:45 -07:00
basename.c compat: add a basename() compatibility function 2009-05-31 17:57:59 -07:00
bswap.h compat: make gcc bswap an inline function 2011-03-16 12:44:59 -07:00
cygwin.c Make core.sharedRepository work under cygwin 1.7 2013-03-25 14:57:33 -07:00
cygwin.h Make core.sharedRepository work under cygwin 1.7 2013-03-25 14:57:33 -07:00
fopen.c compat/fopen.c: avoid clobbering the system defined fopen macro 2008-05-08 17:43:01 -07:00
hstrerror.c Add a local implementation of hstrerror for the system which do not have it 2007-06-15 22:48:34 -07:00
inet_ntop.c Drop system includes from inet_pton/inet_ntop compatibility wrappers 2012-02-05 16:32:33 -08:00
inet_pton.c Drop system includes from inet_pton/inet_ntop compatibility wrappers 2012-02-05 16:32:33 -08:00
memmem.c optimize compat/ memmem() 2009-03-02 18:28:06 -08:00
mingw.c compat/mingw.c: Fix some sparse warnings 2013-04-28 12:27:11 -07:00
mingw.h sparse: Fix mingw_main() argument number/type errors 2013-04-28 12:32:08 -07:00
mkdir.c compat: some mkdir() do not like a slash at the end 2012-08-24 09:48:51 -07:00
mkdtemp.c Fix gitmkdtemp: correct test for mktemp() return value 2010-02-25 12:08:22 -08:00
mmap.c War on whitespace 2007-06-07 00:04:01 -07:00
msvc.c win32: use our own dirent.h 2010-11-23 16:06:50 -08:00
msvc.h msvc: test-svn-fe: Fix linker "unresolved external" error 2013-02-25 12:40:34 -08:00
obstack.c obstack.c: Fix some sparse warnings 2011-09-11 14:43:33 -07:00
obstack.h obstack: fix spelling of similar 2013-04-12 12:23:20 -07:00
pread.c Replacing the system call pread() with lseek()/xread()/lseek() sequence. 2007-01-09 16:40:40 -08:00
precompose_utf8.c utf8.c: add reencode_string_len() that can handle NULs in string 2013-04-18 16:28:28 -07:00
precompose_utf8.h git on Mac OS and precomposed unicode 2012-07-08 22:03:46 -07:00
qsort.c cleanup: use internal memory allocation wrapper functions everywhere 2011-10-06 13:54:32 -07:00
setenv.c compat/setenv.c: error if name contains '=' 2011-12-14 19:31:03 -08:00
snprintf.c compat/snprintf: don't look at va_list twice 2011-12-12 09:09:35 -08:00
strcasestr.c Clean up compatibility definitions. 2005-12-05 15:50:29 -08:00
strlcpy.c simplify inclusion of system header files. 2006-12-20 09:51:35 -08:00
strtoimax.c Add strtoimax() compatibility function. 2011-11-02 13:06:30 -07:00
strtoumax.c Add a compat/strtoumax.c for Solaris 8. 2007-02-19 18:20:30 -08:00
terminal.c mingw: reuse tty-version of git_terminal_prompt 2012-12-04 08:03:08 -08:00
terminal.h add generic terminal prompt function 2011-12-12 16:09:38 -08:00
unsetenv.c compat/unsetenv.c: Fix a sparse warning 2013-04-28 12:26:38 -07:00
win32.h Make usage of windows.h lean and mean 2009-09-18 20:00:42 -07:00
win32mmap.c compat/win32mmap.c: Fix some sparse warnings 2013-04-28 12:27:08 -07:00
winansi.c Make usage of windows.h lean and mean 2009-09-18 20:00:42 -07:00