linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
To: dsterba@suse.com, linux-btrfs@vger.kernel.org
Cc: Marcos Paulo de Souza <mpdesouza@suse.com>
Subject: [PATCH 1/2] btrfs-progs: utils: Replace __attribute__(fallthrough)
Date: Mon, 21 Oct 2019 23:02:27 -0300	[thread overview]
Message-ID: <20191022020228.14117-2-marcos.souza.org@gmail.com> (raw)
In-Reply-To: <20191022020228.14117-1-marcos.souza.org@gmail.com>

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>
---
 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;
 	}
-- 
2.23.0


  reply	other threads:[~2019-10-22  2:00 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 ` Marcos Paulo de Souza [this message]
2019-10-22  6:59   ` [PATCH 1/2] btrfs-progs: utils: Replace __attribute__(fallthrough) Nikolay Borisov
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=20191022020228.14117-2-marcos.souza.org@gmail.com \
    --to=marcos.souza.org@gmail.com \
    --cc=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).