On Tue, 2019-10-22 at 10:01 +0300, Nikolay Borisov wrote:
> 
> On 22.10.19 г. 9:59 ч., Nikolay Borisov wrote:
> > 
> > 
> > On 22.10.19 г. 5:02 ч., Marcos Paulo de Souza wrote:
> >> From: Marcos Paulo de Souza <mpdeso...@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 <mpdeso...@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.
> 
> Looking at the documentation the gnu syntax is supported in the
> 'current' / 10, unreleased version. All others, up to version 9 does
> not
> support this syntax.

I'm using the default clang in Tumbleweed (20191009):
clang --version
clang version 8.0.1 (tags/RELEASE_801/final 366581)

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

Reply via email to