Actions

icon Post
text/html Subscribe
text/html Unsubscribe

[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 10:33:52 -0500

The attached patch silences two more ghs warnings.

Regards,
		Stefan
Index: src/vsip/map.hpp
===================================================================
RCS file: /home/cvs/Repository/vpp/src/vsip/map.hpp,v
retrieving revision 1.18
diff -u -r1.18 map.hpp
--- src/vsip/map.hpp	10 Nov 2005 05:44:02 -0000	1.18
+++ src/vsip/map.hpp	14 Nov 2005 15:30:18 -0000
@@ -385,10 +385,10 @@
 
   switch (d)
   {
+  default: assert(false);
   case 0: return dist0_.distribution();
   case 1: return dist1_.distribution();
   case 2: return dist2_.distribution();
-  default: assert(false);
   }
 }
 
@@ -405,10 +405,10 @@
 
   switch (d)
   {
+  default: assert(false);
   case 0: return dist0_.num_subblocks();
   case 1: return dist1_.num_subblocks();
   case 2: return dist2_.num_subblocks();
-  default: assert(false);
   }
 }
 
@@ -425,10 +425,10 @@
 
   switch (d)
   {
+  default: assert(false);
   case 0: return dist0_.cyclic_contiguity();
   case 1: return dist1_.cyclic_contiguity();
   case 2: return dist2_.cyclic_contiguity();
-  default: assert(false);
   }
 }
 
@@ -450,10 +450,10 @@
 
   switch (d)
   {
+  default: assert(false);
   case 0: return dist0_.impl_subblock_patches(dom_[0], sb);
   case 1: return dist1_.impl_subblock_patches(dom_[1], sb);
   case 2: return dist2_.impl_subblock_patches(dom_[2], sb);
-  default: assert(false);
   }
 }
 
@@ -475,10 +475,10 @@
 
   switch (d)
   {
+  default: assert(false);
   case 0: return dist0_.impl_subblock_size(dom_[0], sb);
   case 1: return dist1_.impl_subblock_size(dom_[1], sb);
   case 2: return dist2_.impl_subblock_size(dom_[2], sb);
-  default: assert(false);
   }
 }
 
@@ -501,10 +501,10 @@
 
   switch (d)
   {
+  default: assert(false);
   case 0: return dist0_.impl_patch_global_dom(dom_[0], sb, p);
   case 1: return dist1_.impl_patch_global_dom(dom_[1], sb, p);
   case 2: return dist2_.impl_patch_global_dom(dom_[2], sb, p);
-  default: assert(false);
   }
 }
 
@@ -527,10 +527,10 @@
 
   switch (d)
   {
+  default: assert(false);
   case 0: return dist0_.impl_patch_local_dom(dom_[0], sb, p);
   case 1: return dist1_.impl_patch_local_dom(dom_[1], sb, p);
   case 2: return dist2_.impl_patch_local_dom(dom_[2], sb, p);
-  default: assert(false);
   }
 }
 
@@ -553,10 +553,10 @@
 
   switch (d)
   {
+  default: assert(false);
   case 0: return dist0_.impl_subblock_from_index(dom_[0], idx);
   case 1: return dist1_.impl_subblock_from_index(dom_[1], idx);
   case 2: return dist2_.impl_subblock_from_index(dom_[2], idx);
-  default: assert(false);
   }
 }
 
@@ -577,10 +577,10 @@
 
   switch (d)
   {
+  default: assert(false);
   case 0: return dist0_.impl_local_from_global_index(dom_[0], idx);
   case 1: return dist1_.impl_local_from_global_index(dom_[1], idx);
   case 2: return dist2_.impl_local_from_global_index(dom_[2], idx);
-  default: assert(false);
   }
 }
 
Index: src/vsip/impl/config.hpp
===================================================================
RCS file: /home/cvs/Repository/vpp/src/vsip/impl/config.hpp,v
retrieving revision 1.1
diff -u -r1.1 config.hpp
--- src/vsip/impl/config.hpp	31 Mar 2005 21:10:48 -0000	1.1
+++ src/vsip/impl/config.hpp	14 Nov 2005 15:30:18 -0000
@@ -22,4 +22,12 @@
 #undef PACKAGE_TARNAME
 #undef PACKAGE_VERSION
 
+#if 0
+// Define the macro for those compilers that would complain about
+// missing return statements in non-void functions.
+# define VSIP_IMPL_UNREACHABLE_RETURN(expr) return expr;
+#else
+# define VSIP_IMPL_UNREACHABLE_RETURN(expr)
+#endif
+
 #endif
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 15:30:18 -0000
@@ -620,7 +620,7 @@
   const VSIP_NOTHROW
 {
   VSIP_IMPL_THROW(impl::unimplemented("Cyclic_dist::impl_subblock_from_index()"));
-  return no_subblock;
+  VSIP_IMPL_UNREACHABLE_RETURN(no_subblock)
 }
 
 
@@ -630,7 +630,7 @@
   const VSIP_NOTHROW
 {
   VSIP_IMPL_THROW(impl::unimplemented("Cyclic_dist::impl_local_from_global_index()"));
-  return 0;
+  VSIP_IMPL_UNREACHABLE_RETURN(0)
 }
 
 } // namespace vsip