From 8d3e26681c4341c76fe9a28371a75061678e7df2 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Mon, 2 Jun 2008 21:49:07 +0000 Subject: [PATCH] If we're compiling with gcc, mark adios() as never returning (better code and fewer spurious 'uninitialized variable) warnings) --- ChangeLog | 6 ++++++ h/prototypes.h | 11 ++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e08e678..2e7678e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-06-02 Peter Maydell + + * h/prototypes.h: mark adios() as not returning, so gcc + can make a better job of avoiding spurious "uninitialized + variable" warnings. + 2008-06-01 Peter Maydell * docs/README.developers: update the bits about doing a diff --git a/h/prototypes.h b/h/prototypes.h index 52fab3a..d559baa 100644 --- a/h/prototypes.h +++ b/h/prototypes.h @@ -5,6 +5,15 @@ * $Id$ */ +/* 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 + /* * missing system prototypes */ @@ -25,7 +34,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 *, ...); -- 1.7.10.4