Add "-Wimplicit-fallthrough" to default flags (was Re: pgsql: Support FETCH FIRST WITH TIES)

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Add "-Wimplicit-fallthrough" to default flags (was Re: pgsql: Support FETCH FIRST WITH TIES)
Date: 2020-04-12 08:18:25
Message-ID: 20200412081825.qyo5vwwco3fv4gdo@nol
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Sat, Apr 11, 2020 at 02:47:34PM -0400, Tom Lane wrote:
> Julien Rouhaud <rjuju123(at)gmail(dot)com> writes:
> > On Tue, Apr 7, 2020 at 10:28 PM Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
> >> Support FETCH FIRST WITH TIES
>
> > FTR I now get the following when compiling with -Wimplicit-fallthrough -Werror:
>
> Yeah, assorted buildfarm animals are mentioning that too. I wonder
> if we should add that to the default warning options selected by
> configure? I don't remember if that's been discussed before.
>

I'm all for it. It seems like a trap easy to catch up early, and we do want to
enforce it anyway. I'm attaching a simple patch for that if needed, hopefully
with the correct autoconf version.

> > It seems that this fall-through comment:
> > /* fall-through */
> > Is not recognized by my compiler (gcc (Gentoo 9.3.0 p1) 9.3.0). If
> > that's something we should fix, PFA a naive patch for that.
>
> Hmm, I feel like this logic is baroque enough to need more of a rewrite
> than that :-(. But not sure exactly what would be better, so your
> patch seems reasonable for now. The comments could use some help too.

Yes I just checked the state machine to make sure that the fallthrough was
expected, but the comments are now way better, thanks!

Attachment Content-Type Size
v1-implicit-fallthrough.diff text/plain 3.8 KB

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2020-04-12 14:55:20 Re: Add "-Wimplicit-fallthrough" to default flags (was Re: pgsql: Support FETCH FIRST WITH TIES)
Previous Message Peter Geoghegan 2020-04-12 04:08:08 pgsql: Doc: Fix contrib/amcheck tip.

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2020-04-12 10:53:58 Re: pg_stat_statements issue with parallel maintenance (Was Re: WAL usage calculation patch)
Previous Message Noah Misch 2020-04-12 07:42:45 Re: cleaning perl code