[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 'noreturn' warning in libcruft
From: |
John W. Eaton |
Subject: |
Re: 'noreturn' warning in libcruft |
Date: |
Tue, 7 Aug 2012 14:14:22 -0400 |
On 7-Aug-2012, Rik wrote:
|
| >
| >
| > I know what you're trying to do and I know why the return statement will
| > never get reached. But I also know that with no-GCC compilers,
| > GCC_ATTR_NORETURN will not be defined and this then may generate a
| > compiler error as the return statement will now be missing.
| >
| > So it's basically a choice between getting rid of a GCC warning and
| > (possibly) introducing a compilation error with other compilers.
| If it is a specific compiler behavior that we are using then why not test
| for it as is already done for the GCC_ATTR_NORETURN macro? The following
| silences the warning for me and should work with the other compilers that
| want a return statement.
|
| #ifndef __GNUC__
| F77_RETURN (0)
| #endif
The attached diff is what I had in mind.
jwe
diff --git a/libcruft/misc/f77-fcn.c b/libcruft/misc/f77-fcn.c
--- 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)
}
diff --git a/libcruft/misc/f77-fcn.h b/libcruft/misc/f77-fcn.h
--- 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 (GCC_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 (GCC_ATTR_NORETURN)
+#define F77_NORETURN(retval)
+#else
+#define F77_NORETURN(retval) return retval;
+#endif
#endif
- 'noreturn' warning in libcruft, Rik, 2012/08/07
- Re: 'noreturn' warning in libcruft, Michael Goffioul, 2012/08/07
- Re: 'noreturn' warning in libcruft, Michael Goffioul, 2012/08/07
- Re: 'noreturn' warning in libcruft, John W. Eaton, 2012/08/07
- Re: 'noreturn' warning in libcruft, Michael Goffioul, 2012/08/07
- Re: 'noreturn' warning in libcruft, John W. Eaton, 2012/08/07
- Re: 'noreturn' warning in libcruft, Rik, 2012/08/07
- Re: 'noreturn' warning in libcruft, John W. Eaton, 2012/08/07
- Re: 'noreturn' warning in libcruft, Rik, 2012/08/07
- Re: 'noreturn' warning in libcruft, John W. Eaton, 2012/08/08