From: Peter Maydell Date: Mon, 2 Jun 2008 22:37:01 +0000 (+0000) Subject: When building on gcc, use noreturn attribute on adios and the various done X-Git-Tag: PRE_POSIX_CONVERSION~54 X-Git-Url: http://git.marmaro.de/?p=mmh;a=commitdiff_plain;h=25c0bc3f1c034964421f8007e5802c647c5dc908 When building on gcc, use noreturn attribute on adios and the various done functions. --- diff --git a/ChangeLog b/ChangeLog index e08e678..785aeca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-06-02 Peter Maydell + + * h/mh.h, h/prototypes.h, sbr/done.c, uip/inc.c, + uip/mhbuild.c, uip/mhlist.c, uip/mhn.c, uip/mhshow.c, + uip/mhstore.c, uip/mhtest.c, uip/packf.c, uip/pick.c, + uip/rcvdist.c, uip/rcvstore.c, uip/sendsbr.c: when + building on gcc, use the noreturn attribute on various + functions (should improve code and avoid some spurious + 'uninitialized variable' warnings). + 2008-06-01 Peter Maydell * docs/README.developers: update the bits about doing a diff --git a/h/mh.h b/h/mh.h index 7cdbead..97c7769 100644 --- a/h/mh.h +++ b/h/mh.h @@ -29,6 +29,15 @@ #endif typedef unsigned char boolean; /* not int so we can pack in a structure */ +/* If we're using gcc then give it some information about + * functions that abort. + */ +#if __GNUC__ > 2 +#define NORETURN __attribute__((__noreturn__)) +#else +#define NORETURN +#endif + /* * user context/profile structure */ @@ -336,7 +345,7 @@ extern char *vmhproc; extern char *whatnowproc; extern char *whomproc; -extern void (*done) (int); +extern void (*done) (int) NORETURN; #include diff --git a/h/prototypes.h b/h/prototypes.h index 52fab3a..d10346f 100644 --- a/h/prototypes.h +++ b/h/prototypes.h @@ -25,7 +25,7 @@ char *etcpath(char *); /* * prototypes from the nmh subroutine library */ -void adios (char *, char *, ...); +void adios (char *, char *, ...) NORETURN; void admonish (char *, char *, ...); void advertise (char *, char *, char *, va_list); void advise (char *, char *, ...); diff --git a/sbr/done.c b/sbr/done.c index 938fdb2..65ec1cb 100644 --- a/sbr/done.c +++ b/sbr/done.c @@ -11,4 +11,4 @@ #include -void (*done) (int) = exit; +void (*done) (int) NORETURN = exit; diff --git a/uip/inc.c b/uip/inc.c index ef1b08f..0fcff84 100644 --- a/uip/inc.c +++ b/uip/inc.c @@ -223,7 +223,7 @@ static FILE *in; */ char *map_name(char *); -static void inc_done(int); +static void inc_done(int) NORETURN; #ifdef POP static int pop_action(char *); static int pop_pack(char *); diff --git a/uip/mhbuild.c b/uip/mhbuild.c index 2776f7c..a47022e 100644 --- a/uip/mhbuild.c +++ b/uip/mhbuild.c @@ -100,7 +100,7 @@ static int unlink_infile = 0; static char outfile[BUFSIZ]; static int unlink_outfile = 0; -static void unlink_done (int); +static void unlink_done (int) NORETURN; /* mhbuildsbr.c */ CT build_mime (char *); diff --git a/uip/mhlist.c b/uip/mhlist.c index e8f8163..4bb21bb 100644 --- a/uip/mhlist.c +++ b/uip/mhlist.c @@ -110,7 +110,7 @@ void list_all_messages (CT *, int, int, int, int); /* mhfree.c */ void free_content (CT); extern CT *cts; -void freects_done (int); +void freects_done (int) NORETURN; /* * static prototypes diff --git a/uip/mhn.c b/uip/mhn.c index 6955476..376fc58 100644 --- a/uip/mhn.c +++ b/uip/mhn.c @@ -198,7 +198,7 @@ void cache_all_messages (CT *); /* mhfree.c */ void free_content (CT); extern CT *cts; -void freects_done (int); +void freects_done (int) NORETURN; /* * static prototypes diff --git a/uip/mhshow.c b/uip/mhshow.c index 1383388..179173e 100644 --- a/uip/mhshow.c +++ b/uip/mhshow.c @@ -126,7 +126,7 @@ void show_all_messages (CT *); /* mhfree.c */ void free_content (CT); extern CT *cts; -void freects_done (int); +void freects_done (int) NORETURN; /* * static prototypes diff --git a/uip/mhstore.c b/uip/mhstore.c index bcebb7f..91c57a2 100644 --- a/uip/mhstore.c +++ b/uip/mhstore.c @@ -104,7 +104,7 @@ void store_all_messages (CT *); /* mhfree.c */ void free_content (CT); extern CT *cts; -void freects_done (int); +void freects_done (int) NORETURN; /* * static prototypes diff --git a/uip/mhtest.c b/uip/mhtest.c index fa42cd2..d8c025f 100644 --- a/uip/mhtest.c +++ b/uip/mhtest.c @@ -106,7 +106,7 @@ void flush_errors (void); /* mhfree.c */ void free_content (CT); extern CT *cts; -void freects_done (int); +void freects_done (int) NORETURN; /* * static prototypes diff --git a/uip/packf.c b/uip/packf.c index fb8871d..a696e72 100644 --- a/uip/packf.c +++ b/uip/packf.c @@ -33,7 +33,7 @@ static int md = NOTOK; static int mbx_style = MBOX_FORMAT; static int mapping = 0; -static void mbxclose_done(int); +static void mbxclose_done(int) NORETURN; char *file = NULL; diff --git a/uip/pick.c b/uip/pick.c index ad356e3..2d9b76e 100644 --- a/uip/pick.c +++ b/uip/pick.c @@ -68,7 +68,7 @@ static struct swit switches[] = { static int listsw = -1; -static void putzero_done (int); +static void putzero_done (int) NORETURN; int main (int argc, char **argv) diff --git a/uip/rcvdist.c b/uip/rcvdist.c index b0a3609..7ee47fd 100644 --- a/uip/rcvdist.c +++ b/uip/rcvdist.c @@ -34,7 +34,7 @@ static char tmpfil[BUFSIZ] = ""; * prototypes */ static void rcvdistout (FILE *, char *, char *); -static void unlink_done (int); +static void unlink_done (int) NORETURN; int diff --git a/uip/rcvstore.c b/uip/rcvstore.c index 493bade..21f6c77 100644 --- a/uip/rcvstore.c +++ b/uip/rcvstore.c @@ -48,7 +48,7 @@ static struct swit switches[] = { */ static char *tmpfilenam = NULL; -static void unlink_done(int); +static void unlink_done(int) NORETURN; int main (int argc, char **argv) diff --git a/uip/sendsbr.c b/uip/sendsbr.c index 877538b..fd21acd 100644 --- a/uip/sendsbr.c +++ b/uip/sendsbr.c @@ -60,7 +60,7 @@ char *getusername (void); /* * static prototypes */ -static void armed_done (int); +static void armed_done (int) NORETURN; static void alert (char *, int); static int tmp_fd (void); static void anno (int, struct stat *);