public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/91432] gcc -Wimplicit-fallthrough does not warn when fallthrough to break;
       [not found] <bug-91432-4@http.gcc.gnu.org/bugzilla/>
@ 2020-06-04 17:45 ` ndesaulniers at google dot com
  2021-07-22 18:25 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: ndesaulniers at google dot com @ 2020-06-04 17:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91432

Nick Desaulniers <ndesaulniers at google dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ndesaulniers at google dot com

--- Comment #3 from Nick Desaulniers <ndesaulniers at google dot com> ---
Isn't this still an implicit fallthrough, though?  It may not "be a bug," but
that's why warnings are not errors; they may not result in "bugs."

The issue is that Clang will warn in this case, so developers get confused
about writing compiler-portable code with intentional fallthrough vs being
warned about unintentional fallthrough.

Why shouldn't developers annotate that the implicit fallthrough from `case 1`
to `default` was intentional, making it explicit?

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

* [Bug c/91432] gcc -Wimplicit-fallthrough does not warn when fallthrough to break;
       [not found] <bug-91432-4@http.gcc.gnu.org/bugzilla/>
  2020-06-04 17:45 ` [Bug c/91432] gcc -Wimplicit-fallthrough does not warn when fallthrough to break; ndesaulniers at google dot com
@ 2021-07-22 18:25 ` jakub at gcc dot gnu.org
  2021-07-27 20:20 ` ndesaulniers at google dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-07-22 18:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91432

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The warning has been carefully designed not to warn in common cases which pose
no problems, see e.g.
https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7 or
the lengthy discussions held around the submission of the feature. Not warning
in this case is a very intentional part of those design decisions.

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

* [Bug c/91432] gcc -Wimplicit-fallthrough does not warn when fallthrough to break;
       [not found] <bug-91432-4@http.gcc.gnu.org/bugzilla/>
  2020-06-04 17:45 ` [Bug c/91432] gcc -Wimplicit-fallthrough does not warn when fallthrough to break; ndesaulniers at google dot com
  2021-07-22 18:25 ` jakub at gcc dot gnu.org
@ 2021-07-27 20:20 ` ndesaulniers at google dot com
  2021-07-27 20:34 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: ndesaulniers at google dot com @ 2021-07-27 20:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91432

--- Comment #5 from Nick Desaulniers <ndesaulniers at google dot com> ---
> Not warning in this case is a very intentional part of those design decisions.

Can you provide a link to the discussion about this specific case?

Is re-evaluating the decision out of the question?

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

* [Bug c/91432] gcc -Wimplicit-fallthrough does not warn when fallthrough to break;
       [not found] <bug-91432-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2021-07-27 20:20 ` ndesaulniers at google dot com
@ 2021-07-27 20:34 ` jakub at gcc dot gnu.org
  2021-07-27 22:28 ` joe at perches dot com
  2021-07-27 22:32 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-07-27 20:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91432

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Nick Desaulniers from comment #5)
> > Not warning in this case is a very intentional part of those design decisions.
> 
> Can you provide a link to the discussion about this specific case?

The discussions are on gcc-patches mailing list, look into archives from July
2016 to August or September, initially with -Wswitch-fallthrough in the
subject, later -Wimplicit-fallthrough.

> Is re-evaluating the decision out of the question?

Yes.  It is pointless to start warning about code that obviously can't do any
harm, it will only alienate users that will need to mark up more code.
The work Marek has done on this warning started with getting through warnings
on gcc itself and on other projects and has been fine tuned on where it is
essential not to warn and where false positives can be acceptable.

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

* [Bug c/91432] gcc -Wimplicit-fallthrough does not warn when fallthrough to break;
       [not found] <bug-91432-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2021-07-27 20:34 ` jakub at gcc dot gnu.org
@ 2021-07-27 22:28 ` joe at perches dot com
  2021-07-27 22:32 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: joe at perches dot com @ 2021-07-27 22:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91432

--- Comment #7 from Joe Perches <joe at perches dot com> ---
What could be useful is to add yet another --extra-strict-fallthrough warning
flag that would make it possible for these cases to have a warning.

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

* [Bug c/91432] gcc -Wimplicit-fallthrough does not warn when fallthrough to break;
       [not found] <bug-91432-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2021-07-27 22:28 ` joe at perches dot com
@ 2021-07-27 22:32 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-07-27 22:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91432

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Useful for what?  What exactly is an advantage to require attribute at such a
place?  Nothing will warn if you put it there, but I don't see a rationale for
requiring it.

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

end of thread, other threads:[~2021-07-27 22:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-91432-4@http.gcc.gnu.org/bugzilla/>
2020-06-04 17:45 ` [Bug c/91432] gcc -Wimplicit-fallthrough does not warn when fallthrough to break; ndesaulniers at google dot com
2021-07-22 18:25 ` jakub at gcc dot gnu.org
2021-07-27 20:20 ` ndesaulniers at google dot com
2021-07-27 20:34 ` jakub at gcc dot gnu.org
2021-07-27 22:28 ` joe at perches dot com
2021-07-27 22:32 ` jakub at gcc dot gnu.org

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 read-only IMAP folder(s) and NNTP newsgroup(s).