diff options
| -rw-r--r-- | include/common.h | 7 | ||||
| -rw-r--r-- | misc-utils/flash_unlock.c | 4 | ||||
| -rw-r--r-- | misc-utils/flashcp.c | 2 | ||||
| -rw-r--r-- | misc-utils/mtd_debug.c | 2 | ||||
| -rw-r--r-- | nand-utils/nandtest.c | 4 | ||||
| -rw-r--r-- | nand-utils/nftl_format.c | 4 | ||||
| -rw-r--r-- | tests/mtd-tests/flash_readtest.c | 2 | ||||
| -rw-r--r-- | tests/mtd-tests/flash_speed.c | 3 | ||||
| -rw-r--r-- | tests/mtd-tests/flash_stress.c | 2 | ||||
| -rw-r--r-- | tests/mtd-tests/flash_torture.c | 2 | ||||
| -rw-r--r-- | tests/mtd-tests/nandbiterrs.c | 2 | ||||
| -rw-r--r-- | tests/mtd-tests/nandpagetest.c | 2 | ||||
| -rw-r--r-- | tests/mtd-tests/nandsubpagetest.c | 2 | 
13 files changed, 19 insertions, 19 deletions
| diff --git a/include/common.h b/include/common.h index d609257..2ce5d22 100644 --- a/include/common.h +++ b/include/common.h @@ -129,6 +129,13 @@ extern "C" {  	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   */ diff --git a/misc-utils/flash_unlock.c b/misc-utils/flash_unlock.c index 5a3aac5..fbbfa51 100644 --- a/misc-utils/flash_unlock.c +++ b/misc-utils/flash_unlock.c @@ -36,7 +36,7 @@ static const char *flash_msg[] = {  	[ 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" @@ -88,7 +88,6 @@ static void process_args(int argc, char *argv[])  		switch (c) {  		case 'h':  			usage(EXIT_SUCCESS); -			break;  		case 'i':  			req = REQUEST_ISLOCKED;  			req_set++; @@ -106,7 +105,6 @@ static void process_args(int argc, char *argv[])  			exit(0);  		default:  			usage(EXIT_FAILURE); -			break;  		}  	} diff --git a/misc-utils/flashcp.c b/misc-utils/flashcp.c index a35e6fc..0718733 100644 --- a/misc-utils/flashcp.c +++ b/misc-utils/flashcp.c @@ -81,7 +81,7 @@ static void log_printf (int level,const char *fmt, ...)  	fflush (fp);  } -static void showusage(bool error) +static NORETURN void showusage(bool error)  {  	int level = error ? LOG_ERROR : LOG_NORMAL; diff --git a/misc-utils/mtd_debug.c b/misc-utils/mtd_debug.c index 90f5d52..d90a968 100644 --- a/misc-utils/mtd_debug.c +++ b/misc-utils/mtd_debug.c @@ -339,7 +339,7 @@ static int showinfo(int fd)  	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" diff --git a/nand-utils/nandtest.c b/nand-utils/nandtest.c index d5c7369..06dec25 100644 --- a/nand-utils/nandtest.c +++ b/nand-utils/nandtest.c @@ -17,7 +17,7 @@  #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" @@ -184,14 +184,12 @@ int main(int argc, char **argv)  		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; diff --git a/nand-utils/nftl_format.c b/nand-utils/nftl_format.c index ec87604..c8b8b50 100644 --- a/nand-utils/nftl_format.c +++ b/nand-utils/nftl_format.c @@ -198,7 +198,7 @@ static int checkbbt(void)  	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); @@ -250,13 +250,11 @@ int main(int argc, char **argv)  			case 'h':  			case '?':  				usage(EXIT_SUCCESS); -				break;  			case 'V':  				display_version();  				break;  			default:  				usage(EXIT_FAILURE); -				break;  		}  	} diff --git a/tests/mtd-tests/flash_readtest.c b/tests/mtd-tests/flash_readtest.c index bc6874a..c5fabc9 100644 --- a/tests/mtd-tests/flash_readtest.c +++ b/tests/mtd-tests/flash_readtest.c @@ -54,7 +54,7 @@ static const struct option options[] = {  	{ NULL, 0, NULL, 0 },  }; -static void usage(int status) +static NORETURN void usage(int status)  {  	fputs(  	"Usage: "PROGRAM_NAME" [OPTIONS] <device>\n\n" diff --git a/tests/mtd-tests/flash_speed.c b/tests/mtd-tests/flash_speed.c index d5cedba..0058269 100644 --- a/tests/mtd-tests/flash_speed.c +++ b/tests/mtd-tests/flash_speed.c @@ -60,7 +60,7 @@ static const struct option options[] = {  	{ NULL, 0, NULL, 0 },  }; -static void usage(int status) +static NORETURN void usage(int status)  {  	fputs(  	"Usage: "PROGRAM_NAME" [OPTIONS] <device>\n\n" @@ -100,7 +100,6 @@ static void process_options(int argc, char **argv)  		switch (c) {  		case 'h':  			usage(EXIT_SUCCESS); -			break;  		case 'b':  			if (peb >= 0)  				goto failmulti; diff --git a/tests/mtd-tests/flash_stress.c b/tests/mtd-tests/flash_stress.c index f50c664..249d8cb 100644 --- a/tests/mtd-tests/flash_stress.c +++ b/tests/mtd-tests/flash_stress.c @@ -63,7 +63,7 @@ static const struct option options[] = {  	{ NULL, 0, NULL, 0 },  }; -static void usage(int status) +static NORETURN void usage(int status)  {  	fputs(  	"Usage: "PROGRAM_NAME" [OPTIONS] <device>\n\n" diff --git a/tests/mtd-tests/flash_torture.c b/tests/mtd-tests/flash_torture.c index 21cedf4..5aad8e0 100644 --- a/tests/mtd-tests/flash_torture.c +++ b/tests/mtd-tests/flash_torture.c @@ -67,7 +67,7 @@ static void sighandler(int sig)  		flags &= ~RUN_FOREVER;  } -static void usage(int status) +static NORETURN void usage(int status)  {  	fputs(  	"Usage: "PROGRAM_NAME" [OPTIONS] <device>\n\n" diff --git a/tests/mtd-tests/nandbiterrs.c b/tests/mtd-tests/nandbiterrs.c index 200fe1c..ef987dc 100644 --- a/tests/mtd-tests/nandbiterrs.c +++ b/tests/mtd-tests/nandbiterrs.c @@ -85,7 +85,7 @@ static const struct option options[] = {  	{ NULL, 0, NULL, 0 },  }; -static void usage(int status) +static NORETURN void usage(int status)  {  	fputs(  	"Usage: "PROGRAM_NAME" [OPTIONS] <device>\n\n" diff --git a/tests/mtd-tests/nandpagetest.c b/tests/mtd-tests/nandpagetest.c index 86c9005..2b16cc9 100644 --- a/tests/mtd-tests/nandpagetest.c +++ b/tests/mtd-tests/nandpagetest.c @@ -58,7 +58,7 @@ static const struct option options[] = {  	{ NULL, 0, NULL, 0 },  }; -static void usage(int status) +static NORETURN void usage(int status)  {  	fputs(  	"Usage: "PROGRAM_NAME" [OPTIONS] <device>\n\n" diff --git a/tests/mtd-tests/nandsubpagetest.c b/tests/mtd-tests/nandsubpagetest.c index 04f6c8c..cd7e4e8 100644 --- a/tests/mtd-tests/nandsubpagetest.c +++ b/tests/mtd-tests/nandsubpagetest.c @@ -57,7 +57,7 @@ static const struct option options[] = {  	{ NULL, 0, NULL, 0 },  }; -static void usage(int status) +static NORETURN void usage(int status)  {  	fputs(  	"Usage: "PROGRAM_NAME" [OPTIONS] <device>\n\n" | 
