[Bug c/77886] -Wimplicit-fallthrough: breaks duff's device

marc.mutz at kdab dot com gcc-bugzilla@gcc.gnu.org
Thu Oct 6 19:03:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77886

--- Comment #2 from Marc Mutz <marc.mutz at kdab dot com> ---
It's worse than I thought:

    int n = (count + 7) / 8;
    switch (count & 0x07)
    {
    case 0: do { *dest++ = value;
        // fall through
    case 7:      *dest++ = value;
        // fall through
    case 6:      *dest++ = value;
        // fall through
    case 5:      *dest++ = value;
        // fall through
    case 4:      *dest++ = value;
        // fall through
    case 3:      *dest++ = value;
        // fall through
    case 2:      *dest++ = value;
        // fall through
    case 1:      *dest++ = value;
    } while (--n > 0);
    }

still warns.

The only way to avoid the warning is to use [[fallthrough]] at the end of each
line.


More information about the Gcc-bugs mailing list