u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] lib: missing fallthrough comment in vsnprintf_internal()
@ 2023-04-01  6:13 Heinrich Schuchardt
  2023-04-02  2:37 ` Simon Glass
  2023-04-07 14:50 ` Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Heinrich Schuchardt @ 2023-04-01  6:13 UTC (permalink / raw)
  To: Tom Rini
  Cc: Simon Glass, Ramon Fried, Viacheslav Mitrofanov, u-boot,
	Heinrich Schuchardt

When a case statement intentionally falls through we should add a comment.
Cf. -Wimplicit-fallthrough

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 lib/vsprintf.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 2d13e68b57..8af6310651 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -674,6 +674,7 @@ repeat:
 
 		case 'x':
 			flags |= SMALL;
+		/* fallthrough */
 		case 'X':
 			base = 16;
 			break;
@@ -681,8 +682,10 @@ repeat:
 		case 'd':
 			if (fmt[1] == 'E')
 				flags |= ERRSTR;
+		/* fallthrough */
 		case 'i':
 			flags |= SIGN;
+		/* fallthrough */
 		case 'u':
 			break;
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] lib: missing fallthrough comment in vsnprintf_internal()
  2023-04-01  6:13 [PATCH 1/1] lib: missing fallthrough comment in vsnprintf_internal() Heinrich Schuchardt
@ 2023-04-02  2:37 ` Simon Glass
  2023-04-07 14:50 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Glass @ 2023-04-02  2:37 UTC (permalink / raw)
  To: Heinrich Schuchardt
  Cc: Tom Rini, Ramon Fried, Viacheslav Mitrofanov, U-Boot Mailing List

Hi Heinrich,

On Sat, 1 Apr 2023 at 19:13, Heinrich Schuchardt <
heinrich.schuchardt@canonical.com> wrote:
>
> When a case statement intentionally falls through we should add a comment.
> Cf. -Wimplicit-fallthrough
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  lib/vsprintf.c | 4 ++++
>  1 file changed, 4 insertions(+)

Why not use the fallthrough macro here?

>
> diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> index 2d13e68b57..8af6310651 100644
> --- a/lib/vsprintf.c
> +++ b/lib/vsprintf.c
> @@ -674,6 +674,7 @@ repeat:
>
>                 case 'x':
>                         flags |= SMALL;
> +               /* fallthrough */
>                 case 'X':
>                         base = 16;
>                         break;
> @@ -681,8 +682,10 @@ repeat:
>                 case 'd':
>                         if (fmt[1] == 'E')
>                                 flags |= ERRSTR;
> +               /* fallthrough */
>                 case 'i':
>                         flags |= SIGN;
> +               /* fallthrough */
>                 case 'u':
>                         break;
>
> --
> 2.39.2
>

Regards,
Simon

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] lib: missing fallthrough comment in vsnprintf_internal()
  2023-04-01  6:13 [PATCH 1/1] lib: missing fallthrough comment in vsnprintf_internal() Heinrich Schuchardt
  2023-04-02  2:37 ` Simon Glass
@ 2023-04-07 14:50 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2023-04-07 14:50 UTC (permalink / raw)
  To: Heinrich Schuchardt
  Cc: Simon Glass, Ramon Fried, Viacheslav Mitrofanov, u-boot

[-- Attachment #1: Type: text/plain, Size: 307 bytes --]

On Sat, Apr 01, 2023 at 08:13:42AM +0200, Heinrich Schuchardt wrote:

> When a case statement intentionally falls through we should add a comment.
> Cf. -Wimplicit-fallthrough
> 
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-04-07 14:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-01  6:13 [PATCH 1/1] lib: missing fallthrough comment in vsnprintf_internal() Heinrich Schuchardt
2023-04-02  2:37 ` Simon Glass
2023-04-07 14:50 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).