From: Nikolay Borisov <nborisov@suse.com>
To: Marcos Paulo de Souza <marcos.souza.org@gmail.com>,
dsterba@suse.com, linux-btrfs@vger.kernel.org
Cc: Marcos Paulo de Souza <mpdesouza@suse.com>
Subject: Re: [PATCH 1/2] btrfs-progs: utils: Replace __attribute__(fallthrough)
Date: Tue, 22 Oct 2019 09:59:24 +0300 [thread overview]
Message-ID: <b06b57f8-09da-0f86-2957-4caf1ec13606@suse.com> (raw)
In-Reply-To: <20191022020228.14117-2-marcos.souza.org@gmail.com>
On 22.10.19 г. 5:02 ч., Marcos Paulo de Souza wrote:
> From: Marcos Paulo de Souza <mpdesouza@suse.com>
>
> When compiling with clang, this warning is shown:
>
> common/utils.c:404:3: warning: declaration does not declare anything [-Wmissing-declarations]
> __attribute__ ((fallthrough));
>
> This attribute seems to silence the same warning in GCC. Changing this
> attribute with /* fallthrough */ fixes the warning for both gcc and
> clang.
>
> Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
Which clang version are you using? According to
https://clang.llvm.org/docs/AttributeReference.html#fallthrough this
attribute is supported even with the GNU syntax.
> ---
> common/utils.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/common/utils.c b/common/utils.c
> index 2cf15c33..a88336b3 100644
> --- a/common/utils.c
> +++ b/common/utils.c
> @@ -401,15 +401,15 @@ int pretty_size_snprintf(u64 size, char *str, size_t str_size, unsigned unit_mod
> case UNITS_TBYTES:
> base *= mult;
> num_divs++;
> - __attribute__ ((fallthrough));
> + /* fallthrough */
> case UNITS_GBYTES:
> base *= mult;
> num_divs++;
> - __attribute__ ((fallthrough));
> + /* fallthrough */
> case UNITS_MBYTES:
> base *= mult;
> num_divs++;
> - __attribute__ ((fallthrough));
> + /* fallthrough */
> case UNITS_KBYTES:
> num_divs++;
> break;
> @@ -1135,14 +1135,14 @@ int test_num_disk_vs_raid(u64 metadata_profile, u64 data_profile,
> default:
> case 4:
> allowed |= BTRFS_BLOCK_GROUP_RAID10;
> - __attribute__ ((fallthrough));
> + /* fallthrough */
> case 3:
> allowed |= BTRFS_BLOCK_GROUP_RAID6;
> - __attribute__ ((fallthrough));
> + /* fallthrough */
> case 2:
> allowed |= BTRFS_BLOCK_GROUP_RAID0 | BTRFS_BLOCK_GROUP_RAID1 |
> BTRFS_BLOCK_GROUP_RAID5;
> - __attribute__ ((fallthrough));
> + /* fallthrough */
> case 1:
> allowed |= BTRFS_BLOCK_GROUP_DUP;
> }
>
next prev parent reply other threads:[~2019-10-22 6:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-22 2:02 [PATCH 0/2] btrfs-progs: Setting implicit-fallthrough by default Marcos Paulo de Souza
2019-10-22 2:02 ` [PATCH 1/2] btrfs-progs: utils: Replace __attribute__(fallthrough) Marcos Paulo de Souza
2019-10-22 6:59 ` Nikolay Borisov [this message]
2019-10-22 7:01 ` Nikolay Borisov
2019-10-22 12:18 ` Marcos Paulo de Souza
2019-10-22 2:02 ` [PATCH 2/2] btrfs-progs: Makefile: Add -Wimplicit-fallthrough Marcos Paulo de Souza
2019-10-22 12:41 ` [PATCH 0/2] btrfs-progs: Setting implicit-fallthrough by default David Sterba
2019-10-22 12:45 ` Nikolay Borisov
2019-10-22 13:10 ` 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=b06b57f8-09da-0f86-2957-4caf1ec13606@suse.com \
--to=nborisov@suse.com \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=marcos.souza.org@gmail.com \
--cc=mpdesouza@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