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

Re: [PATCH] MSVC: fix build warnings

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 2, 2009, 22:05 UTC
Message-ID
<7v7hvd4flb.fsf@alter.siamese.dyndns.org>
In-Reply-To
<d2e97e800910021440q46bd46c4y8a5af987620ffc5c@mail.gmail.com>
Michael Wookey <michaelwookey@gmail.com> writes:
Show 9 quoted lines
> diff --git a/builtin-branch.c b/builtin-branch.c
> index 9f57992..cf6a9ca 100644
> --- a/builtin-branch.c
> +++ b/builtin-branch.c
> @@ -93,7 +93,7 @@ static const char *branch_get_color(enum color_branch ix)
>
>  static int delete_branches(int argc, const char **argv, int force, int kinds)
>  {
> -	struct commit *rev, *head_rev = head_rev;
I haven't tried, but the patch may break build with "gcc -Werror".

This is a common and unfortunate idiom to tell the readers of the code that this initialization is unnecessary, gcc is not clever enough to notice and gives warnings, and we are squelching it, knowing what we are doing.

Previous: Michael WookeyNext: Michael Wookey
Message 2 of 6 in “MSVC: fix build warnings”
  1. MSVC: fix build warningsMichael Wookey, Oct 2, 2009
  2. Junio C HamanoOct 2, 2009
  3. Michael WookeyOct 2, 2009
  4. Junio C HamanoOct 5, 2009
  5. Michael WookeyOct 5, 2009
  6. Junio C HamanoOct 5, 2009

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.