diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2020-08-05 22:58:22 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2020-08-05 22:58:22 +0300 |
commit | 50ad1980858b1092ebdd8c3dd6ae14d72596eb4d (patch) | |
tree | 1cf5f09b7554eed30007067719022243a440e4e5 /winsup/cygwin/sigproc.cc | |
parent | 5898a044c32cf67a1fdc90c8ba48c166d2b11909 (diff) |
Cygwin: Add 'fallthrough' pseudo keyword for switch/case use
This patch has been inspired by the Linux kernel patch
294f69e662d1 compiler_attributes.h: Add 'fallthrough' pseudo keyword for switch/case use
written by Joe Perches <joe AT perches DOT com> based on an idea from
Dan Carpenter <dan DOT carpenter AT oracle DOT com>. The following text
is from the original log message:
Reserve the pseudo keyword 'fallthrough' for the ability to convert the
various case block /* fallthrough */ style comments to appear to be an
actual reserved word with the same gcc case block missing fallthrough
warning capability.
All switch/case blocks now should end in one of:
break;
fallthrough;
goto <label>;
return [expression];
continue;
In C mode, GCC supports the __fallthrough__ attribute since 7.1,
the same time the warning and the comment parsing were introduced.
Cygwin-only: add an explicit -Wimplicit-fallthrough=5 to the build
flags.
Diffstat (limited to 'winsup/cygwin/sigproc.cc')
-rw-r--r-- | winsup/cygwin/sigproc.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index 7286e3238..a5cf73bde 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -205,7 +205,7 @@ proc_subproc (DWORD what, uintptr_t val) set_errno (EAGAIN); break; } - /* fall through intentionally */ + fallthrough; case PROC_DETACHED_CHILD: if (vchild != myself) @@ -1078,7 +1078,7 @@ child_info::proc_retry (HANDLE h) case STATUS_CONTROL_C_EXIT: if (saw_ctrl_c ()) return EXITCODE_OK; - /* fall through intentionally */ + fallthrough; case STATUS_DLL_INIT_FAILED: case STATUS_DLL_INIT_FAILED_LOGOFF: case EXITCODE_RETRY: @@ -1387,10 +1387,10 @@ wait_sig (VOID *) sig_clear (-pack.si.si_signo); else sigq.add (pack); - /*FALLTHRU*/ + fallthrough; case __SIGNOHOLD: sig_held = false; - /*FALLTHRU*/ + fallthrough; case __SIGFLUSH: case __SIGFLUSHFAST: if (!sig_held) |