Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Label in switch statement breaks Clang's fallthrough checker #36

Open
sempervictus opened this issue Feb 18, 2024 · 4 comments
Open

Label in switch statement breaks Clang's fallthrough checker #36

sempervictus opened this issue Feb 18, 2024 · 4 comments

Comments

@sempervictus
Copy link

Building 6.6.4 with clang, i'm seeing:

  AR      kernel/module/built-in.a
fs/aufs/opts.c:673:3: error: fallthrough annotation does not directly precede switch label
                fallthrough;
                ^
./include/linux/compiler_attributes.h:227:41: note: expanded from macro 'fallthrough'
# define fallthrough                    __attribute__((__fallthrough__))
                                        ^
  AR      kernel/built-in.a
1 error generated.

which appears to be happening because of the add: label below the fallthrough in:

 671         case Opt_prepend:
 672                 opt->add.bindex = 0;
 673                 fallthrough;
 674         add: /* indented label */
 675         case Opt_add

is there some sort of annotation needed to make this work or formatting of the label to make Clang happy?

@sfjro
Copy link
Owner

sfjro commented Feb 19, 2024 via email

@sempervictus
Copy link
Author

That's what i ended up doing too

commit 13e220c996fe2205c020ad4ca056acac183eb611
Author: RageLtMan <rageltman [at] sempervictus>
Date:   Sun Feb 18 12:17:06 2024 -0500

    AUFS: move label

diff --git a/fs/aufs/opts.c b/fs/aufs/opts.c
index 20421440c004..1628137da28b 100644
--- a/fs/aufs/opts.c
+++ b/fs/aufs/opts.c
@@ -671,8 +671,8 @@ static int au_opt_br(struct super_block *sb, struct au_opt *opt,
        case Opt_prepend:
                opt->add.bindex = 0;
                fallthrough;
-       add: /* indented label */
        case Opt_add:
+       add: /* indented label */
                err = au_br_add(sb, &opt->add,
                                au_ftest_opts(opts->flags, REMOUNT));
                if (!err) {

@sfjro
Copy link
Owner

sfjro commented Feb 19, 2024 via email

sfjro pushed a commit to sfjro/aufs-linux that referenced this issue Feb 25, 2024
    AUFS: move label

See-also: sfjro/aufs-standalone#36
Signed-off-by: J. R. Okajima <[email protected]>
@sfjro
Copy link
Owner

sfjro commented Feb 25, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants