Get rid of gcc 7 "fall through" warnings

With gcc 7 we get warnings like the following:

 fdasd.c: In function 'main':
 fdasd.c:3055:4: warning: this statement may fall through
                          [-Wimplicit-fallthrough=]
     fdasd_exit(&anchor, 0);
     ^~~~~~~~~~~~~~~~~~~~~~
 fdasd.c:3056:3: note: here
    default:
    ^~~~~~~

Fix this by marking functions with "__noreturn" to help gcc.

Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
This commit is contained in:
Michael Holzheu
2017-09-05 15:52:54 +02:00
parent 6c3c721275
commit 221e74c27c
12 changed files with 21 additions and 19 deletions

View File

@@ -308,7 +308,7 @@ static void fdasd_cleanup(fdasd_anchor_t *anchor)
/*
* Exit fdasd.
*/
static void fdasd_exit(fdasd_anchor_t *anchor, int rc)
static void __noreturn fdasd_exit(fdasd_anchor_t *anchor, int rc)
{
fdasd_cleanup(anchor);
exit(rc);

View File

@@ -348,7 +348,7 @@ void hyptop_text_mode(void)
/*
* Exit hyptop
*/
void hyptop_exit(int rc)
void __noreturn hyptop_exit(int rc)
{
hyptop_text_mode();
exit(rc);

View File

@@ -216,7 +216,7 @@ extern void win_cpu_types_init(void);
* Misc functions
*/
extern void hyptop_update_term(void);
extern void hyptop_exit(int rc);
extern void __noreturn hyptop_exit(int rc);
extern void hyptop_text_mode(void);
#endif /* HYPTOP_H */

View File

@@ -97,7 +97,7 @@ static struct locals {
enum reipl_type reipl_type; /* CCW, FCP, NSS */
} l;
static void print_usage_chreipl_exit(void)
static void __noreturn print_usage_chreipl_exit(void)
{
printf(usage_chreipl, g.prog_name);
exit(0);

View File

@@ -34,7 +34,7 @@ static const char *const usage_chshut =
" -h, --help Print this help, then exit\n"
" -v, --version Print version information, then exit\n";
static void print_usage_chshut_exit(void)
static void __noreturn print_usage_chshut_exit(void)
{
printf(usage_chshut, g.prog_name);
exit(0);

View File

@@ -25,7 +25,7 @@ static const char *const usage_lsreipl =
" -h, --help Print this help, then exit\n"
" -v, --version Print version information, then exit\n";
static void print_usage_lsreipl_exit(void)
static void __noreturn print_usage_lsreipl_exit(void)
{
printf(usage_lsreipl, g.prog_name);
exit(0);

View File

@@ -20,7 +20,7 @@ static const char *const usage_lsshut =
" -h, --help Print this help, then exit\n"
" -v, --version Print version information, then exit\n";
static void print_usage_lsshut_exit(void)
static __noreturn void print_usage_lsshut_exit(void)
{
printf(usage_lsshut, g.prog_name);
exit(0);

View File

@@ -24,6 +24,8 @@
#include <sys/types.h>
#include <unistd.h>
#include <lib/zt_common.h>
#define IPL_TYPE_LEN_MAX 100
#define NSS_NAME_LEN_MAX 8
@@ -57,8 +59,8 @@ extern void read_str(char *string, const char *file, size_t len);
extern void read_fw_str(char *string, const char *file, size_t len);
extern void print_fw_str(const char *fmt, const char *dir, const char *file);
extern void print_version_exit(void);
extern void print_help_hint_exit(void);
extern void __noreturn print_version_exit(void);
extern void __noreturn print_help_hint_exit(void);
/*
* FCP

View File

@@ -14,14 +14,14 @@
struct globals g;
void print_help_hint_exit(void)
void __noreturn print_help_hint_exit(void)
{
fprintf(stderr, "Try '%s' --help' for more information.\n",
g.prog_name);
exit(1);
}
void print_version_exit(void)
void __noreturn print_version_exit(void)
{
printf("%s: Linux on System z shutdown actions version %s\n",
g.prog_name, RELEASE_STRING);

View File

@@ -71,8 +71,8 @@ static const struct tool_info iucv_tool[2] = {
};
static void usage_exit(const struct tool_info *prg, int is_error,
const char *msg)
static void __noreturn usage_exit(const struct tool_info *prg, int is_error,
const char *msg)
{
if (msg != NULL)
fprintf(stderr, _("%s: %s\n"), prg->name, msg);
@@ -80,7 +80,7 @@ static void usage_exit(const struct tool_info *prg, int is_error,
exit(is_error ? 1 : 0); /* rc=1 .. invalid args */
}
static void version_exit(const struct tool_info *prg)
static void __noreturn version_exit(const struct tool_info *prg)
{
printf(_("%s: IUCV Terminal Applications, version %s\n"),
prg->name, RELEASE_STRING);

View File

@@ -62,13 +62,13 @@ static const char usage[] =
"-h, --help Displays this help, then exits.\n"
"-v, --version Displays version information, then exits.\n";
static void help_exit(const char *prg)
static void __noreturn help_exit(const char *prg)
{
printf(usage, prg, prg);
exit(EXIT_SUCCESS);
}
static void version_exit(const char *prg)
static void __noreturn version_exit(const char *prg)
{
printf("%s: Start a program if a terminal device is available, "
"version %s\n", prg, RELEASE_STRING);

View File

@@ -75,7 +75,7 @@ static void init_defaults(void)
/*
* Print "help" hint
*/
static void print_usage_exit(void)
static void __noreturn print_usage_exit(void)
{
STDERR("Try '%s --help' for more information.\n", g.prog_name);
zg_exit(1);
@@ -84,7 +84,7 @@ static void print_usage_exit(void)
/*
* Print help text
*/
static void print_help_exit(void)
static void __noreturn print_help_exit(void)
{
STDOUT("%s", help_text);
zg_exit(0);
@@ -93,7 +93,7 @@ static void print_help_exit(void)
/*
* Print version information
*/
static void print_version_exit(void)
static void __noreturn print_version_exit(void)
{
STDOUT("%s: Tool for copying and converting dumps version %s\n",
g.prog_name, RELEASE_STRING);