pg_bsd_indent and -Wimplicit-fallthrough

Started by Michael Paquierover 5 years ago9 messages
#1Michael Paquier
michael@paquier.xyz
1 attachment(s)

Hi,

I have just noticed that pg_bsd_indent complains since
-Wimplicit-fallthrough=3 has been added to the default set of switches
if available.

Something like the attached is fine to take care of those warnings,
but what's our current patching policy for this tool?

Thanks,
--
Michael

Attachments:

bsdindent-fallthru.patchtext/x-diff; charset=us-asciiDownload
diff --git a/indent.c b/indent.c
index 9faf57a..5da3401 100644
--- a/indent.c
+++ b/indent.c
@@ -917,6 +917,7 @@ check_type:
 	case structure:
 	    if (ps.p_l_follow > 0)
 		goto copy_id;
+		/* FALLTHROUGH */
 	case decl:		/* we have a declaration type (int, etc.) */
 	    parse(decl);	/* let parser worry about indentation */
 	    if (ps.last_token == rparen && ps.tos <= 1) {
diff --git a/parse.c b/parse.c
index a51eb8b..bf6b169 100644
--- a/parse.c
+++ b/parse.c
@@ -100,6 +100,7 @@ parse(int tk) /* tk: the code for the construct scanned */
 		 */
 		ps.i_l_follow = ps.il[ps.tos--];
 	/* the rest is the same as for dolit and forstmt */
+	/* FALLTHROUGH */
     case dolit:		/* 'do' */
     case forstmt:		/* for (...) */
 	ps.p_stack[++ps.tos] = tk;
#2Julien Rouhaud
rjuju123@gmail.com
In reply to: Michael Paquier (#1)
Re: pg_bsd_indent and -Wimplicit-fallthrough

On Fri, May 15, 2020 at 8:03 AM Michael Paquier <michael@paquier.xyz> wrote:

Hi,

I have just noticed that pg_bsd_indent complains since
-Wimplicit-fallthrough=3 has been added to the default set of switches
if available.

Oh Indeed.

Something like the attached is fine to take care of those warnings,
but what's our current patching policy for this tool?

The patch looks good to me. It looks like we already have custom
patches, so +1 to applying it.

#3Daniel Gustafsson
daniel@yesql.se
In reply to: Julien Rouhaud (#2)
Re: pg_bsd_indent and -Wimplicit-fallthrough

On 15 May 2020, at 08:28, Julien Rouhaud <rjuju123@gmail.com> wrote:
On Fri, May 15, 2020 at 8:03 AM Michael Paquier <michael@paquier.xyz> wrote:

Something like the attached is fine to take care of those warnings,
but what's our current patching policy for this tool?

The patch looks good to me. It looks like we already have custom
patches, so +1 to applying it.

Shouldn't we try and propose it to upstream first to minimize our diff?

cheers ./daniel

#4Julien Rouhaud
rjuju123@gmail.com
In reply to: Daniel Gustafsson (#3)
Re: pg_bsd_indent and -Wimplicit-fallthrough

On Fri, May 15, 2020 at 9:17 AM Daniel Gustafsson <daniel@yesql.se> wrote:

On 15 May 2020, at 08:28, Julien Rouhaud <rjuju123@gmail.com> wrote:
On Fri, May 15, 2020 at 8:03 AM Michael Paquier <michael@paquier.xyz> wrote:

Something like the attached is fine to take care of those warnings,
but what's our current patching policy for this tool?

The patch looks good to me. It looks like we already have custom
patches, so +1 to applying it.

Shouldn't we try and propose it to upstream first to minimize our diff?

Good point, adding Piotr.

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Julien Rouhaud (#4)
Re: pg_bsd_indent and -Wimplicit-fallthrough

Julien Rouhaud <rjuju123@gmail.com> writes:

On Fri, May 15, 2020 at 9:17 AM Daniel Gustafsson <daniel@yesql.se> wrote:

On 15 May 2020, at 08:28, Julien Rouhaud <rjuju123@gmail.com> wrote:

The patch looks good to me. It looks like we already have custom
patches, so +1 to applying it.

Shouldn't we try and propose it to upstream first to minimize our diff?

Good point, adding Piotr.

In the meantime, I went ahead and pushed this to our pg_bsd_indent repo.

regards, tom lane

#6Michael Paquier
michael@paquier.xyz
In reply to: Tom Lane (#5)
Re: pg_bsd_indent and -Wimplicit-fallthrough

On Sat, May 16, 2020 at 11:56:28AM -0400, Tom Lane wrote:

In the meantime, I went ahead and pushed this to our pg_bsd_indent repo.

Thanks, Tom.
--
Michael

#7Julien Rouhaud
rjuju123@gmail.com
In reply to: Michael Paquier (#6)
Re: pg_bsd_indent and -Wimplicit-fallthrough

On Sun, May 17, 2020 at 2:32 AM Michael Paquier <michael@paquier.xyz> wrote:

On Sat, May 16, 2020 at 11:56:28AM -0400, Tom Lane wrote:

In the meantime, I went ahead and pushed this to our pg_bsd_indent repo.

Thanks, Tom.

+1, thanks a lot!

#8Piotr Stefaniak
postgres@piotr-stefaniak.me
In reply to: Julien Rouhaud (#7)
Re: pg_bsd_indent and -Wimplicit-fallthrough

On 18/05/2020 11.22, Julien Rouhaud wrote:

On Sun, May 17, 2020 at 2:32 AM Michael Paquier <michael@paquier.xyz> wrote:

On Sat, May 16, 2020 at 11:56:28AM -0400, Tom Lane wrote:

In the meantime, I went ahead and pushed this to our pg_bsd_indent repo.

Thanks, Tom.

+1, thanks a lot!

Committed upstream, thank you.

#9Julien Rouhaud
rjuju123@gmail.com
In reply to: Piotr Stefaniak (#8)
Re: pg_bsd_indent and -Wimplicit-fallthrough

On Thu, May 21, 2020 at 7:39 PM Piotr Stefaniak
<postgres@piotr-stefaniak.me> wrote:

On 18/05/2020 11.22, Julien Rouhaud wrote:

On Sun, May 17, 2020 at 2:32 AM Michael Paquier <michael@paquier.xyz> wrote:

On Sat, May 16, 2020 at 11:56:28AM -0400, Tom Lane wrote:

In the meantime, I went ahead and pushed this to our pg_bsd_indent repo.

Thanks, Tom.

+1, thanks a lot!

Committed upstream, thank you.

Thanks!