~kennylevinsen/public-inbox

wlsunset 2/2: main: pacify -Wimplicit-fallthrough with Clang >= 10 v2 SUPERSEDED

Jan Beich
Jan Beich: 1
 main: pacify -Wimplicit-fallthrough with Clang >= 10

 1 files changed, 3 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~kennylevinsen/public-inbox/patches/14852/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH wlsunset 2/2 v2] main: pacify -Wimplicit-fallthrough with Clang >= 10 Export this patch

Jan Beich
../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..49d6955 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
#if __has_attribute(fallthrough)
		__attribute__((fallthrough));
#endif
	case POLAR_NIGHT:
		return tomorrow(now, -ctx->longitude_time_offset);
	default: