git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <johannes.sixt@telecom.at>
To: Steffen Prohaska <prohaska@zib.de>
Cc: git@vger.kernel.org, "Junio C Hamano" <gitster@pobox.com>,
	"Björn Steinbrink" <B.Steinbrink@gmx.de>
Subject: Re: [PATCH] Modify mingw_main() workaround to avoid link errors
Date: Sun,  3 Aug 2008 21:55:28 +0200	[thread overview]
Message-ID: <1217793328.48960d306d2b7@webmail.nextra.at> (raw)
In-Reply-To: <1217065304-27815-1-git-send-email-prohaska@zib.de>

Zitat von Steffen Prohaska <prohaska@zib.de>:
> With MinGW's
>
>    gcc.exe (GCC) 3.4.5 (mingw special)
>    GNU ld version 2.17.50 20060824
>
> the old define caused link errors:
>
>    git.o: In function `main':
>    C:/msysgit/git/git.c:500: undefined reference to `mingw_main'
>    collect2: ld returned 1 exit status
>
> The modified define works.
>
> Signed-off-by: Steffen Prohaska <prohaska@zib.de>

Acked-by: Johannes Sixt <johannes.sixt@telecom.at>

I was not aware that my version (block-scoped static function forward
declaration) is not valid C. Thanks, Björn, for pointing out the gcc bugzilla
entries.

-- Hannes

> ---
>  compat/mingw.h |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/compat/mingw.h b/compat/mingw.h
> index 290a9e6..a52e657 100644
> --- a/compat/mingw.h
> +++ b/compat/mingw.h
> @@ -228,9 +228,10 @@ char **env_setenv(char **env, const char *name);
>   * A replacement of main() that ensures that argv[0] has a path
>   */
>
> -#define main(c,v) main(int argc, const char **argv) \
> +#define main(c,v) dummy_decl_mingw_main(); \
> +static int mingw_main(); \
> +int main(int argc, const char **argv) \
>  { \
> -	static int mingw_main(); \
>  	argv[0] = xstrdup(_pgmptr); \
>  	return mingw_main(argc, argv); \
>  } \
> --
> 1.6.0.rc0.42.g186458

  parent reply	other threads:[~2008-08-03 19:56 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-26  9:41 [PATCH] Modify mingw_main() workaround to avoid link errors Steffen Prohaska
2008-07-26 13:17 ` Johannes Schindelin
2008-07-26 16:07   ` Steffen Prohaska
2008-07-26 14:14 ` [PATCH] Set up argv0_path correctly, even when argv[0] is just the basename Johannes Schindelin
2008-07-26 14:54   ` Rene Herman
2008-07-26 15:10     ` Johannes Schindelin
2008-07-26 15:19       ` Rene Herman
2008-07-26 15:35         ` Johannes Schindelin
2008-07-26 15:53           ` Rene Herman
2008-07-26 17:31   ` Junio C Hamano
2008-07-26 17:42     ` Johannes Schindelin
2008-08-03 20:25   ` Jan Hudec
2008-08-03 20:43     ` Junio C Hamano
2008-07-26 20:37 ` [PATCH] Modify mingw_main() workaround to avoid link errors Johannes Sixt
2008-07-26 21:36   ` Steffen Prohaska
2008-07-27 19:24     ` Johannes Sixt
2008-07-29  4:46       ` Steffen Prohaska
2008-07-29  8:33         ` Johannes Sixt
2008-07-29 19:46           ` Steffen Prohaska
2008-08-03 19:55 ` Johannes Sixt [this message]
2008-08-03 21:21   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1217793328.48960d306d2b7@webmail.nextra.at \
    --to=johannes.sixt@telecom.at \
    --cc=B.Steinbrink@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=prohaska@zib.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).