fprintf(stderr, "%s: warning!: " fmt "\n", PROGRAM_NAME, ##__VA_ARGS__); \
} while(0)
+/* for tagging functions that always exit */
+#if defined(__GNUC__) || defined(__clang__)
+ #define NORETURN __attribute__((noreturn))
+#else
+ #define NORETURN
+#endif
+
/**
* prompt the user for confirmation
*/
[ REQUEST_ISLOCKED ] = "check lock status",
};
-static void usage(int status)
+static NORETURN void usage(int status)
{
fprintf(status ? stderr : stdout,
"Utility to lock, unlock, or check the lock status of the flash.\n"
switch (c) {
case 'h':
usage(EXIT_SUCCESS);
- break;
case 'i':
req = REQUEST_ISLOCKED;
req_set++;
exit(0);
default:
usage(EXIT_FAILURE);
- break;
}
}
fflush (fp);
}
-static void showusage(bool error)
+static NORETURN void showusage(bool error)
{
int level = error ? LOG_ERROR : LOG_NORMAL;
return 0;
}
-static void showusage(void)
+static NORETURN void showusage(void)
{
fprintf(stderr, "usage: %1$s info <device>\n"
" %1$s read <device> <offset> <len> <dest-filename>\n"
#include "mtd/mtd-user.h"
#include "common.h"
-static void usage(int status)
+static NORETURN void usage(int status)
{
fprintf(status ? stderr : stdout,
"usage: %s [OPTIONS] <device>\n\n"
switch (c) {
case 'h':
usage(EXIT_SUCCESS);
- break;
case 'V':
common_print_version();
exit(EXIT_SUCCESS);
break;
case '?':
usage(EXIT_FAILURE);
- break;
case 'm':
markbad = 1;
return (0);
}
-static void usage(int rc)
+static NORETURN void usage(int rc)
{
fprintf(stderr, "Usage: %s [-ib] <mtddevice> [<start offset> [<size>]]\n", PROGRAM_NAME);
exit(rc);
case 'h':
case '?':
usage(EXIT_SUCCESS);
- break;
case 'V':
display_version();
break;
default:
usage(EXIT_FAILURE);
- break;
}
}
{ NULL, 0, NULL, 0 },
};
-static void usage(int status)
+static NORETURN void usage(int status)
{
fputs(
"Usage: "PROGRAM_NAME" [OPTIONS] <device>\n\n"
{ NULL, 0, NULL, 0 },
};
-static void usage(int status)
+static NORETURN void usage(int status)
{
fputs(
"Usage: "PROGRAM_NAME" [OPTIONS] <device>\n\n"
switch (c) {
case 'h':
usage(EXIT_SUCCESS);
- break;
case 'b':
if (peb >= 0)
goto failmulti;
{ NULL, 0, NULL, 0 },
};
-static void usage(int status)
+static NORETURN void usage(int status)
{
fputs(
"Usage: "PROGRAM_NAME" [OPTIONS] <device>\n\n"
flags &= ~RUN_FOREVER;
}
-static void usage(int status)
+static NORETURN void usage(int status)
{
fputs(
"Usage: "PROGRAM_NAME" [OPTIONS] <device>\n\n"
{ NULL, 0, NULL, 0 },
};
-static void usage(int status)
+static NORETURN void usage(int status)
{
fputs(
"Usage: "PROGRAM_NAME" [OPTIONS] <device>\n\n"
{ NULL, 0, NULL, 0 },
};
-static void usage(int status)
+static NORETURN void usage(int status)
{
fputs(
"Usage: "PROGRAM_NAME" [OPTIONS] <device>\n\n"
{ NULL, 0, NULL, 0 },
};
-static void usage(int status)
+static NORETURN void usage(int status)
{
fputs(
"Usage: "PROGRAM_NAME" [OPTIONS] <device>\n\n"