From: Rosen Penev <rosenp@gmail.com>
To: linux-media@vger.kernel.org
Subject: [PATCH 2/5] utils: add noreturn attribute and remove dead code
Date: Thu, 23 Apr 2020 14:10:37 -0700 [thread overview]
Message-ID: <20200423211040.14275-2-rosenp@gmail.com> (raw)
In-Reply-To: <20200423211040.14275-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 | 10 +++++-----
utils/v4l2-dbg/v4l2-dbg.cpp | 5 ++---
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp
index b3a18492..a312f54d 100644
--- a/utils/v4l2-compliance/v4l2-compliance.cpp
+++ b/utils/v4l2-compliance/v4l2-compliance.cpp
@@ -247,7 +247,6 @@ static void usage()
printf(" -w, --wrapper Use the libv4l2 wrapper library.\n");
#endif
printf(" -W, --exit-on-warn Exit on the first warning.\n");
- exit(0);
}
const char *ok(int res)
@@ -482,6 +481,7 @@ static void restoreState()
node->reopen();
}
+__attribute__((noreturn))
static void signal_handler_interrupt(int signum)
{
restoreState();
@@ -1544,7 +1544,7 @@ int main(int argc, char **argv)
switch (ch) {
case OptHelp:
usage();
- return 0;
+ exit(0);
case OptSetDevice:
device = make_devname(optarg, "video", media_bus_info);
break;
@@ -1669,13 +1669,13 @@ int main(int argc, char **argv)
fprintf(stderr, "Option `%s' requires a value\n",
argv[optind]);
usage();
- return 1;
+ exit(1);
case '?':
if (argv[optind])
fprintf(stderr, "Unknown argument `%s'\n",
argv[optind]);
usage();
- return 1;
+ exit(1);
}
}
if (optind < argc) {
@@ -1684,7 +1684,7 @@ int main(int argc, char **argv)
fprintf(stderr, "%s ", argv[optind++]);
fprintf(stderr, "\n");
usage();
- return 1;
+ exit(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..99c5a726 100644
--- a/utils/v4l2-dbg/v4l2-dbg.cpp
+++ b/utils/v4l2-dbg/v4l2-dbg.cpp
@@ -187,7 +187,6 @@ static void usage()
" Sets step between two registers\n"
" --list-symbols List the symbolic register names you can use, if any\n"
" --log-status Log the board status in the kernel log [VIDIOC_LOG_STATUS]\n");
- exit(0);
}
static std::string cap2s(unsigned cap)
@@ -429,7 +428,7 @@ int main(int argc, char **argv)
if (argc == 1) {
usage();
- return 0;
+ exit(0);
}
for (i = 0; long_options[i].name; i++) {
if (!isalpha(long_options[i].val))
@@ -467,7 +466,7 @@ int main(int argc, char **argv)
switch (ch) {
case OptHelp:
usage();
- return 0;
+ exit(0);
case OptSetDevice:
device = optarg;
--
2.25.3
next prev parent reply other threads:[~2020-04-23 21:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-23 21:10 [PATCH 1/5] utils: fix compilation with C++98 Rosen Penev
2020-04-23 21:10 ` Rosen Penev [this message]
2020-04-23 21:10 ` [PATCH 3/5] utils: fix implicit float conversions Rosen Penev
2020-04-23 21:10 ` [PATCH 4/5] utils: fix fallthrough warnings Rosen Penev
2020-04-23 21:10 ` [PATCH 5/5] utils: fix double promotions Rosen Penev
2020-05-07 11:54 ` [PATCH 1/5] utils: fix compilation with C++98 Tomasz Figa
2020-05-07 18:27 ` 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=20200423211040.14275-2-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.