From: NeilBrown <neilb@suse.de>
To: Jes.Sorensen@redhat.com
Cc: linux-raid@vger.kernel.org, karsten@redhat.com
Subject: Re: [PATCH 0/1] consistent return types from byteswap macros
Date: Wed, 16 Oct 2013 12:44:35 +1100 [thread overview]
Message-ID: <20131016124435.0570f720@notabene.brown> (raw)
In-Reply-To: <1381390925-9033-1-git-send-email-Jes.Sorensen@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1620 bytes --]
On Thu, 10 Oct 2013 09:42:04 +0200 Jes.Sorensen@redhat.com wrote:
> From: Jes Sorensen <Jes.Sorensen@redhat.com>
>
> Hi,
>
> There are multiple ways to solve this one, but I think this is the
> least intrusive solution, even if not the prettiest.
>
> Problem is that current macros simply return the original value if cpu
> byteorder equals the converted type, leaking through the original
> type. This results in errors like this when building for PPC64, as an
> example:
>
> gcc -Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -DMAP_DIR=\"/run/mdadm\" -DMAP_FILE=\"map\" -DMDMON_DIR=\"/run/mdadm\" -DFAILED_SLOTS_DIR=\"/run/mdadm/failed-slots\" -DUSE_PTHREADS -c -o super-intel.o super-intel.c
> super-ddf.c: In function 'examine_vd':
> super-ddf.c:1414:10: error: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type '__u64' [-Werror=format=]
> be64_to_cpu(vc->blocks)/2);
> ^
>
> We could force the macros to all return u16/u32/u64, which would be
> 'cleaner'. However I suspect that would make us chase a pile of build
> warnings converting all printf's to explicitly cast. So I made them
> return the same types as our byteswap macros default to (hence the
> unsigned int return type for the 16 bit swaps).
>
> Jes
Looks good. Applied. Thanks.
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
prev parent reply other threads:[~2013-10-16 1:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-10 7:42 [PATCH 0/1] consistent return types from byteswap macros Jes.Sorensen
2013-10-10 7:42 ` [PATCH 1/1] Be consistent in " Jes.Sorensen
2013-10-16 1:44 ` NeilBrown [this message]
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=20131016124435.0570f720@notabene.brown \
--to=neilb@suse.de \
--cc=Jes.Sorensen@redhat.com \
--cc=karsten@redhat.com \
--cc=linux-raid@vger.kernel.org \
/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).