Skip to content

Commit

Permalink
Minor fix for clang-analyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
zuckschwerdt committed Sep 19, 2020
1 parent 04cdf79 commit 71fc9f7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/rtl_433.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@
#include "getopt/getopt.h"
#endif

#if defined(__clang__)
#define NORETURN _Noreturn
#elif defined(__GNUC__)
#define NORETURN __attribute__((noreturn))
#elif defined(_MSC_VER)
#define NORETURN __declspec(noreturn)
#else
#define NORETURN
#endif

r_device *flex_create_device(char *spec); // maybe put this in some header file?

static void print_version(void)
Expand All @@ -76,6 +86,7 @@ static void print_version(void)
fprintf(stderr, "Use -h for usage help and see https://triq.org/ for documentation.\n");
}

NORETURN
static void usage(int exit_code)
{
term_help_printf(
Expand Down Expand Up @@ -129,6 +140,7 @@ static void usage(int exit_code)
exit(exit_code);
}

NORETURN
static void help_protocols(r_device *devices, unsigned num_devices, int exit_code)
{
unsigned i;
Expand All @@ -146,6 +158,7 @@ static void help_protocols(r_device *devices, unsigned num_devices, int exit_cod
exit(exit_code);
}

NORETURN
static void help_device(void)
{
term_help_printf(
Expand All @@ -171,6 +184,7 @@ static void help_device(void)
exit(0);
}

NORETURN
static void help_gain(void)
{
term_help_printf(
Expand All @@ -182,6 +196,7 @@ static void help_gain(void)
exit(0);
}

NORETURN
static void help_output(void)
{
term_help_printf(
Expand All @@ -207,6 +222,7 @@ static void help_output(void)
exit(0);
}

NORETURN
static void help_meta(void)
{
term_help_printf(
Expand All @@ -231,6 +247,7 @@ static void help_meta(void)
exit(0);
}

NORETURN
static void help_read(void)
{
term_help_printf(
Expand All @@ -252,6 +269,7 @@ static void help_read(void)
exit(0);
}

NORETURN
static void help_write(void)
{
term_help_printf(
Expand Down
2 changes: 1 addition & 1 deletion src/write_sigrok.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ void write_sigrok(char const *filename, unsigned samplerate, unsigned probes, un
perror("unlinking Sigrok \"logic-1-1\" file");
}
}
for (unsigned i = 0; i < analogs; ++i) {
for (unsigned i = 0; i < analogs && argv_analog[i]; ++i) {
if (unlink(argv_analog[i])) {
perror("unlinking Sigrok \"analog-1-N-1\" file");
}
Expand Down

0 comments on commit 71fc9f7

Please sign in to comment.