diff --git a/config.h.in b/config.h.in index 79bf3e9a2..1168b38db 100644 --- a/config.h.in +++ b/config.h.in @@ -258,6 +258,9 @@ /* Define to 1 if you have the `faccessat' function. */ #undef HAVE_FACCESSAT +/* Define to 1 if the compiler supports the fallthrough attribute. */ +#undef HAVE_FALLTHROUGH_ATTRIBUTE + /* Define to 1 if you have the `fchmodat' function. */ #undef HAVE_FCHMODAT @@ -1038,8 +1041,8 @@ /* Define to 1 if you want sudo to free up memory before exiting. */ #undef NO_LEAKS -/* Define to 1 if you don't want users to get the lecture the first time they use - sudo. */ +/* Define to 1 if you don't want users to get the lecture the first time they + use sudo. */ #undef NO_LECTURE /* Define to 1 if you don't want to use sudo's PAM session support. */ diff --git a/configure b/configure index 2ef7f19a1..697d56f6a 100755 --- a/configure +++ b/configure @@ -27860,43 +27860,48 @@ _ACEOF if test -n "$GCC"; then if test X"$enable_warnings" = X"yes" -o X"$with_devel" = X"yes"; then - CFLAGS="${CFLAGS} -Wall -Wsign-compare -Wpointer-arith" - _CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -Wimplicit-fallthrough -Werror" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler acceptd -Wimplicit-fallthrough" >&5 -$as_echo_n "checking whether C compiler acceptd -Wimplicit-fallthrough... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + CFLAGS="${CFLAGS} -Wall -Wsign-compare -Wpointer-arith" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports the fallthrough attribute" >&5 +$as_echo_n "checking whether $CC supports the fallthrough attribute... " >&6; } +if ${sudo_cv_var_fallthrough_attribute+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - int main(int argc, char *argv[]) - { - int num = argc + 1; - switch (num) { - case 1: - num = 0; - /* FALLTHROUGH */ - case 0: - num++; + int main(int argc, char *argv[]) + { + int num = argc + 1; + switch (num) { + case 1: + num = 0; + __attribute__((__fallthrough__)); + case 0: + num++; + } + return num; } - return num; - } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - CFLAGS="$_CFLAGS -Wimplicit-fallthrough" + sudo_cv_var_fallthrough_attribute=yes else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - CFLAGS="$_CFLAGS" + sudo_cv_var_fallthrough_attribute=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_var_fallthrough_attribute" >&5 +$as_echo "$sudo_cv_var_fallthrough_attribute" >&6; } + if test X"$sudo_cv_var_fallthrough_attribute" = X"yes"; then + $as_echo "#define HAVE_FALLTHROUGH_ATTRIBUTE 1" >>confdefs.h + + CFLAGS="$CFLAGS -Wimplicit-fallthrough" + fi fi if test X"$enable_werror" = X"yes"; then CFLAGS="${CFLAGS} -Werror" @@ -30315,5 +30320,6 @@ fi + diff --git a/configure.ac b/configure.ac index befc3271f..098b61b02 100644 --- a/configure.ac +++ b/configure.ac @@ -4591,36 +4591,41 @@ dnl We add -Wall and -Werror after all tests so they don't cause failures dnl if test -n "$GCC"; then if test X"$enable_warnings" = X"yes" -o X"$with_devel" = X"yes"; then + dnl + dnl Default warnings for development use. + dnl CFLAGS="${CFLAGS} -Wall -Wsign-compare -Wpointer-arith" dnl - dnl Check whether -Wimplicit-fallthrough is available and - dnl recognizes /* FALLTHROUGH */ comments. Clang 10 requires - dnl the "fallthrough" attribute which we don't use. + dnl The fallthrough attribute is supported by gcc 7.0 and clang 10. + dnl This test relies on AC_LANG_WERROR. dnl - _CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -Wimplicit-fallthrough -Werror" - AC_MSG_CHECKING([whether C compiler acceptd -Wimplicit-fallthrough]) - AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ - int main(int argc, char *argv[]) - { - int num = argc + 1; - switch (num) { - case 1: - num = 0; - /* FALLTHROUGH */ - case 0: - num++; + AC_CACHE_CHECK([whether $CC supports the fallthrough attribute], + [sudo_cv_var_fallthrough_attribute], + [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ + int main(int argc, char *argv[]) + { + int num = argc + 1; + switch (num) { + case 1: + num = 0; + __attribute__((__fallthrough__)); + case 0: + num++; + } + return num; } - return num; - } - ]])], [ - AC_MSG_RESULT([yes]) - CFLAGS="$_CFLAGS -Wimplicit-fallthrough" - ], [ - AC_MSG_RESULT([no]) - CFLAGS="$_CFLAGS" - ]) - + ]])], + [ + sudo_cv_var_fallthrough_attribute=yes + ], + [ + sudo_cv_var_fallthrough_attribute=no] + )] + ) + if test X"$sudo_cv_var_fallthrough_attribute" = X"yes"; then + AC_DEFINE(HAVE_FALLTHROUGH_ATTRIBUTE) + CFLAGS="$CFLAGS -Wimplicit-fallthrough" + fi fi if test X"$enable_werror" = X"yes"; then CFLAGS="${CFLAGS} -Werror" @@ -4891,6 +4896,7 @@ AH_TEMPLATE(HAVE_OPENSSL, [Define to 1 if you are using OpenSSL's TLS and sha2 f AH_TEMPLATE(HAVE_GCRYPT, [Define to 1 if you are using gcrypt's sha2 functions.]) AH_TEMPLATE(HAVE_SSL_CTX_SET_MIN_PROTO_VERSION, [Define to 1 if you have the `SSL_CTX_set_min_proto_version' function or macro.]) AH_TEMPLATE(SUDOERS_IOLOG_CLIENT, [Define to 1 to compile support for sudo_logsrvd in the sudoers I/O log plugin.]) +AH_TEMPLATE(HAVE_FALLTHROUGH_ATTRIBUTE, [Define to 1 if the compiler supports the fallthrough attribute.]) dnl dnl Bits to copy verbatim into config.h.in diff --git a/include/sudo_compat.h b/include/sudo_compat.h index 80c007b93..879a0f3ff 100644 --- a/include/sudo_compat.h +++ b/include/sudo_compat.h @@ -80,6 +80,12 @@ # endif #endif +#ifdef HAVE_FALLTHROUGH_ATTRIBUTE +# define FALLTHROUGH __attribute__((__fallthrough__)) +#else +# define FALLTHROUGH do { } while (0) +#endif + /* * Given the pointer x to the member m of the struct s, return * a pointer to the containing structure. diff --git a/lib/util/arc4random_buf.c b/lib/util/arc4random_buf.c index ee4c608ef..76f0fdc02 100644 --- a/lib/util/arc4random_buf.c +++ b/lib/util/arc4random_buf.c @@ -50,13 +50,13 @@ sudo_arc4random_buf(void *buf, size_t n) switch (m) { case 4: *cp++ = (val >> 24) & 0xff; - /* FALLTHROUGH */ + FALLTHROUGH; case 3: *cp++ = (val >> 16) & 0xff; - /* FALLTHROUGH */ + FALLTHROUGH; case 2: *cp++ = (val >> 8) & 0xff; - /* FALLTHROUGH */ + FALLTHROUGH; case 1: *cp++ = val & 0xff; break; diff --git a/lib/util/glob.c b/lib/util/glob.c index 58af3d383..762e107be 100644 --- a/lib/util/glob.c +++ b/lib/util/glob.c @@ -304,7 +304,7 @@ globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, i--; break; } - /* FALLTHROUGH */ + FALLTHROUGH; case COMMA: if (i && *pm == COMMA) break; diff --git a/lib/util/snprintf.c b/lib/util/snprintf.c index 3874b15a9..6d027ad72 100644 --- a/lib/util/snprintf.c +++ b/lib/util/snprintf.c @@ -535,7 +535,7 @@ reswitch: switch (ch) { if (width == INT_MIN) goto overflow; width = -width; - /* FALLTHROUGH */ + FALLTHROUGH; case '-': flags |= LADJUST; goto rflag; @@ -649,7 +649,7 @@ reswitch: switch (ch) { break; case 'D': flags |= LONGINT; - /*FALLTHROUGH*/ + FALLTHROUGH; case 'd': case 'i': _umax = SARG(); @@ -815,7 +815,7 @@ fp_common: #endif /* NO_PRINTF_PERCENT_N */ case 'O': flags |= LONGINT; - /*FALLTHROUGH*/ + FALLTHROUGH; case 'o': _umax = UARG(); base = OCT; @@ -875,7 +875,7 @@ fp_common: break; case 'U': flags |= LONGINT; - /*FALLTHROUGH*/ + FALLTHROUGH; case 'u': _umax = UARG(); base = DEC; @@ -1276,7 +1276,7 @@ reswitch: switch (ch) { break; case 'D': flags |= LONGINT; - /*FALLTHROUGH*/ + FALLTHROUGH; case 'd': case 'i': ADDSARG(); @@ -1316,7 +1316,7 @@ reswitch: switch (ch) { #endif /* NO_PRINTF_PERCENT_N */ case 'O': flags |= LONGINT; - /*FALLTHROUGH*/ + FALLTHROUGH; case 'o': ADDUARG(); break; @@ -1333,7 +1333,7 @@ reswitch: switch (ch) { break; case 'U': flags |= LONGINT; - /*FALLTHROUGH*/ + FALLTHROUGH; case 'u': case 'X': case 'x': diff --git a/lib/util/strtonum.c b/lib/util/strtonum.c index a76d28bea..d0ce1adb1 100644 --- a/lib/util/strtonum.c +++ b/lib/util/strtonum.c @@ -69,7 +69,7 @@ sudo_strtonumx(const char *str, long long minval, long long maxval, char **endp, break; case '+': ch = *cp++; - /* FALLTHROUGH */ + FALLTHROUGH; default: sign = '+'; break; diff --git a/logsrvd/sendlog.c b/logsrvd/sendlog.c index 80bf55e67..9a0aad8a8 100644 --- a/logsrvd/sendlog.c +++ b/logsrvd/sendlog.c @@ -866,10 +866,10 @@ client_message_completion(struct client_closure *closure) closure->state = SEND_EXIT; debug_return_bool(fmt_exit_message(closure)); } - /* FALLTHROUGH */ + FALLTHROUGH; case SEND_RESTART: closure->state = SEND_IO; - /* FALLTHROUGH */ + FALLTHROUGH; case SEND_IO: /* fmt_next_iolog() will advance state on EOF. */ if (!fmt_next_iolog(closure)) diff --git a/plugins/python/pyhelpers.c b/plugins/python/pyhelpers.c index d43c7348b..d20e459cf 100644 --- a/plugins/python/pyhelpers.c +++ b/plugins/python/pyhelpers.c @@ -43,7 +43,7 @@ _sudo_printf_default(int msg_type, const char *fmt, ...) switch (msg_type & 0xff) { case SUDO_CONV_ERROR_MSG: fp = stderr; - /* FALLTHROUGH */ + FALLTHROUGH; case SUDO_CONV_INFO_MSG: va_start(ap, fmt); len = vfprintf(ttyfp ? ttyfp : fp, fmt, ap); diff --git a/plugins/sudoers/auth/pam.c b/plugins/sudoers/auth/pam.c index dee9ea262..6b4e24970 100644 --- a/plugins/sudoers/auth/pam.c +++ b/plugins/sudoers/auth/pam.c @@ -681,7 +681,7 @@ converse(int num_msg, PAM_CONST struct pam_message **msg, switch (pm->msg_style) { case PAM_PROMPT_ECHO_ON: type = SUDO_CONV_PROMPT_ECHO_ON; - /* FALLTHROUGH */ + FALLTHROUGH; case PAM_PROMPT_ECHO_OFF: /* Error out if the last password read was interrupted. */ if (getpass_error) diff --git a/plugins/sudoers/check.c b/plugins/sudoers/check.c index 915b0d9f1..181b5ed43 100644 --- a/plugins/sudoers/check.c +++ b/plugins/sudoers/check.c @@ -121,7 +121,7 @@ check_user_interactive(int validated, int mode, struct getpass_closure *closure) } sudo_debug_printf(SUDO_DEBUG_INFO, "%s: check user flag overrides time stamp", __func__); - /* FALLTHROUGH */ + FALLTHROUGH; default: /* Bail out if we are non-interactive and a password is required */ diff --git a/plugins/sudoers/cvtsudoers_ldif.c b/plugins/sudoers/cvtsudoers_ldif.c index f85d7d096..f61f5ff7b 100644 --- a/plugins/sudoers/cvtsudoers_ldif.c +++ b/plugins/sudoers/cvtsudoers_ldif.c @@ -277,7 +277,7 @@ print_member_ldif(FILE *fp, struct sudoers_parse_tree *parse_tree, char *name, print_attribute_ldif(fp, attr_name, negated ? "!ALL" : "ALL"); break; } - /* FALLTHROUGH */ + FALLTHROUGH; case COMMAND: attr_val = format_cmnd((struct sudo_command *)name, negated); print_attribute_ldif(fp, attr_name, attr_val); @@ -292,7 +292,7 @@ print_member_ldif(FILE *fp, struct sudoers_parse_tree *parse_tree, char *name, alias_put(a); break; } - /* FALLTHROUGH */ + FALLTHROUGH; default: len = asprintf(&attr_val, "%s%s", negated ? "!" : "", name); if (len == -1) { diff --git a/plugins/sudoers/defaults.c b/plugins/sudoers/defaults.c index 1a4e2b6b3..64f17bb5a 100644 --- a/plugins/sudoers/defaults.c +++ b/plugins/sudoers/defaults.c @@ -218,7 +218,7 @@ parse_default_entry(struct sudo_defs_types *def, const char *val, int op, case T_TUPLE: if (ISSET(def->type, T_BOOL)) break; - /* FALLTHROUGH */ + FALLTHROUGH; case T_LOGFAC: if (op == true) { /* Use default syslog facility if none specified. */ diff --git a/plugins/sudoers/fmtsudoers.c b/plugins/sudoers/fmtsudoers.c index 0c935093e..4588dfb03 100644 --- a/plugins/sudoers/fmtsudoers.c +++ b/plugins/sudoers/fmtsudoers.c @@ -58,7 +58,7 @@ sudoers_format_member_int(struct sudo_lbuf *lbuf, sudo_lbuf_append(lbuf, "%sALL", negated ? "!" : ""); break; } - /* FALLTHROUGH */ + FALLTHROUGH; case COMMAND: c = (struct sudo_command *) name; TAILQ_FOREACH(digest, &c->digests, entries) { @@ -100,7 +100,7 @@ sudoers_format_member_int(struct sudo_lbuf *lbuf, break; } } - /* FALLTHROUGH */ + FALLTHROUGH; default: print_word: /* Do not quote UID/GID, all others get quoted. */ diff --git a/plugins/sudoers/ldap_util.c b/plugins/sudoers/ldap_util.c index e0df321c3..476caf73c 100644 --- a/plugins/sudoers/ldap_util.c +++ b/plugins/sudoers/ldap_util.c @@ -152,7 +152,7 @@ array_to_member_list(void *a, sudo_ldap_iter_t iter) m->type = ALL; break; } - /* FALLTHROUGH */ + FALLTHROUGH; default: m->type = WORD; break; @@ -222,7 +222,7 @@ host_to_member(char *host) m->type = ALL; break; } - /* FALLTHROUGH */ + FALLTHROUGH; default: if (is_address(host)) { m->type = NTWKADDR; diff --git a/plugins/sudoers/match.c b/plugins/sudoers/match.c index 905154525..70d6b3e64 100644 --- a/plugins/sudoers/match.c +++ b/plugins/sudoers/match.c @@ -98,7 +98,7 @@ user_matches(struct sudoers_parse_tree *parse_tree, const struct passwd *pw, alias_put(a); break; } - /* FALLTHROUGH */ + FALLTHROUGH; case WORD: if (userpw_matches(m->name, pw->pw_name, pw)) matched = !m->negated; @@ -195,7 +195,7 @@ runaslist_matches(struct sudoers_parse_tree *parse_tree, alias_put(a); break; } - /* FALLTHROUGH */ + FALLTHROUGH; case WORD: if (userpw_matches(m->name, runas_pw->pw_name, runas_pw)) user_matched = !m->negated; @@ -239,7 +239,7 @@ runaslist_matches(struct sudoers_parse_tree *parse_tree, alias_put(a); break; } - /* FALLTHROUGH */ + FALLTHROUGH; case WORD: if (group_matches(m->name, runas_gr)) group_matched = !m->negated; @@ -352,7 +352,7 @@ host_matches(struct sudoers_parse_tree *parse_tree, const struct passwd *pw, alias_put(a); break; } - /* FALLTHROUGH */ + FALLTHROUGH; case WORD: if (hostname_matches(shost, lhost, m->name)) matched = !m->negated; @@ -399,7 +399,7 @@ cmnd_matches(struct sudoers_parse_tree *parse_tree, const struct member *m) matched = !m->negated; break; } - /* FALLTHROUGH */ + FALLTHROUGH; case COMMAND: c = (struct sudo_command *)m->name; if (command_matches(c->cmnd, c->args, &c->digests)) diff --git a/plugins/sudoers/parse_ldif.c b/plugins/sudoers/parse_ldif.c index 0bc919c09..ef0c298a6 100644 --- a/plugins/sudoers/parse_ldif.c +++ b/plugins/sudoers/parse_ldif.c @@ -368,7 +368,7 @@ role_to_sudoers(struct sudoers_parse_tree *parse_tree, struct sudo_role *role, m->type = ALL; break; } - /* FALLTHROUGH */ + FALLTHROUGH; default: m->type = WORD; break; diff --git a/plugins/sudoers/sssd.c b/plugins/sudoers/sssd.c index b52fec3fa..4ab55c841 100644 --- a/plugins/sudoers/sssd.c +++ b/plugins/sudoers/sssd.c @@ -514,7 +514,7 @@ sudo_sss_result_get(struct sudo_nss *nss, struct passwd *pw) break; case ENOMEM: sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory")); - /* FALLTHROUGH */ + FALLTHROUGH; default: sudo_debug_printf(SUDO_DEBUG_ERROR, "handle->fn_send_recv: rc=%d", rc); debug_return_ptr(NULL); @@ -753,7 +753,7 @@ sudo_sss_getdefs(struct sudo_nss *nss) break; case ENOMEM: sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory")); - /* FALLTHROUGH */ + FALLTHROUGH; default: sudo_debug_printf(SUDO_DEBUG_ERROR, "handle->fn_send_recv_defaults: rc=%d, sss_error=%u", rc, sss_error); diff --git a/plugins/sudoers/sudo_printf.c b/plugins/sudoers/sudo_printf.c index 944280b12..5f0716245 100644 --- a/plugins/sudoers/sudo_printf.c +++ b/plugins/sudoers/sudo_printf.c @@ -48,7 +48,7 @@ sudo_printf_int(int msg_type, const char *fmt, ...) switch (msg_type & 0xff) { case SUDO_CONV_ERROR_MSG: fp = stderr; - /* FALLTHROUGH */ + FALLTHROUGH; case SUDO_CONV_INFO_MSG: va_start(ap, fmt); len = vfprintf(ttyfp ? ttyfp : fp, fmt, ap); diff --git a/plugins/sudoers/sudoreplay.c b/plugins/sudoers/sudoreplay.c index 54a298b2a..762a41699 100644 --- a/plugins/sudoers/sudoreplay.c +++ b/plugins/sudoers/sudoreplay.c @@ -448,7 +448,7 @@ getsize_cb(int fd, int what, void *v) case -1: if (errno == EAGAIN) goto another; - /* FALLTHROUGH */ + FALLTHROUGH; case 0: goto done; default: @@ -487,7 +487,7 @@ getsize_cb(int fd, int what, void *v) goto done; gc->nums[gc->nums_depth] = 0; gc->state = NUMBER; - /* FALLTHROUGH */ + FALLTHROUGH; case NUMBER: if (!isdigit(ch)) { /* done with number, reparse ch */ diff --git a/plugins/sudoers/timestamp.c b/plugins/sudoers/timestamp.c index 368edebd4..d25df689d 100644 --- a/plugins/sudoers/timestamp.c +++ b/plugins/sudoers/timestamp.c @@ -367,7 +367,7 @@ ts_init_key(struct timestamp_entry *entry, struct passwd *pw, int flags, default: /* Unknown time stamp ticket type, treat as tty (should not happen). */ sudo_warnx("unknown time stamp ticket type %d", ticket_type); - /* FALLTHROUGH */ + FALLTHROUGH; case tty: if (user_ttypath != NULL && stat(user_ttypath, &sb) == 0) { /* tty-based time stamp */ @@ -377,7 +377,7 @@ ts_init_key(struct timestamp_entry *entry, struct passwd *pw, int flags, get_starttime(entry->sid, &entry->start_time); break; } - /* FALLTHROUGH */ + FALLTHROUGH; case kernel: case ppid: /* ppid-based time stamp */ diff --git a/plugins/sudoers/visudo.c b/plugins/sudoers/visudo.c index d319f8bd4..e019bab80 100644 --- a/plugins/sudoers/visudo.c +++ b/plugins/sudoers/visudo.c @@ -811,7 +811,7 @@ whatnow(void) switch (choice) { case EOF: choice = 'x'; - /* FALLTHROUGH */ + FALLTHROUGH; case 'e': case 'x': case 'Q': diff --git a/src/conversation.c b/src/conversation.c index 389c7842a..55c2319c6 100644 --- a/src/conversation.c +++ b/src/conversation.c @@ -64,7 +64,7 @@ sudo_conversation(int num_msgs, const struct sudo_conv_message msgs[], goto read_pass; case SUDO_CONV_PROMPT_MASK: SET(flags, TGP_MASK); - /* FALLTHROUGH */ + FALLTHROUGH; case SUDO_CONV_PROMPT_ECHO_OFF: if (ISSET(msg->msg_type, SUDO_CONV_PROMPT_ECHO_OK)) SET(flags, TGP_NOECHO_TRY); @@ -84,7 +84,7 @@ sudo_conversation(int num_msgs, const struct sudo_conv_message msgs[], break; case SUDO_CONV_ERROR_MSG: fp = stderr; - /* FALLTHROUGH */ + FALLTHROUGH; case SUDO_CONV_INFO_MSG: if (msg->msg != NULL) { size_t len = strlen(msg->msg); @@ -172,7 +172,7 @@ sudo_conversation_printf(int msg_type, const char *fmt, ...) switch (msg_type & 0xff) { case SUDO_CONV_ERROR_MSG: fp = stderr; - /* FALLTHROUGH */ + FALLTHROUGH; case SUDO_CONV_INFO_MSG: va_start(ap, fmt); len = vfprintf(ttyfp ? ttyfp : fp, fmt, ap); diff --git a/src/exec_monitor.c b/src/exec_monitor.c index b781fa858..3c6d10240 100644 --- a/src/exec_monitor.c +++ b/src/exec_monitor.c @@ -201,7 +201,7 @@ mon_handle_sigchld(struct monitor_closure *mc) switch (pid) { case 0: errno = ECHILD; - /* FALLTHROUGH */ + FALLTHROUGH; case -1: sudo_warn(U_("%s: %s"), __func__, "waitpid"); debug_return; diff --git a/src/exec_pty.c b/src/exec_pty.c index 97a283c58..1b0863938 100644 --- a/src/exec_pty.c +++ b/src/exec_pty.c @@ -542,7 +542,7 @@ suspend_sudo(struct exec_closure_pty *ec, int signo) ret = SIGCONT_FG; /* resume command in foreground */ break; } - /* FALLTHROUGH */ + FALLTHROUGH; case SIGSTOP: case SIGTSTP: /* Flush any remaining output and deschedule I/O events. */ @@ -663,7 +663,7 @@ read_callback(int fd, int what, void *v) /* treat read error as fatal and close the fd */ sudo_debug_printf(SUDO_DEBUG_ERROR, "error reading fd %d: %s", fd, strerror(errno)); - /* FALLTHROUGH */ + FALLTHROUGH; case 0: /* got EOF or pty has gone away */ if (n == 0) { @@ -763,7 +763,7 @@ write_callback(int fd, int what, void *v) /* Schedule SIGTTOU to be forwarded to the command. */ schedule_signal(iob->ec, SIGTTOU); } - /* FALLTHROUGH */ + FALLTHROUGH; case EAGAIN: /* not an error */ break; @@ -1041,7 +1041,7 @@ handle_sigchld_pty(struct exec_closure_pty *ec) switch (pid) { case 0: errno = ECHILD; - /* FALLTHROUGH */ + FALLTHROUGH; case -1: sudo_warn(U_("%s: %s"), __func__, "waitpid"); debug_return; diff --git a/src/parse_args.c b/src/parse_args.c index f5853b8d8..d37a2839e 100644 --- a/src/parse_args.c +++ b/src/parse_args.c @@ -389,7 +389,7 @@ parse_args(int argc, char **argv, int *old_optind, int *nargc, char ***nargv, valid_flags = 0; break; } - /* FALLTHROUGH */ + FALLTHROUGH; case OPT_HOSTNAME: assert(optarg != NULL); if (*optarg == '\0') diff --git a/src/regress/noexec/check_noexec.c b/src/regress/noexec/check_noexec.c index 82b072e35..db51a74f9 100644 --- a/src/regress/noexec/check_noexec.c +++ b/src/regress/noexec/check_noexec.c @@ -161,7 +161,7 @@ try_wordexp(void) break; } wordfree(&we); - /* FALLTHROUGH */ + FALLTHROUGH; default: printf("%s: FAIL (wordexp) [%d]\n", getprogname(), rc); break; diff --git a/src/tgetpass.c b/src/tgetpass.c index 6f6a2732d..ad5c94d60 100644 --- a/src/tgetpass.c +++ b/src/tgetpass.c @@ -435,7 +435,7 @@ getln(int fd, char *buf, size_t bufsiz, bool feedback, *errval = TGP_ERRVAL_NOPASSWORD; debug_return_str(NULL); } - /* FALLTHROUGH */ + FALLTHROUGH; default: debug_return_str_masked(buf); }