From: Rosen Penev <rosenp@gmail.com>
To: linux-media@vger.kernel.org
Subject: [PATCH 06/12] utils: add noreturn attribute and remove dead code
Date: Tue, 21 Apr 2020 17:37:29 -0700 [thread overview]
Message-ID: <20200422003735.3891-6-rosenp@gmail.com> (raw)
In-Reply-To: <20200422003735.3891-1-rosenp@gmail.com>
Found with -Wmissing-noreturn and -Wunreachable-code-return
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
utils/v4l2-compliance/v4l2-compliance.cpp | 9 ++-------
utils/v4l2-dbg/v4l2-dbg.cpp | 7 +------
2 files changed, 3 insertions(+), 13 deletions(-)
diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp
index b3a18492..fbf34914 100644
--- a/utils/v4l2-compliance/v4l2-compliance.cpp
+++ b/utils/v4l2-compliance/v4l2-compliance.cpp
@@ -155,6 +155,7 @@ static struct option long_options[] = {
{0, 0, 0, 0}
};
+__attribute__((noreturn))
static void usage()
{
printf("Usage:\n");
@@ -482,6 +483,7 @@ static void restoreState()
node->reopen();
}
+__attribute__((noreturn))
static void signal_handler_interrupt(int signum)
{
restoreState();
@@ -1544,7 +1546,6 @@ int main(int argc, char **argv)
switch (ch) {
case OptHelp:
usage();
- return 0;
case OptSetDevice:
device = make_devname(optarg, "video", media_bus_info);
break;
@@ -1619,7 +1620,6 @@ int main(int argc, char **argv)
color_component = 2;
else {
usage();
- exit(1);
}
break;
case 1:
@@ -1634,7 +1634,6 @@ int main(int argc, char **argv)
break;
default:
usage();
- exit(1);
}
}
break;
@@ -1647,7 +1646,6 @@ int main(int argc, char **argv)
show_colors = isatty(STDOUT_FILENO);
else {
usage();
- exit(1);
}
break;
case OptNoWarnings:
@@ -1669,13 +1667,11 @@ int main(int argc, char **argv)
fprintf(stderr, "Option `%s' requires a value\n",
argv[optind]);
usage();
- return 1;
case '?':
if (argv[optind])
fprintf(stderr, "Unknown argument `%s'\n",
argv[optind]);
usage();
- return 1;
}
}
if (optind < argc) {
@@ -1684,7 +1680,6 @@ int main(int argc, char **argv)
fprintf(stderr, "%s ", argv[optind++]);
fprintf(stderr, "\n");
usage();
- return 1;
}
bool direct = !options[OptUseWrapper];
int fd;
diff --git a/utils/v4l2-dbg/v4l2-dbg.cpp b/utils/v4l2-dbg/v4l2-dbg.cpp
index cd387d1d..7b986a50 100644
--- a/utils/v4l2-dbg/v4l2-dbg.cpp
+++ b/utils/v4l2-dbg/v4l2-dbg.cpp
@@ -162,6 +162,7 @@ static struct option long_options[] = {
{0, 0, 0, 0}
};
+__attribute__((noreturn))
static void usage()
{
printf("Usage: v4l2-dbg [options] [values]\n"
@@ -387,13 +388,11 @@ static int parse_subopt(char **subs, const char * const *subopts, char **value)
if (opt == -1) {
fprintf(stderr, "Invalid suboptions specified\n");
usage();
- exit(1);
}
if (*value == NULL) {
fprintf(stderr, "No value given to suboption <%s>\n",
subopts[opt]);
usage();
- exit(1);
}
return opt;
}
@@ -429,7 +428,6 @@ int main(int argc, char **argv)
if (argc == 1) {
usage();
- return 0;
}
for (i = 0; long_options[i].name; i++) {
if (!isalpha(long_options[i].val))
@@ -467,7 +465,6 @@ int main(int argc, char **argv)
switch (ch) {
case OptHelp:
usage();
- return 0;
case OptSetDevice:
device = optarg;
@@ -538,13 +535,11 @@ int main(int argc, char **argv)
fprintf(stderr, "Option `%s' requires a value\n",
argv[optind]);
usage();
- return 1;
case '?':
fprintf(stderr, "Unknown argument `%s'\n",
argv[optind]);
usage();
- return 1;
}
}
--
2.25.2
next prev parent reply other threads:[~2020-04-22 0:37 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-22 0:37 [PATCH 01/12] utils: fix compilation with C++98 Rosen Penev
2020-04-22 0:37 ` [PATCH 02/12] utils: remove extra commas Rosen Penev
2020-04-22 0:37 ` [PATCH 03/12] utils: fix float equal warning Rosen Penev
2020-04-22 0:37 ` [PATCH 04/12] utils: don't check unsigned for < 0 Rosen Penev
2020-04-23 8:30 ` Hans Verkuil
2020-04-23 8:33 ` Rosen Penev
2020-04-22 0:37 ` [PATCH 05/12] utils: add copy assignment operator Rosen Penev
2020-04-22 0:37 ` Rosen Penev [this message]
2020-04-23 8:34 ` [PATCH 06/12] utils: add noreturn attribute and remove dead code Hans Verkuil
2020-04-22 0:37 ` [PATCH 07/12] utils: fix implicit double promotion Rosen Penev
2020-04-23 9:04 ` Hans Verkuil
2020-04-22 0:37 ` [PATCH 08/12] utils: initialize variable Rosen Penev
2020-04-22 0:37 ` [PATCH 09/12] utils: fix implicit float conversions Rosen Penev
2020-04-23 8:36 ` Hans Verkuil
2020-04-23 8:44 ` Rosen Penev
2020-04-23 9:01 ` Hans Verkuil
2020-04-22 0:37 ` [PATCH 10/12] utils: fix fallthrough warnings Rosen Penev
2020-04-23 8:43 ` Hans Verkuil
2020-04-23 8:46 ` Rosen Penev
2020-04-23 8:57 ` Hans Verkuil
2020-04-22 0:37 ` [PATCH 11/12] utils: fix double promotions Rosen Penev
2020-04-23 8:45 ` Hans Verkuil
2020-04-22 0:37 ` [PATCH 12/12] utils: fix wrong format Rosen Penev
2020-04-23 8:19 ` [PATCH 01/12] utils: fix compilation with C++98 Hans Verkuil
2020-04-23 8:30 ` Rosen Penev
2020-04-23 8:48 ` Hans Verkuil
2020-04-23 8:50 ` Rosen Penev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200422003735.3891-6-rosenp@gmail.com \
--to=rosenp@gmail.com \
--cc=linux-media@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.