From: Junio C Hamano <gitster@pobox.com>
To: Antoine Pelisse <apelisse@gmail.com>
Cc: John Keeping <john@keeping.me.uk>, Max Horn <max@quendi.de>,
git <git@vger.kernel.org>, Johannes Sixt <j6t@kdbg.org>
Subject: Re: [PATCH 1/2] fix clang -Wconstant-conversion with bit fields
Date: Wed, 16 Jan 2013 15:46:18 -0800 [thread overview]
Message-ID: <7vlibsvghh.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <7vpq14vglu.fsf@alter.siamese.dyndns.org> (Junio C. Hamano's message of "Wed, 16 Jan 2013 15:43:41 -0800")
Junio C Hamano <gitster@pobox.com> writes:
> Antoine Pelisse <apelisse@gmail.com> writes:
>
>> clang incorrectly reports a constant conversion warning (implicit
>> truncation to bit field) when using the "flag &= ~FLAG" form, because
>> ~FLAG needs to be truncated.
>>
>> Convert this form to "flag = flag & ~FLAG" fixes the issue as
>> the right operand now fits into the bit field.
>
> If the "clang incorrectly reports" is already recognised by clang
> folks as a bug to be fixed in clang, I'd rather not to take this
> patch.
>
> I do not think it is reasonable to expect people to remember that
> they have to write "flags &= ~TO_DROP" in a longhand whenever they
> are adding new code that needs to do bit-fields, so even if this
> patch makes clang silent for the _current_ code, it will not stay
> that way. Something like
>
> #define FLIP_BIT_CLR(fld,bit) do { \
> typeof(fld) *x = &(fld); \
> *x = *x & (~(bit)); \
> } while (0)
>
> may be more palapable but not by a large margin.
>
> Yuck.
Double yuck. I meant palatable.
In any case, I see somebody reports that more recent clang does not
have this bug in the near-by message, so let's forget about this
issue.
Thanks.
next prev parent reply other threads:[~2013-01-16 23:46 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-16 14:53 [PATCH] fix some clang warnings Max Horn
2013-01-16 16:04 ` Jeff King
2013-01-16 16:53 ` Junio C Hamano
2013-01-16 17:12 ` Antoine Pelisse
2013-01-16 17:18 ` John Keeping
2013-01-16 17:26 ` Max Horn
2013-01-16 17:50 ` Jeff King
2013-01-16 18:00 ` Jeff King
2013-01-16 18:09 ` Jeff King
2013-01-16 18:12 ` John Keeping
2013-01-16 18:15 ` Jeff King
2013-01-16 18:21 ` Antoine Pelisse
2013-01-16 18:22 ` John Keeping
2013-01-16 18:24 ` Jeff King
2013-01-16 19:01 ` John Keeping
2013-01-17 10:24 ` John Keeping
2013-01-16 22:47 ` [PATCH 1/2] fix clang -Wconstant-conversion with bit fields Antoine Pelisse
2013-01-16 22:47 ` [PATCH 2/2] fix clang -Wtautological-compare with unsigned enum Antoine Pelisse
2013-01-16 23:10 ` Antoine Pelisse
2013-01-17 10:32 ` Antoine Pelisse
2013-01-17 11:00 ` John Keeping
2013-01-17 11:23 ` [PATCH] combine-diff: suppress a clang warning John Keeping
2013-01-17 16:44 ` [PATCH 2/2] fix clang -Wtautological-compare with unsigned enum Linus Torvalds
2013-01-17 16:56 ` Antoine Pelisse
2013-01-17 17:02 ` John Keeping
2013-01-18 17:15 ` Phil Hord
2013-01-18 18:52 ` Linus Torvalds
2013-01-16 23:08 ` [PATCH 1/2] fix clang -Wconstant-conversion with bit fields John Keeping
2013-01-16 23:09 ` Antoine Pelisse
2013-01-16 23:15 ` Antoine Pelisse
2013-01-16 23:43 ` Junio C Hamano
2013-01-16 23:46 ` Junio C Hamano [this message]
2013-01-16 18:03 ` [PATCH] fix some clang warnings Tomas Carnecky
2013-01-16 18:12 ` Matthieu Moy
2013-02-01 5:37 ` Miles Bader
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=7vlibsvghh.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=apelisse@gmail.com \
--cc=git@vger.kernel.org \
--cc=j6t@kdbg.org \
--cc=john@keeping.me.uk \
--cc=max@quendi.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).