[ Date Prev][ Date Next][ Thread Prev][ Thread Next][ Date Index][ Thread Index]
Re: [vsipl++] compiler warnings
- To: VSIPL++ Developers List <vsipl++@xxxxxxxxxxxxxxxx>
- Subject: Re: [vsipl++] compiler warnings
- From: Stefan Seefeld <stefan@xxxxxxxxxxxxxxxx>
- Date: Mon, 14 Nov 2005 16:31:06 -0500
Stefan Seefeld wrote:
Jules Bergmann wrote:
+#if 0
How should we set this? Via a configure check or based on compiler
version macros?
How about:
#if __ghs__
I believe I introduced the two offending return statements specifically
to make icc happy. Thus I'd suggest to replace the #if 0 by something
like #if __icc__. I'll look into it as soon as I have access to icc
again.
It appears I introduced these dummy return statements when doing the
initial port to ghs. At the time, we were using --disable-exceptions,
and with that option we would call 'fatal_exception()' instead of
throwing an exception. As it happens that function is marked up
as '__noreturn__', but the markup code was only visible if __GCC__ >= 2.
As it turns out, ghs understands GCC attributes, so this revised patch
simply enables the VSIP_IMPL_NORETURN macro for ghs, too.
This means that now all three supported compilers (gcc, icc, ghs)
recognize the __noreturn__ attribute, and thus no dummy return
statement is needed any more.
The code is tested with gcc as well as ghs, both with and without
--disable-exceptions.
Regards,
Stefan
Index: src/vsip/support.hpp
===================================================================
RCS file: /home/cvs/Repository/vpp/src/vsip/support.hpp,v
retrieving revision 1.21
diff -u -r1.21 support.hpp
--- src/vsip/support.hpp 28 Aug 2005 00:22:39 -0000 1.21
+++ src/vsip/support.hpp 14 Nov 2005 21:23:17 -0000
@@ -38,7 +38,9 @@
/// indication that they never return (except possibly by throwing an
/// exception), then VSIP_NORETURN is defined to that annotation,
/// otherwise it is defined to nothing.
-#if __GNUC__ >= 2
+/// GCC supports it, as does Green Hills, as well as Intel.
+/// The latter defines __GNUC__, too.
+#if __GNUC__ >= 2 || defined(__ghs__)
# define VSIP_IMPL_NORETURN __attribute__ ((__noreturn__))
#else
# define VSIP_IMPL_NORETURN
Index: src/vsip/impl/dist.hpp
===================================================================
RCS file: /home/cvs/Repository/vpp/src/vsip/impl/dist.hpp,v
retrieving revision 1.9
diff -u -r1.9 dist.hpp
--- src/vsip/impl/dist.hpp 2 Nov 2005 18:44:03 -0000 1.9
+++ src/vsip/impl/dist.hpp 14 Nov 2005 21:23:18 -0000
@@ -620,7 +620,6 @@
const VSIP_NOTHROW
{
VSIP_IMPL_THROW(impl::unimplemented("Cyclic_dist::impl_subblock_from_index()"));
- return no_subblock;
}
@@ -630,7 +629,6 @@
const VSIP_NOTHROW
{
VSIP_IMPL_THROW(impl::unimplemented("Cyclic_dist::impl_local_from_global_index()"));
- return 0;
}
} // namespace vsip
|