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.
This commit is contained in:
Corinna Vinschen 2020-08-05 21:58:22 +02:00
parent 5898a044c3
commit 50ad198085
33 changed files with 67 additions and 63 deletions

View File

@ -73,7 +73,7 @@ CRT0:=$(cygwin_build)/crt0.o
# #
MT_SAFE:=@MT_SAFE@ MT_SAFE:=@MT_SAFE@
CCEXTRA= CCEXTRA=
COMMON_CFLAGS=-MMD ${$(*F)_CFLAGS} -Werror -fmerge-constants -ftracer $(CCEXTRA) COMMON_CFLAGS=-MMD ${$(*F)_CFLAGS} -Wimplicit-fallthrough=5 -Werror -fmerge-constants -ftracer $(CCEXTRA)
ifeq ($(target_cpu),x86_64) ifeq ($(target_cpu),x86_64)
COMMON_CFLAGS+=-mcmodel=small COMMON_CFLAGS+=-mcmodel=small
endif endif

View File

@ -698,7 +698,7 @@ aio_read (struct aiocb *aio)
if (slot >= 0) if (slot >= 0)
debug_printf ("slot %d released", slot); debug_printf ("slot %d released", slot);
} }
/* fall through */ fallthrough;
case ENOBUFS: case ENOBUFS:
aio->aio_errno = EINPROGRESS; aio->aio_errno = EINPROGRESS;
@ -888,7 +888,7 @@ aio_write (struct aiocb *aio)
if (slot >= 0) if (slot >= 0)
debug_printf ("slot %d released", slot); debug_printf ("slot %d released", slot);
} }
/* fall through */ fallthrough;
case ENOBUFS: case ENOBUFS:
aio->aio_errno = EINPROGRESS; aio->aio_errno = EINPROGRESS;

View File

@ -551,7 +551,7 @@ get_cygwin_startup_info ()
case _CH_FORK: case _CH_FORK:
in_forkee = true; in_forkee = true;
should_be_cb = sizeof (child_info_fork); should_be_cb = sizeof (child_info_fork);
/* fall through */; fallthrough;
case _CH_SPAWN: case _CH_SPAWN:
case _CH_EXEC: case _CH_EXEC:
if (!should_be_cb) if (!should_be_cb)
@ -570,7 +570,7 @@ get_cygwin_startup_info ()
break; break;
default: default:
system_printf ("unknown exec type %u", res->type); system_printf ("unknown exec type %u", res->type);
/* intentionally fall through */ fallthrough;
case _CH_WHOOPS: case _CH_WHOOPS:
res = NULL; res = NULL;
break; break;

View File

@ -741,7 +741,7 @@ exception::handle (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in,
Linux behaviour and also makes a lot of sense on Windows. */ Linux behaviour and also makes a lot of sense on Windows. */
if (me.altstack.ss_flags) if (me.altstack.ss_flags)
global_sigs[SIGSEGV].sa_handler = SIG_DFL; global_sigs[SIGSEGV].sa_handler = SIG_DFL;
/*FALLTHRU*/ fallthrough;
case STATUS_ARRAY_BOUNDS_EXCEEDED: case STATUS_ARRAY_BOUNDS_EXCEEDED:
case STATUS_IN_PAGE_ERROR: case STATUS_IN_PAGE_ERROR:
case STATUS_NO_MEMORY: case STATUS_NO_MEMORY:

View File

@ -255,7 +255,7 @@ retry:
break; break;
} }
} }
/*FALLTHRU*/ fallthrough;
case STATUS_INVALID_DEVICE_REQUEST: case STATUS_INVALID_DEVICE_REQUEST:
case STATUS_INVALID_PARAMETER: case STATUS_INVALID_PARAMETER:
case STATUS_INVALID_HANDLE: case STATUS_INVALID_HANDLE:
@ -265,6 +265,7 @@ retry:
len = (size_t) -1; len = (size_t) -1;
break; break;
} }
fallthrough;
default: default:
__seterrno_from_nt_status (status); __seterrno_from_nt_status (status);
len = (size_t) -1; len = (size_t) -1;

View File

@ -1067,7 +1067,7 @@ fhandler_dev_dsp::open (int flags, mode_t)
case O_RDWR: case O_RDWR:
if ((num_in = waveInGetNumDevs ()) == 0) if ((num_in = waveInGetNumDevs ()) == 0)
err = ENXIO; err = ENXIO;
/* Fall through */ fallthrough;
case O_WRONLY: case O_WRONLY:
if ((num_out = waveOutGetNumDevs ()) == 0) if ((num_out = waveOutGetNumDevs ()) == 0)
err = ENXIO; err = ENXIO;

View File

@ -103,7 +103,7 @@ fhandler_serial::raw_read (void *ptr, size_t& ulen)
default: /* Handle an error case from cygwait basically like default: /* Handle an error case from cygwait basically like
a cancel condition and see if we got "something" */ a cancel condition and see if we got "something" */
CancelIo (get_handle ()); CancelIo (get_handle ());
/*FALLTHRU*/ fallthrough;
case WAIT_OBJECT_0: case WAIT_OBJECT_0:
if (!GetOverlappedResult (get_handle (), &ov, &read_bytes, if (!GetOverlappedResult (get_handle (), &ov, &read_bytes,
TRUE)) TRUE))

View File

@ -140,7 +140,7 @@ fhandler_socket::ioctl (unsigned int cmd, void *p)
case OLD_SIOCGIFMTU: case OLD_SIOCGIFMTU:
case OLD_SIOCGIFINDEX: case OLD_SIOCGIFINDEX:
cmd = CONV_OLD_TO_NEW_SIO (cmd); cmd = CONV_OLD_TO_NEW_SIO (cmd);
/*FALLTHRU*/ fallthrough;
case SIOCGIFFLAGS: case SIOCGIFFLAGS:
case SIOCGIFBRDADDR: case SIOCGIFBRDADDR:
case SIOCGIFNETMASK: case SIOCGIFNETMASK:

View File

@ -92,7 +92,7 @@ fhandler_termios::tcsetpgrp (const pid_t pgid)
if (_my_tls.call_signal_handler ()) if (_my_tls.call_signal_handler ())
continue; continue;
set_errno (EINTR); set_errno (EINTR);
/* fall through intentionally */ fallthrough;
default: default:
res = -1; res = -1;
break; break;

View File

@ -1550,7 +1550,7 @@ fhandler_pty_slave::write (const void *ptr, size_t len)
{ {
case ERROR_NO_DATA: case ERROR_NO_DATA:
err = ERROR_IO_DEVICE; err = ERROR_IO_DEVICE;
/*FALLTHRU*/ fallthrough;
default: default:
__seterrno_from_win_error (err); __seterrno_from_win_error (err);
} }
@ -2163,7 +2163,7 @@ fhandler_pty_slave::facl (int cmd, int nentries, aclent_t *aclbufp)
set_errno (EFAULT); set_errno (EFAULT);
break; break;
} }
/*FALLTHRU*/ fallthrough;
case GETACLCNT: case GETACLCNT:
if (!input_available_event) if (!input_available_event)
{ {

View File

@ -112,7 +112,7 @@ fhandler_windows::read (void *buf, size_t& len)
pthread::static_cancel_self (); pthread::static_cancel_self ();
break; break;
} }
/*FALLTHRU*/ fallthrough;
case WAIT_OBJECT_0 + 2: case WAIT_OBJECT_0 + 2:
if (!PeekMessageW (ptr, hWnd_, 0, 0, PM_REMOVE)) if (!PeekMessageW (ptr, hWnd_, 0, 0, PM_REMOVE))
{ {

View File

@ -347,7 +347,7 @@ globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv, size_t *l
i--; i--;
break; break;
} }
/* FALLTHROUGH */ fallthrough;
case COMMA: case COMMA:
if (i && *pm == COMMA) if (i && *pm == COMMA)
break; break;

View File

@ -404,7 +404,7 @@ gr_ent::enumerate_caches ()
} }
cnt = 0; cnt = 0;
max = 1; max = 1;
/*FALLTHRU*/ fallthrough;
case 1: case 1:
if (from_files) if (from_files)
{ {
@ -415,7 +415,7 @@ gr_ent::enumerate_caches ()
} }
cnt = 0; cnt = 0;
max = 2; max = 2;
/*FALLTHRU*/ fallthrough;
case 2: case 2:
if (from_db) if (from_db)
{ {

View File

@ -282,7 +282,7 @@ b64_pton(char const *src, unsigned char *target, size_t targsize)
return (-1); return (-1);
ch = *src++; /* Skip the = */ ch = *src++; /* Skip the = */
/* Fall through to "single trailing =" case. */ /* Fall through to "single trailing =" case. */
/* FALLTHROUGH */ fallthrough;
case 3: /* Valid, means two bytes of info */ case 3: /* Valid, means two bytes of info */
/* /*

View File

@ -193,7 +193,7 @@ fnmatch1(const char *pattern, const char *string, const char *stringstart,
return (FNM_NOMATCH); return (FNM_NOMATCH);
pattern += pclen; pattern += pclen;
} }
/* FALLTHROUGH */ fallthrough;
default: default:
norm: norm:
string += sclen; string += sclen;

View File

@ -88,7 +88,7 @@ ftw(const char *path, int (*fn)(const char *, const struct stat *, int),
break; break;
case FTS_DC: case FTS_DC:
errno = ELOOP; errno = ELOOP;
/* FALLTHROUGH */ fallthrough;
default: default:
error = -1; error = -1;
goto done; goto done;

View File

@ -81,6 +81,7 @@ static pthread_rwlock_t rwlock = PTHREAD_RWLOCK_INITIALIZER;
#else #else
#include "../locale/setlocale.h" #include "../locale/setlocale.h"
#include "winsup.h"
#define SIZE_T_MAX __SIZE_MAX__ #define SIZE_T_MAX __SIZE_MAX__
#define _close close #define _close close
#define _open open #define _open open
@ -233,7 +234,7 @@ catopen(const char *name, int type)
break; break;
case '%': case '%':
++nlspath; ++nlspath;
/* FALLTHROUGH */ fallthrough;
default: default:
if (pathP - path >= if (pathP - path >=
sizeof(path) - 1) sizeof(path) - 1)

View File

@ -105,7 +105,7 @@ nftw(const char *path, int (*fn)(const char *, const struct stat *, int,
break; break;
case FTS_DC: case FTS_DC:
errno = ELOOP; errno = ELOOP;
/* FALLTHROUGH */ fallthrough;
default: default:
error = -1; error = -1;
goto done; goto done;

View File

@ -179,7 +179,7 @@ next:
case DEFAULT: case DEFAULT:
usedefault = 1; usedefault = 1;
/* FALL THROUGH */ fallthrough;
case MACH: case MACH:
if (!usedefault) { if (!usedefault) {

View File

@ -524,7 +524,7 @@ literal:
case 'k': /* The hour (24-hour clock representation). */ case 'k': /* The hour (24-hour clock representation). */
LEGAL_ALT(0); LEGAL_ALT(0);
/* FALLTHROUGH */ fallthrough;
case 'H': case 'H':
LEGAL_ALT(ALT_O); LEGAL_ALT(ALT_O);
bp = conv_num(bp, &tm->tm_hour, 0, 23, ALT_DIGITS); bp = conv_num(bp, &tm->tm_hour, 0, 23, ALT_DIGITS);
@ -532,7 +532,7 @@ literal:
case 'l': /* The hour (12-hour clock representation). */ case 'l': /* The hour (12-hour clock representation). */
LEGAL_ALT(0); LEGAL_ALT(0);
/* FALLTHROUGH */ fallthrough;
case 'I': case 'I':
LEGAL_ALT(ALT_O); LEGAL_ALT(ALT_O);
bp = conv_num(bp, &tm->tm_hour, 1, 12, ALT_DIGITS); bp = conv_num(bp, &tm->tm_hour, 1, 12, ALT_DIGITS);

View File

@ -381,27 +381,27 @@ pg_ent::getent (void)
{ {
case rewound: case rewound:
state = from_cache; state = from_cache;
/*FALLTHRU*/ fallthrough;
case from_cache: case from_cache:
if (nss_db_enum_caches () if (nss_db_enum_caches ()
&& (entry = enumerate_caches ())) && (entry = enumerate_caches ()))
return entry; return entry;
state = from_file; state = from_file;
/*FALLTHRU*/ fallthrough;
case from_file: case from_file:
if (from_files if (from_files
&& nss_db_enum_files () && nss_db_enum_files ()
&& (entry = enumerate_file ())) && (entry = enumerate_file ()))
return entry; return entry;
state = from_builtin; state = from_builtin;
/*FALLTHRU*/ fallthrough;
case from_builtin: case from_builtin:
if (from_db if (from_db
&& nss_db_enum_builtin () && nss_db_enum_builtin ()
&& (entry = enumerate_builtin ())) && (entry = enumerate_builtin ()))
return entry; return entry;
state = from_local; state = from_local;
/*FALLTHRU*/ fallthrough;
case from_local: case from_local:
if (from_db if (from_db
&& nss_db_enum_local () && nss_db_enum_local ()
@ -410,7 +410,7 @@ pg_ent::getent (void)
&& (entry = enumerate_local ())) && (entry = enumerate_local ()))
return entry; return entry;
state = from_sam; state = from_sam;
/*FALLTHRU*/ fallthrough;
case from_sam: case from_sam:
if (from_db if (from_db
&& nss_db_enum_local () && nss_db_enum_local ()
@ -422,14 +422,14 @@ pg_ent::getent (void)
&& (entry = enumerate_sam ())) && (entry = enumerate_sam ()))
return entry; return entry;
state = from_ad; state = from_ad;
/*FALLTHRU*/ fallthrough;
case from_ad: case from_ad:
if (cygheap->dom.member_machine () if (cygheap->dom.member_machine ()
&& from_db && from_db
&& (entry = enumerate_ad ())) && (entry = enumerate_ad ()))
return entry; return entry;
state = finished; state = finished;
/*FALLTHRU*/ fallthrough;
case finished: case finished:
break; break;
} }
@ -673,7 +673,7 @@ pw_ent::enumerate_caches ()
} }
cnt = 0; cnt = 0;
max = 1; max = 1;
/*FALLTHRU*/ fallthrough;
case 1: case 1:
if (from_files) if (from_files)
{ {
@ -684,7 +684,7 @@ pw_ent::enumerate_caches ()
} }
cnt = 0; cnt = 0;
max = 2; max = 2;
/*FALLTHRU*/ fallthrough;
default: default:
if (from_db) if (from_db)
{ {

View File

@ -829,7 +829,7 @@ path_conv::check (const char *src, unsigned opt,
opt &= ~PC_SYM_FOLLOW; opt &= ~PC_SYM_FOLLOW;
sym.path_flags |= PATH_RESOLVE_PROCFD; sym.path_flags |= PATH_RESOLVE_PROCFD;
} }
/*FALLTHRU*/ fallthrough;
case virt_symlink: case virt_symlink:
goto is_virtual_symlink; goto is_virtual_symlink;
case virt_pipe: case virt_pipe:
@ -866,7 +866,7 @@ path_conv::check (const char *src, unsigned opt,
| FILE_ATTRIBUTE_DEVICE; | FILE_ATTRIBUTE_DEVICE;
goto out; goto out;
} }
/*FALLTHRU*/ fallthrough;
case virt_chr: case virt_chr:
if (component == 0) if (component == 0)
fileattr = FILE_ATTRIBUTE_DEVICE; fileattr = FILE_ATTRIBUTE_DEVICE;
@ -2021,7 +2021,7 @@ symlink_worker (const char *oldpath, path_conv &win32_newpath, bool isdevice)
} }
/* Otherwise, fall back to default symlink type. */ /* Otherwise, fall back to default symlink type. */
wsym_type = WSYM_sysfile; wsym_type = WSYM_sysfile;
/*FALLTHRU*/ fallthrough;
case WSYM_sysfile: case WSYM_sysfile:
if (win32_newpath.fs_flags () & FILE_SUPPORTS_REPARSE_POINTS) if (win32_newpath.fs_flags () & FILE_SUPPORTS_REPARSE_POINTS)
{ {

View File

@ -221,7 +221,7 @@ restart1:
case WAIT_OBJECT_0 + 2: case WAIT_OBJECT_0 + 2:
if (timer_idx != 2) if (timer_idx != 2)
pthread::static_cancel_self (); pthread::static_cancel_self ();
/*FALLTHRU*/ fallthrough;
case WAIT_OBJECT_0 + 3: case WAIT_OBJECT_0 + 3:
ret = ETIMEDOUT; ret = ETIMEDOUT;
break; break;
@ -249,7 +249,7 @@ restart1:
case WAIT_OBJECT_0 + 2: case WAIT_OBJECT_0 + 2:
if (timer_idx != 2) if (timer_idx != 2)
pthread_testcancel (); pthread_testcancel ();
/*FALLTHRU*/ fallthrough;
case WAIT_OBJECT_0 + 3: case WAIT_OBJECT_0 + 3:
ret = ETIMEDOUT; ret = ETIMEDOUT;
break; break;

View File

@ -58,7 +58,7 @@ quotactl (int cmd, const char *special, int id, caddr_t addr)
set_errno (EINVAL); set_errno (EINVAL);
return -1; return -1;
} }
/*FALLTHRU*/ fallthrough;
case Q_QUOTAOFF: case Q_QUOTAOFF:
case Q_SETINFO: case Q_SETINFO:
access |= FILE_WRITE_DATA; access |= FILE_WRITE_DATA;
@ -68,7 +68,7 @@ quotactl (int cmd, const char *special, int id, caddr_t addr)
break; break;
case Q_SETQUOTA: case Q_SETQUOTA:
access |= FILE_WRITE_DATA; access |= FILE_WRITE_DATA;
/*FALLTHRU*/ fallthrough;
case Q_GETQUOTA: case Q_GETQUOTA:
/* Windows feature: Default limits. Get or set them with id == -1. */ /* Windows feature: Default limits. Get or set them with id == -1. */
if (id != -1) if (id != -1)

View File

@ -445,7 +445,7 @@ p_ere_exp(struct parse *p)
break; break;
case '{': /* okay as ordinary except if digit follows */ case '{': /* okay as ordinary except if digit follows */
(void)REQUIRE(!MORE() || !isdigit((uch)PEEK()), REG_BADRPT); (void)REQUIRE(!MORE() || !isdigit((uch)PEEK()), REG_BADRPT);
/* FALLTHROUGH */ fallthrough;
default: default:
p->next--; p->next--;
wc = WGETNEXT(); wc = WGETNEXT();
@ -656,7 +656,7 @@ p_simp_re(struct parse *p,
break; break;
case '*': case '*':
(void)REQUIRE(starordinary, REG_BADRPT); (void)REQUIRE(starordinary, REG_BADRPT);
/* FALLTHROUGH */ fallthrough;
default: default:
p->next--; p->next--;
wc = WGETNEXT(); wc = WGETNEXT();
@ -1545,7 +1545,7 @@ findmust(struct parse *p, struct re_guts *g)
return; return;
} }
} while (OP(s) != O_QUEST && OP(s) != O_CH); } while (OP(s) != O_QUEST && OP(s) != O_CH);
/* FALLTHROUGH */ fallthrough;
case OBOW: /* things that break a sequence */ case OBOW: /* things that break a sequence */
case OEOW: case OEOW:
case OBOL: case OBOL:

View File

@ -1427,7 +1427,7 @@ __aclcalcmask (aclent_t *aclbufp, int nentries)
case USER: case USER:
case GROUP: case GROUP:
need_mask = true; need_mask = true;
/*FALLTHRU*/ fallthrough;
case GROUP_OBJ: case GROUP_OBJ:
mask |= aclbufp[idx].a_perm; mask |= aclbufp[idx].a_perm;
break; break;

View File

@ -453,7 +453,7 @@ acl_set_tag_type (acl_entry_t entry_d, acl_tag_t tag_type)
case ACL_MASK: case ACL_MASK:
case ACL_OTHER: case ACL_OTHER:
acl->entry[idx].a_id = ACL_UNDEFINED_ID; acl->entry[idx].a_id = ACL_UNDEFINED_ID;
/*FALLTHRU*/ fallthrough;
case ACL_USER: case ACL_USER:
case ACL_GROUP: case ACL_GROUP:
acl->entry[idx].a_type = tag_type; acl->entry[idx].a_type = tag_type;

View File

@ -469,7 +469,7 @@ was_timeout:
pthread::static_cancel_self (); pthread::static_cancel_self ();
/*NOTREACHED*/ /*NOTREACHED*/
} }
/*FALLTHRU*/ fallthrough;
default: default:
/* Timer event? */ /* Timer event? */
if (wait_ret == timer_idx) if (wait_ret == timer_idx)
@ -1679,7 +1679,7 @@ thread_socket (void *arg)
case WAIT_OBJECT_0: case WAIT_OBJECT_0:
if (!i) /* Socket event set. */ if (!i) /* Socket event set. */
goto out; goto out;
/*FALLTHRU*/ fallthrough;
default: default:
break; break;
} }

View File

@ -205,7 +205,7 @@ proc_subproc (DWORD what, uintptr_t val)
set_errno (EAGAIN); set_errno (EAGAIN);
break; break;
} }
/* fall through intentionally */ fallthrough;
case PROC_DETACHED_CHILD: case PROC_DETACHED_CHILD:
if (vchild != myself) if (vchild != myself)
@ -1078,7 +1078,7 @@ child_info::proc_retry (HANDLE h)
case STATUS_CONTROL_C_EXIT: case STATUS_CONTROL_C_EXIT:
if (saw_ctrl_c ()) if (saw_ctrl_c ())
return EXITCODE_OK; return EXITCODE_OK;
/* fall through intentionally */ fallthrough;
case STATUS_DLL_INIT_FAILED: case STATUS_DLL_INIT_FAILED:
case STATUS_DLL_INIT_FAILED_LOGOFF: case STATUS_DLL_INIT_FAILED_LOGOFF:
case EXITCODE_RETRY: case EXITCODE_RETRY:
@ -1387,10 +1387,10 @@ wait_sig (VOID *)
sig_clear (-pack.si.si_signo); sig_clear (-pack.si.si_signo);
else else
sigq.add (pack); sigq.add (pack);
/*FALLTHRU*/ fallthrough;
case __SIGNOHOLD: case __SIGNOHOLD:
sig_held = false; sig_held = false;
/*FALLTHRU*/ fallthrough;
case __SIGFLUSH: case __SIGFLUSH:
case __SIGFLUSHFAST: case __SIGFLUSHFAST:
if (!sig_held) if (!sig_held)

View File

@ -180,7 +180,7 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap)
pad = '0'; pad = '0';
continue; continue;
} }
/*FALLTHRU*/ fallthrough;
case '1' ... '9': case '1' ... '9':
len = len * 10 + (c - '0'); len = len * 10 + (c - '0');
continue; continue;
@ -254,7 +254,7 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap)
case 'y': case 'y':
*dst++ = '0'; *dst++ = '0';
*dst++ = 'x'; *dst++ = 'x';
/*FALLTHRU*/ fallthrough;
case 'x': case 'x':
base = 16; base = 16;
addsign = 0; addsign = 0;
@ -279,7 +279,7 @@ gen_decimal:
case 'Y': case 'Y':
*dst++ = '0'; *dst++ = '0';
*dst++ = 'x'; *dst++ = 'x';
/*FALLTHRU*/ fallthrough;
case 'X': case 'X':
base = 16; base = 16;
addsign = 0; addsign = 0;
@ -299,7 +299,7 @@ gen_decimalLL:
n = strtol (fmt, (char **) &fmt, 10); n = strtol (fmt, (char **) &fmt, 10);
if (*fmt++ != 's') if (*fmt++ != 's')
goto endfor; goto endfor;
/*FALLTHRU*/ fallthrough;
case 's': case 's':
s = va_arg (ap, char *); s = va_arg (ap, char *);
if (s == NULL) if (s == NULL)
@ -540,7 +540,7 @@ __small_vswprintf (PWCHAR dst, const WCHAR *fmt, va_list ap)
pad = L'0'; pad = L'0';
continue; continue;
} }
/*FALLTHRU*/ fallthrough;
case L'1' ... L'9': case L'1' ... L'9':
len = len * 10 + (c - L'0'); len = len * 10 + (c - L'0');
continue; continue;
@ -597,7 +597,7 @@ __small_vswprintf (PWCHAR dst, const WCHAR *fmt, va_list ap)
case 'y': case 'y':
*dst++ = '0'; *dst++ = '0';
*dst++ = 'x'; *dst++ = 'x';
/*FALLTHRU*/ fallthrough;
case 'x': case 'x':
base = 16; base = 16;
addsign = 0; addsign = 0;
@ -622,7 +622,7 @@ gen_decimal:
case 'Y': case 'Y':
*dst++ = '0'; *dst++ = '0';
*dst++ = 'x'; *dst++ = 'x';
/*FALLTHRU*/ fallthrough;
case 'X': case 'X':
base = 16; base = 16;
addsign = 0; addsign = 0;
@ -645,7 +645,7 @@ gen_decimalLL:
n = wcstoul (fmt, (wchar_t **) &fmt, 10); n = wcstoul (fmt, (wchar_t **) &fmt, 10);
if (*fmt++ != L's') if (*fmt++ != L's')
goto endfor; goto endfor;
/*FALLTHRU*/ fallthrough;
case L's': case L's':
s = va_arg (ap, char *); s = va_arg (ap, char *);
if (s == NULL) if (s == NULL)

View File

@ -147,7 +147,7 @@ tcsetattr (int fd, int a, const struct termios *t)
if (_my_tls.call_signal_handler ()) if (_my_tls.call_signal_handler ())
continue; continue;
res = -1; res = -1;
/* fall through intentionally */ fallthrough;
default: default:
e = get_errno (); e = get_errno ();
break; break;

View File

@ -1743,7 +1743,7 @@ pwdgrp::fetch_account_from_file (fetch_user_arg_t &arg)
/* Override SID with SID string. */ /* Override SID with SID string. */
arg.sid->string (str); arg.sid->string (str);
arg.name = str; arg.name = str;
/*FALLTHRU*/ fallthrough;
case NAME_arg: case NAME_arg:
arg.len = strlen (arg.name); arg.len = strlen (arg.name);
break; break;
@ -2300,7 +2300,7 @@ pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, cyg_ldap *pldap)
if (!its_ok) if (!its_ok)
return NULL; return NULL;
} }
/*FALLTHRU*/ fallthrough;
case SidTypeGroup: case SidTypeGroup:
case SidTypeAlias: case SidTypeAlias:
/* Predefined alias? */ /* Predefined alias? */

View File

@ -20,6 +20,8 @@ details. */
#define EXPORT_ALIAS(sym,symalias) __typeof (sym) symalias __attribute__ ((alias(#sym))); #define EXPORT_ALIAS(sym,symalias) __typeof (sym) symalias __attribute__ ((alias(#sym)));
#endif #endif
#define fallthrough __attribute__((__fallthrough__))
#define _WIN32_WINNT 0x0a00 #define _WIN32_WINNT 0x0a00
#define WINVER 0x0a00 #define WINVER 0x0a00