]> granicus.if.org Git - procps-ng/commitdiff
NORETURN
authoralbert <>
Mon, 9 Dec 2002 07:53:09 +0000 (07:53 +0000)
committeralbert <>
Mon, 9 Dec 2002 07:53:09 +0000 (07:53 +0000)
pgrep.c
pmap.c
proc/procps.h
skill.c
top.c
vmstat.c
watch.c

diff --git a/pgrep.c b/pgrep.c
index a11e2bf42df18bafd5dfa9f243513e65708771ec..4770e7c375fe7a78bf0127459afdffc3eb891a03 100644 (file)
--- a/pgrep.c
+++ b/pgrep.c
@@ -57,8 +57,8 @@ static union el *opt_ruid = NULL;
 static char *opt_pattern = NULL;
 
 
-static int
-usage (int opt)
+static int usage (int opt) NORETURN;
+static int usage (int opt)
 {
        if (i_am_pkill)
                fprintf (stderr, "Usage: pkill [-SIGNAL] [-fvx] ");
diff --git a/pmap.c b/pmap.c
index 9f91ccb25125d6946738e009b2513e260140a7a7..80eefa04a5e3cf2208ce21193599d350b403ec76 100644 (file)
--- a/pmap.c
+++ b/pmap.c
@@ -19,6 +19,7 @@
 #include <unistd.h>
 #include "proc/version.h"  // FIXME: we need to link the lib for this :-(
 
+static void usage(void) NORETURN;
 static void usage(void){
   fprintf(stderr,
     "Usage: pmap [-r] [-x] pid...\n"
index 44aab672692c98c17f9bffa47316531115f8114f..8fbaa503fe821432e55a276aac7df4ed7c81ca59 100644 (file)
@@ -18,6 +18,9 @@
 #endif
 #endif
 
+// since gcc-2.5
+#define NORETURN __attribute__((__noreturn__))
+
 #if __GNUC__ > 2 || __GNUC_MINOR__ >= 96
 // won't alias anything, and aligned enough for anything
 #define MALLOC __attribute__ ((__malloc__))
diff --git a/skill.c b/skill.c
index b58200bb3234c2b30abdef1107604fe83175a5b7..e4dce0d7ecfa63dde449319964cdeb1e8e756647 100644 (file)
--- a/skill.c
+++ b/skill.c
@@ -231,6 +231,7 @@ static void iterate(void){
 }
 
 /***** kill help */
+static void kill_usage(void) NORETURN;
 static void kill_usage(void){
   fprintf(stderr,
     "Usage:\n"
@@ -245,6 +246,7 @@ static void kill_usage(void){
 }
 
 /***** kill */
+static void kill_main(int argc, const char *restrict const *restrict argv) NORETURN;
 static void kill_main(int argc, const char *restrict const *restrict argv){
   const char *sigptr;
   int signo = SIGTERM;
@@ -317,6 +319,7 @@ no_more_args:
 }
 
 /***** skill/snice help */
+static void skillsnice_usage(void) NORETURN;
 static void skillsnice_usage(void){
   if(program==PROG_SKILL){
     fprintf(stderr,
diff --git a/top.c b/top.c
index 295db89ab45cf873d558cf03d3d54b79de63a46e..97235a7b17445a66d85db4a7bc14af32be2de909 100644 (file)
--- a/top.c
+++ b/top.c
@@ -324,6 +324,7 @@ static const char *tg2 (int x, int y)
         /*
          * The usual program end --
          * called only by functions in this section. */
+static void bye_bye (int eno, const char *str) NORETURN;
 static void bye_bye (int eno, const char *str)
 {
    if (!Batch)
@@ -408,6 +409,7 @@ static void bye_bye (int eno, const char *str)
          * Normal end of execution.
          * catches:
          *    SIGALRM, SIGHUP, SIGINT, SIGPIPE, SIGQUIT and SIGTERM */
+static void end_pgm (int dont_care_sig) NORETURN;
 static void end_pgm (int dont_care_sig)
 {
    (void)dont_care_sig;
@@ -417,6 +419,7 @@ static void end_pgm (int dont_care_sig)
 
         /*
          * Standard error handler to normalize the look of all err o/p */
+static void std_err (const char *str) NORETURN;
 static void std_err (const char *str)
 {
    static char buf[SMLBUFSIZ];
index f429cd94fb582434e139129b620511c8feeae4a2..f9f6c5c9fe3cb62a3e71398ca924ed4cb6909c9c 100644 (file)
--- a/vmstat.c
+++ b/vmstat.c
@@ -36,7 +36,7 @@ static unsigned int moreheaders=TRUE;
 
 /////////////////////////////////////////////////////////////////////////
 
-
+static void usage(void) NORETURN;
 static void usage(void) {
   fprintf(stderr,"usage: vmstat [-V] [-n] [delay [count]]\n");
   fprintf(stderr,"              -V prints version.\n");
@@ -47,6 +47,7 @@ static void usage(void) {
   exit(EXIT_FAILURE);
 }
 
+static void crash(const char *filename) NORETURN;
 static void crash(const char *filename) {
     perror(filename);
     exit(EXIT_FAILURE);
diff --git a/watch.c b/watch.c
index 41445adedc7a391a497ad54cc2325e07b12bb34d..6cad945fd0ee49d3d65aa74c265684b06428f974 100644 (file)
--- a/watch.c
+++ b/watch.c
@@ -42,15 +42,15 @@ static int first_screen = 1;
 
 #define min(x,y) ((x) > (y) ? (y) : (x))
 
-static void
-do_usage(void)
+static void do_usage(void) NORETURN;
+static void do_usage(void)
 {
        fprintf(stderr, usage, progname);
        exit(1);
 }
 
-static void
-do_exit(int status)
+static void do_exit(int status) NORETURN;
+static void do_exit(int status)
 {
        if (curses_started)
                endwin();
@@ -58,8 +58,8 @@ do_exit(int status)
 }
 
 /* signal handler */
-static void
-die(int notused)
+static void die(int notused) NORETURN;
+static void die(int notused)
 {
        (void) notused;
        do_exit(0);