GCC9 is confused by this comment when building with
CFLAG -Wimplicit-fallthrough=2:
hw/display/tcx.c: In function ‘tcx_dac_writel’:
hw/display/tcx.c:453:26: error: this statement may fall through [-Werror=implicit-fallthrough=]
453 | s->dac_index = (s->dac_index + 1) & 0xff; /* Index autoincrement */
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
hw/display/tcx.c:454:9: note: here
454 | default:
| ^~~~~~~
hw/display/tcx.c: In function ‘tcx_dac_readl’:
hw/display/tcx.c:412:22: error: this statement may fall through [-Werror=implicit-fallthrough=]
412 | s->dac_index = (s->dac_index + 1) & 0xff; /* Index autoincrement */
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
hw/display/tcx.c:413:5: note: here
413 | default:
| ^~~~~~~
cc1: all warnings being treated as errors
Add the missing fall through comments.
Fixes: 55d7bfe22
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Cc: Olivier Danet <odanet@caramail.com>
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/display/tcx.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/hw/display/tcx.c b/hw/display/tcx.c
index 14e829d3fa..abbeb30284 100644
--- a/hw/display/tcx.c
+++ b/hw/display/tcx.c
@@ -410,6 +410,7 @@ static uint64_t tcx_dac_readl(void *opaque, hwaddr addr,
case 2:
val = s->b[s->dac_index] << 24;
s->dac_index = (s->dac_index + 1) & 0xff; /* Index autoincrement */
+ /* fall through */
default:
s->dac_state = 0;
break;
@@ -451,6 +452,7 @@ static void tcx_dac_writel(void *opaque, hwaddr addr, uint64_t val,
s->b[index] = val >> 24;
update_palette_entries(s, index, index + 1);
s->dac_index = (s->dac_index + 1) & 0xff; /* Index autoincrement */
+ /* fall through */
default:
s->dac_state = 0;
break;
--
2.21.0
On 12/17/19 7:34 AM, Philippe Mathieu-Daudé wrote: > GCC9 is confused by this comment when building with > CFLAG -Wimplicit-fallthrough=2: > > hw/display/tcx.c: In function ‘tcx_dac_writel’: > hw/display/tcx.c:453:26: error: this statement may fall through [-Werror=implicit-fallthrough=] > 453 | s->dac_index = (s->dac_index + 1) & 0xff; /* Index autoincrement */ > | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ > hw/display/tcx.c:454:9: note: here > 454 | default: > | ^~~~~~~ > hw/display/tcx.c: In function ‘tcx_dac_readl’: > hw/display/tcx.c:412:22: error: this statement may fall through [-Werror=implicit-fallthrough=] > 412 | s->dac_index = (s->dac_index + 1) & 0xff; /* Index autoincrement */ > | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ > hw/display/tcx.c:413:5: note: here > 413 | default: > | ^~~~~~~ > cc1: all warnings being treated as errors > > Add the missing fall through comments. > > Fixes: 55d7bfe22 > Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> > --- > Cc: Olivier Danet <odanet@caramail.com> > Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> > --- > hw/display/tcx.c | 2 ++ > 1 file changed, 2 insertions(+) Reviewed-by: Richard Henderson <richard.henderson@linaro.org> r~
On Tuesday, December 17, 2019, Philippe Mathieu-Daudé <philmd@redhat.com> wrote: > GCC9 is confused by this comment when building with > CFLAG -Wimplicit-fallthrough=2: > > hw/display/tcx.c: In function ‘tcx_dac_writel’: > hw/display/tcx.c:453:26: error: this statement may fall through > [-Werror=implicit-fallthrough=] > 453 | s->dac_index = (s->dac_index + 1) & 0xff; /* Index > autoincrement */ > | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ > hw/display/tcx.c:454:9: note: here > 454 | default: > | ^~~~~~~ > hw/display/tcx.c: In function ‘tcx_dac_readl’: > hw/display/tcx.c:412:22: error: this statement may fall through > [-Werror=implicit-fallthrough=] > 412 | s->dac_index = (s->dac_index + 1) & 0xff; /* Index > autoincrement */ > | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ > hw/display/tcx.c:413:5: note: here > 413 | default: > | ^~~~~~~ > cc1: all warnings being treated as errors > > Add the missing fall through comments. > > Fixes: 55d7bfe22 > Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> > --- > Cc: Olivier Danet <odanet@caramail.com> > Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> > --- > hw/display/tcx.c | 2 ++ > 1 file changed, 2 insertions(+) > > The content of the patch is fine, but the commit message is, I think, inacurate: gcc is not confused at all, it does what it was told to. The title is fine. > diff --git a/hw/display/tcx.c b/hw/display/tcx.c > index 14e829d3fa..abbeb30284 100644 > --- a/hw/display/tcx.c > +++ b/hw/display/tcx.c > @@ -410,6 +410,7 @@ static uint64_t tcx_dac_readl(void *opaque, hwaddr > addr, > case 2: > val = s->b[s->dac_index] << 24; > s->dac_index = (s->dac_index + 1) & 0xff; /* Index autoincrement > */ > + /* fall through */ > default: > s->dac_state = 0; > break; > @@ -451,6 +452,7 @@ static void tcx_dac_writel(void *opaque, hwaddr addr, > uint64_t val, > s->b[index] = val >> 24; > update_palette_entries(s, index, index + 1); > s->dac_index = (s->dac_index + 1) & 0xff; /* Index > autoincrement */ > + /* fall through */ > default: > s->dac_state = 0; > break; > -- > 2.21.0 > > >
On 12/18/19 8:54 AM, Aleksandar Markovic wrote: > > > On Tuesday, December 17, 2019, Philippe Mathieu-Daudé <philmd@redhat.com > <mailto:philmd@redhat.com>> wrote: > > GCC9 is confused by this comment when building with > CFLAG -Wimplicit-fallthrough=2: > > hw/display/tcx.c: In function ‘tcx_dac_writel’: > hw/display/tcx.c:453:26: error: this statement may fall through > [-Werror=implicit-fallthrough=] > 453 | s->dac_index = (s->dac_index + 1) & 0xff; /* > Index autoincrement */ > | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ > hw/display/tcx.c:454:9: note: here > 454 | default: > | ^~~~~~~ > hw/display/tcx.c: In function ‘tcx_dac_readl’: > hw/display/tcx.c:412:22: error: this statement may fall through > [-Werror=implicit-fallthrough=] > 412 | s->dac_index = (s->dac_index + 1) & 0xff; /* > Index autoincrement */ > | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ > hw/display/tcx.c:413:5: note: here > 413 | default: > | ^~~~~~~ > cc1: all warnings being treated as errors > > Add the missing fall through comments. > > Fixes: 55d7bfe22 > Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com > <mailto:philmd@redhat.com>> > --- > Cc: Olivier Danet <odanet@caramail.com <mailto:odanet@caramail.com>> > Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk > <mailto:mark.cave-ayland@ilande.co.uk>> > --- > hw/display/tcx.c | 2 ++ > 1 file changed, 2 insertions(+) > > > The content of the patch is fine, but the commit message is, I think, > inacurate: gcc is not confused at all, it does what it was told to. You are correct, I'll update the comment. > The title is fine. > > diff --git a/hw/display/tcx.c b/hw/display/tcx.c > index 14e829d3fa..abbeb30284 100644 > --- a/hw/display/tcx.c > +++ b/hw/display/tcx.c > @@ -410,6 +410,7 @@ static uint64_t tcx_dac_readl(void *opaque, > hwaddr addr, > case 2: > val = s->b[s->dac_index] << 24; > s->dac_index = (s->dac_index + 1) & 0xff; /* Index > autoincrement */ > + /* fall through */ > default: > s->dac_state = 0; > break; > @@ -451,6 +452,7 @@ static void tcx_dac_writel(void *opaque, hwaddr > addr, uint64_t val, > s->b[index] = val >> 24; > update_palette_entries(s, index, index + 1); > s->dac_index = (s->dac_index + 1) & 0xff; /* Index > autoincrement */ > + /* fall through */ > default: > s->dac_state = 0; > break; > -- > 2.21.0 > >
© 2016 - 2026 Red Hat, Inc.