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

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Add "-Wimplicit-fallthrough" to default flags (was Re: pgsql: Support FETCH FIRST WITH TIES)
Date: 2020-05-11 12:53:59
Message-ID: CAOBaU_YXcgZ8So4iXffCUmPBCWh5rt-yfoXmcKwsBco=Bu_koQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Mon, May 11, 2020 at 2:07 PM Andrew Dunstan
<andrew(dot)dunstan(at)2ndquadrant(dot)com> wrote:
>
>
> On 5/11/20 7:29 AM, Julien Rouhaud wrote:
> > On Mon, May 11, 2020 at 6:47 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >> Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
> >>> On 2020-May-06, Alvaro Herrera wrote:
> >>>> This doesn't allow whitespace between "fall" and "through", which means
> >>>> we generate 217 such warnings currently. Or we can just use
> >>>> -Wimplicit-fallthrough=3, which does allow whitespace (among other
> >>>> detritus).
> >>> If we're OK with patching all those places, I volunteer to do so. Any
> >>> objections? Or I can keep it at level 3, which can be done with minimal
> >>> patching.
> >> If we're gonna do it at all, I think we should go for the level 4
> >> warnings. Level 3's idea of a fallthrough comment is too liberal
> >> for my tastes...
> > Here's a patch that also takes care of cleaning all warning due to the
> > level 4 setting (at least the one I got with my other config options).
> > I went with "FALLTHRU" as this seemed more used.
> >
> > Note that timezone/zic.c would also have to be changed.
>
>
>
> Since this is external code maybe we should leave that at level 3? I
> think that should be doable via a Makefile override.

Yes that was my concern. The best way I found to avoid changing zic.c
is something like that in src/timezone/Makefile, before the zic
target:

ifneq (,$(filter -Wimplicit-fallthrough=4,$(CFLAGS)))
CFLAGS := $(filter-out -Wimplicit-fallthrough=4,$(CFLAGS))
CFLAGS += '-Wimplicit-fallthrough=3'
endif

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2020-05-11 13:41:20 Re: Add "-Wimplicit-fallthrough" to default flags (was Re: pgsql: Support FETCH FIRST WITH TIES)
Previous Message Andrew Dunstan 2020-05-11 12:07:27 Re: Add "-Wimplicit-fallthrough" to default flags (was Re: pgsql: Support FETCH FIRST WITH TIES)

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2020-05-11 12:56:03 Re: Concurrency bug in amcheck
Previous Message Ashutosh Bapat 2020-05-11 12:26:33 Re: gcov coverage data not full with immediate stop