Skip to content
  • Ramsay Allan Jones's avatar
    sparse: Fix mingw_main() argument number/type errors · 84d32bf7
    Ramsay Allan Jones authored
    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 'mai...
    84d32bf7