From: Nikolay Borisov <nborisov@suse.com>
To: Qu Wenruo <wqu@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 5/9] btrfs-progs: Fix Wimplicit-fallthrough warning
Date: Fri, 16 Nov 2018 10:04:16 +0200 [thread overview]
Message-ID: <f95d5ad5-9be6-ef37-bbbf-189a7059c86b@suse.com> (raw)
In-Reply-To: <20181116075426.4142-6-wqu@suse.com>
On 16.11.18 г. 9:54 ч., Qu Wenruo wrote:
> Although most fallthrough case is pretty obvious, we still need to teach
> the dumb compiler that it's an explicit fallthrough.
>
> Also reformat the code to use common indent.
>
> Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Is this attribute dependent on a particular compiler version? Does
gcc4.4 for example support it?
> ---
> utils.c | 30 ++++++++++++++++++++++--------
> 1 file changed, 22 insertions(+), 8 deletions(-)
>
> diff --git a/utils.c b/utils.c
> index a310300829eb..b274f46fdd9d 100644
> --- a/utils.c
> +++ b/utils.c
> @@ -1134,15 +1134,25 @@ int pretty_size_snprintf(u64 size, char *str, size_t str_size, unsigned unit_mod
> num_divs = 0;
> last_size = size;
> switch (unit_mode & UNITS_MODE_MASK) {
> - case UNITS_TBYTES: base *= mult; num_divs++;
> - case UNITS_GBYTES: base *= mult; num_divs++;
> - case UNITS_MBYTES: base *= mult; num_divs++;
> - case UNITS_KBYTES: num_divs++;
> - break;
> + case UNITS_TBYTES:
> + base *= mult;
> + num_divs++;
> + __attribute__ ((fallthrough));
> + case UNITS_GBYTES:
> + base *= mult;
> + num_divs++;
> + __attribute__ ((fallthrough));
> + case UNITS_MBYTES:
> + base *= mult;
> + num_divs++;
> + __attribute__ ((fallthrough));
> + case UNITS_KBYTES:
> + num_divs++;
> + break;
> case UNITS_BYTES:
> - base = 1;
> - num_divs = 0;
> - break;
> + base = 1;
> + num_divs = 0;
> + break;
> default:
> if (negative) {
> s64 ssize = (s64)size;
> @@ -1907,13 +1917,17 @@ int test_num_disk_vs_raid(u64 metadata_profile, u64 data_profile,
> default:
> case 4:
> allowed |= BTRFS_BLOCK_GROUP_RAID10;
> + __attribute__ ((fallthrough));
> case 3:
> allowed |= BTRFS_BLOCK_GROUP_RAID6;
> + __attribute__ ((fallthrough));
> case 2:
> allowed |= BTRFS_BLOCK_GROUP_RAID0 | BTRFS_BLOCK_GROUP_RAID1 |
> BTRFS_BLOCK_GROUP_RAID5;
> + __attribute__ ((fallthrough));
> case 1:
> allowed |= BTRFS_BLOCK_GROUP_DUP;
> + __attribute__ ((fallthrough));
> }
>
> if (dev_cnt > 1 && profile & BTRFS_BLOCK_GROUP_DUP) {
>
next prev parent reply other threads:[~2018-11-16 8:04 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-16 7:54 [PATCH 0/9] btrfs-progs: Make W=1 clean (no "again") Qu Wenruo
2018-11-16 7:54 ` [PATCH 1/9] btrfs-progs: Makefile.extrawarn: Import cc-disable-warning Qu Wenruo
2018-12-04 11:04 ` David Sterba
2018-11-16 7:54 ` [PATCH 2/9] btrfs-progs: fix gcc8 default build warning caused by '-Wformat-truncation' Qu Wenruo
2018-12-04 11:10 ` David Sterba
2018-12-04 12:21 ` Qu Wenruo
2018-11-16 7:54 ` [PATCH 3/9] btrfs-progs: Makefile.extrawarn: Don't warn on sign compare Qu Wenruo
2018-11-16 8:00 ` [PATCH v1.1 " Qu Wenruo
2018-12-04 11:10 ` David Sterba
2018-11-16 7:54 ` [PATCH 4/9] btrfs-progs: Fix Wempty-body warning Qu Wenruo
2018-11-16 8:01 ` Nikolay Borisov
2018-11-16 7:54 ` [PATCH 5/9] btrfs-progs: Fix Wimplicit-fallthrough warning Qu Wenruo
2018-11-16 8:04 ` Nikolay Borisov [this message]
2018-11-16 8:10 ` Qu Wenruo
2018-11-16 7:54 ` [PATCH 6/9] btrfs-progs: Fix Wsuggest-attribute=format warning Qu Wenruo
2018-11-16 8:06 ` Nikolay Borisov
2018-11-16 7:54 ` [PATCH 7/9] btrfs-progs: Fix Wmaybe-uninitialized warning Qu Wenruo
2018-11-16 8:13 ` Nikolay Borisov
2018-11-16 8:16 ` Qu Wenruo
2018-11-16 8:22 ` [PATCH v1.1 " Qu Wenruo
2018-11-16 8:24 ` Nikolay Borisov
2018-12-04 12:17 ` [PATCH " David Sterba
2018-12-04 12:22 ` Adam Borowski
2018-12-04 12:42 ` Nikolay Borisov
2018-12-05 5:38 ` Qu Wenruo
2018-11-16 7:54 ` [PATCH 8/9] btrfs-progs: Fix Wtype-limits warning Qu Wenruo
2018-11-16 8:07 ` Nikolay Borisov
2018-11-16 7:54 ` [PATCH 9/9] btrfs-progs: Cleanup warning reported by -Wmissing-prototypes except free space tree Qu Wenruo
2018-11-16 8:04 ` [PATCH v1.1 9/9] btrfs-progs: Cleanup warning reported by -Wmissing-prototypes Qu Wenruo
2018-11-16 8:14 ` Nikolay Borisov
2018-12-04 12:22 ` David Sterba
2018-12-04 12:24 ` Qu Wenruo
2018-12-04 12:48 ` David Sterba
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=f95d5ad5-9be6-ef37-bbbf-189a7059c86b@suse.com \
--to=nborisov@suse.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=wqu@suse.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).