mit-scheme-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master branch fails to build because of compiler warning.


From: Lingyu Zhu
Subject: Re: master branch fails to build because of compiler warning.
Date: Thu, 4 Feb 2021 15:07:08 +0800

macro FALLTHROUGH() is expanded to ((void 0)) in my case, since my
clang major number is below 12.
However, I wonder why clang not complaint on switch label
RC_INTERNAL_APPLY_VAL, because it lacks explicit break as well.

I also tried to add break at the end of the case label :
https://git.savannah.gnu.org/cgit/mit-scheme.git/tree/src/microcode/interp.c?id=43ea2feb108135921eea80228c9797e95676209e#n1086
The error message remains the same as mentioned above.

Adding __attribute__((fallthrough)); at the same place, the output is
slightly different:
interp.c:831:5: error: unannotated fall-through between switch labels
[-Werror,-Wimplicit-fallthrough]
    case RC_INTERNAL_APPLY:
    ^
interp.c:831:5: note: insert '__attribute__((fallthrough));' to
silence this warning
    case RC_INTERNAL_APPLY:
    ^
    __attribute__((fallthrough));
interp.c:831:5: note: insert 'break;' to avoid fall-through
    case RC_INTERNAL_APPLY:
    ^
    break;
error: fallthrough annotation in unreachable code
[-Werror,-Wimplicit-fallthrough]
2 errors generated.
*** Error code 1

I also tried add this annotation at some other places within the
switch case, but no success.

On Thu, Feb 4, 2021 at 1:34 PM Taylor R Campbell <campbell@mumble.net> wrote:
>
> > Date: Thu, 4 Feb 2021 13:14:27 +0800
> > From: Lingyu Zhu <lynuszhu@gmail.com>
> >
> > It seems the label should be added with a break or an annotation to
> > shut up the compiler.
>
> That's exactly what `FALLTHROUGH ();' on the line above is supposed to
> do:
>
> https://git.savannah.gnu.org/cgit/mit-scheme.git/tree/src/microcode/interp.c?id=43ea2feb108135921eea80228c9797e95676209e#n830
>
> Maybe the definition of FALLTHROUGH and ATTRIBUTE in confshared.h
> isn't getting picked up by clang?  Can you determine which branches of
> those #ifs are getting hit on your system and why?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]