[PPL-devel] [GIT] ppl/ppl(master): When dumping Linear_Row:: Flags with assertions turned off,

Enea Zaffanella zaffanella at cs.unipr.it
Fri Apr 6 10:44:13 CEST 2012


Module: ppl/ppl
Branch: master
Commit: b406ba2b5a15f5b1b8fa011034d9de64af012536
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=b406ba2b5a15f5b1b8fa011034d9de64af012536

Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date:   Fri Apr  6 10:19:18 2012 +0200

When dumping Linear_Row::Flags with assertions turned off,
force the (unavailable) rpi/nnc validity bits as "set".

---

 src/Linear_Row.cc |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/src/Linear_Row.cc b/src/Linear_Row.cc
index 5a5de51..a3646c4 100644
--- a/src/Linear_Row.cc
+++ b/src/Linear_Row.cc
@@ -152,14 +152,26 @@ const char* bit_names[] = {rpi_valid, is_rpi, nnc_valid, is_nnc};
 
 void
 PPL::Linear_Row::Flags::ascii_dump(std::ostream& s) const {
+#ifndef NDEBUG
   s << (test_bits(1U << Flags::rpi_validity_bit) ? '+' : '-')
-    << rpi_valid << ' '
-    << (test_bits(1U << Flags::rpi_bit) ? '+' : '-')
+    << rpi_valid << ' ';
+#else
+  // NOTE: dump the (unavailable) validity bit as set to avoid
+  // crashes when ascii_loading with assertions turned on.
+  s << '+' << rpi_valid << ' ';
+#endif
+  s << (test_bits(1U << Flags::rpi_bit) ? '+' : '-')
     << is_rpi << ' '
-    << ' '
-    << (test_bits(1U << Flags::nnc_validity_bit) ? '+' : '-')
-    << nnc_valid << ' '
-    << (test_bits(1U << Flags::nnc_bit) ? '+' : '-')
+    << ' ';
+#ifndef NDEBUG
+  s << (test_bits(1U << Flags::nnc_validity_bit) ? '+' : '-')
+    << nnc_valid << ' ';
+#else
+  // NOTE: dump the (unavailable) validity bit as set to avoid
+  // crashes when ascii_loading with assertions turned on.
+  s << '+' << nnc_valid << ' ';
+#endif
+  s << (test_bits(1U << Flags::nnc_bit) ? '+' : '-')
     << is_nnc;
 }
 




More information about the PPL-devel mailing list