From: Michael Wookey <michaelwookey@gmail.com>
To: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH] MSVC: fix build warnings
Date: Sat, 3 Oct 2009 09:28:28 +1000 [thread overview]
Message-ID: <d2e97e800910021628t13bba313he119ba59babdecee@mail.gmail.com> (raw)
In-Reply-To: <7v7hvd4flb.fsf@alter.siamese.dyndns.org>
2009/10/3 Junio C Hamano <gitster@pobox.com>:
> Michael Wookey <michaelwookey@gmail.com> writes:
>
>> 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.
I can't build with -Werror on Ubuntu 9.04 (gcc 4.3.3) because of the following:
http://article.gmane.org/gmane.comp.version-control.git/127477
With the current git.rc2, I also get the following warnings:
builtin-mailinfo.c: In function 'handle_commit_msg':
builtin-mailinfo.c:789: warning: ignoring return value of
'ftruncate', declared with attribute warn_unused_result
It would be nice to get those warnings removed.
I just tried my patch with gcc 4.2.1 (Mac OSX 10.6) and there are a
few warnings that are generated because some of the variables have had
their initial values removed. I can send a V2 if you like, however
these variable were initialised that way for a reason and it might not
be sensible to clean them up in the way I was proposing.
What would be a good method of fixing these warnings now that we have
the ability to compile with MSVC? Explicitly initialising the
variables (to something sane) or should we start to introduce compiler
specific pragmas (ugly...) that aim to clean the various build
warnings? I just want to reduce (and eventually remove) all the build
noise when building using MSVC.
From what I have seen so far, building with MSVC spews out a lot of
warnings. I am building with MSVC in both the IDE and from a build
console via:
devenv git.sln /useenv /build "Debug|Win32"
If you compile using gcc with "-Wextra" you will see a similar amount
of build noise that gets generated. See the following for some
previous discussion:
http://article.gmane.org/gmane.comp.version-control.git/128967
next prev parent reply other threads:[~2009-10-02 23:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-02 21:40 [PATCH] MSVC: fix build warnings Michael Wookey
2009-10-02 22:05 ` Junio C Hamano
2009-10-02 23:28 ` Michael Wookey [this message]
2009-10-05 2:41 ` Junio C Hamano
2009-10-05 5:38 ` Michael Wookey
2009-10-05 6:31 ` 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=d2e97e800910021628t13bba313he119ba59babdecee@mail.gmail.com \
--to=michaelwookey@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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).