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

Jan Beich
Message ID
DKIM signature
Download raw message
Patch: +8 -1
Kenny levinsen <kl@kl.wtf> writes:

> 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?

Clang 8 is only used by FreeBSD 12.1 which reaches EOL on 2021-01-31.
Clang 10 on FreeBSD 11.4/12.2 and Clang 11 on FreeBSD 13.0 are not affected.
Ironically, Clang >= 10 suggests what Clang < 10 doesn't like.

Either detect the attribute

diff --git a/main.c b/main.c
index bcf69fc..49d6955 100644
--- a/main.c
+++ b/main.c
@@ -301,7 +301,7 @@ static time_t get_deadline_transition(const struct context *ctx, time_t now) {
		if (now < ctx->sun.sunrise) {
			return get_deadline_normal(ctx, now);
#ifdef __GNUC__
#if __has_attribute(fallthrough)

or shove it under the carpet

diff --git a/.builds/freebsd.yml b/.builds/freebsd.yml
index ac8481e..c98cc89 100644
--- a/.builds/freebsd.yml
+++ b/.builds/freebsd.yml
@@ -8,5 +8,12 @@ sources:
   - https://git.sr.ht/~kennylevinsen/wlsunset
   - build: |
      # XXX Drop after builds.sr.ht upgrades FreeBSD to 12.2
      case $(${CC:-cc} --version) in
       *version\ 8.0.*)
         CFLAGS="${CFLAGS} -Wno-missing-declarations"

      meson build wlsunset
      ninja -C build

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

Message ID
<imae-eaty-wny@FreeBSD.org> (view parent)
DKIM signature
Download raw message
On Mon, Nov 9, 2020 at 17:47, Jan Beich <jbeich@FreeBSD.org> wrote:
> or shove it under the carpet

I shoved all the way off the face of the planet by disabling the 
warning altogether, as it's not super important here. Hopefully that 
does the trick for you. :P

Not exactly satisfied with how poorly clang is handling this though. 
What good is an implicit fallthrough warning if compilers can't agree 
on how to do explicit fallthrough? >_>
Reply to thread Export thread (mbox)