Mercurial > hg > octave-jordi
changeset 15127:87411930d6c4
avoid "function declared 'noreturn' has a return statement" warning.
* configure.ac (HAVE_ATTR_DEPRECATED, HAVE_ATTR_NORETURN,
HAVE_ATTR_UNUSED): New macros, corresponding to GCC_ATTR_DEPRECATED,
GCC_ATTR_NORETURN, and GCC_ATTR_UNUSED.
* libcruft/misc/f77-fcn.c (xstopx): Use F77_NORETURN instead of
F77_RETURN.
* libcruft/misc/f77-fcn.h (F77_RETURN): New macro.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 08 Aug 2012 10:27:59 -0400 |
parents | 25200c04bc25 |
children | 4d52239daef5 |
files | configure.ac libcruft/misc/f77-fcn.c libcruft/misc/f77-fcn.h |
diffstat | 3 files changed, 18 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.ac +++ b/configure.ac @@ -2159,8 +2159,13 @@ #if defined (__GNUC__) #define GCC_ATTR_DEPRECATED __attribute__ ((__deprecated__)) +#define HAVE_ATTR_DEPRECATED + #define GCC_ATTR_NORETURN __attribute__ ((__noreturn__)) +#define HAVE_ATTR_NORETURN + #define GCC_ATTR_UNUSED __attribute__ ((__unused__)) +#define HAVE_ATTR_UNUSED #else #define GCC_ATTR_DEPRECATED #define GCC_ATTR_NORETURN
--- a/libcruft/misc/f77-fcn.c +++ b/libcruft/misc/f77-fcn.c @@ -60,5 +60,5 @@ octave_jump_to_enclosing_context (); - F77_RETURN (0) + F77_NORETURN (0) }
--- a/libcruft/misc/f77-fcn.h +++ b/libcruft/misc/f77-fcn.h @@ -108,6 +108,11 @@ #define F77_RET_T int #define F77_RETURN(retval) return retval; +#if defined (HAVE_ATTR_NORETURN) +#define F77_NORETURN(retval) +#else +#define F77_NORETURN(retval) return retval; +#endif /* FIXME -- these should work for SV1 or Y-MP systems but will need to be changed for others. */ @@ -176,7 +181,8 @@ #define F77_CHAR_ARG_LEN_USE(s, len) len #define F77_RET_T void -#define F77_RETURN(retval) +#define F77_RETURN(retval) return; +#define F77_NORETURN(retval) #else @@ -203,6 +209,11 @@ #define F77_RET_T int #define F77_RETURN(retval) return retval; +#if defined (HAVE_ATTR_NORETURN) +#define F77_NORETURN(retval) +#else +#define F77_NORETURN(retval) return retval; +#endif #endif