~kennylevinsen/public-inbox

1

[PATCH wlsunset 2/2] main: pacify -Wimplicit-fallthrough with Clang

Jan Beich
Details
Message ID
<lffb-nqhc-wny@FreeBSD.org>
DKIM signature
pass
Download raw message
Patch: +3 -1
../main.c:305:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
        case POLAR_NIGHT:
        ^
../main.c:305:2: note: insert '__attribute__((fallthrough));' to silence this warning
        case POLAR_NIGHT:
        ^
        __attribute__((fallthrough));
../main.c:305:2: note: insert 'break;' to avoid fall-through
        case POLAR_NIGHT:
        ^
        break;
1 error generated.
---
 main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/main.c b/main.c
index 4c27d58..bcf69fc 100644
--- a/main.c
+++ b/main.c
@@ -301,7 +301,9 @@ static time_t get_deadline_transition(const struct context *ctx, time_t now) {
		if (now < ctx->sun.sunrise) {
			return get_deadline_normal(ctx, now);
		}
		// fallthrough
#ifdef __GNUC__
		__attribute__((fallthrough));
#endif
	case POLAR_NIGHT:
		return tomorrow(now, -ctx->longitude_time_offset);
	default:
Details
Message ID
<KWEJJQ.PXIPOJOR5QXN@kl.wtf>
In-Reply-To
<lffb-nqhc-wny@FreeBSD.org> (view parent)
DKIM signature
pass
Download raw message
(double-send as client had defaulted back to HTML behind my back)

This one doesn't go that well. The current form works on FreeBSD 12 in 
CI, while __attribute__((fallthrough)) leads to errors 
(https://builds.sr.ht/~kennylevinsen/job/338130).

Any clue what might be up with that?
Reply to thread Export thread (mbox)