[PPL-devel] [GIT] ppl/ppl(pip): Fix compilation problems when assertions are turned on.

Enea Zaffanella zaffanella at cs.unipr.it
Thu Sep 10 16:45:44 CEST 2009


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

Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date:   Thu Sep 10 16:41:24 2009 +0200

Fix compilation problems when assertions are turned on.

---

 src/PIP_Tree.cc      |   24 +++++++++++++++++++-----
 src/PIP_Tree.defs.hh |   10 +++++++++-
 2 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/src/PIP_Tree.cc b/src/PIP_Tree.cc
index 9f039ea..855ad88 100644
--- a/src/PIP_Tree.cc
+++ b/src/PIP_Tree.cc
@@ -23,6 +23,8 @@ site: http://www.cs.unipr.it/ppl/ . */
 #include <ppl-config.h>
 #include "PIP_Tree.defs.hh"
 
+#include <algorithm>
+
 namespace PPL = Parma_Polyhedra_Library;
 
 namespace {
@@ -94,8 +96,20 @@ PIP_Decision_Node::as_decision() {
   return this;
 }
 
+bool
+PIP_Solution_Node::OK() const {
+  /* FIXME: write me! */
+  return true;
+}
+
+bool
+PIP_Decision_Node::OK() const {
+  /* FIXME: write me! */
+  return true;
+}
+
 void
-PIP_Decision_Node::update_tableau(PIP_Tree_Node **parent_ref,
+PIP_Decision_Node::update_tableau(PIP_Tree_Node ** /* parent_ref */,
                                   dimension_type external_space_dim,
                                   dimension_type first_pending_constraint,
                                   const Constraint_Sequence &input_cs,
@@ -124,7 +138,7 @@ PIP_Decision_Node::solve(PIP_Tree_Node **parent_ref,
   stt = true_child->solve(&true_child, context_true);
   if (false_child) {
     // Decision nodes with false child must have exactly one constraint
-    PPL_ASSERT(constraints_.num_rows() == 1);
+    PPL_ASSERT(1 == std::distance(constraints_.begin(), constraints_.end()));
     Constraint_System context_false(context);
     //FIXME: not implemented yet (constraint negation)
     //context_false.insert(!constraints_[0]);
@@ -198,7 +212,7 @@ PIP_Solution_Node::ascii_load(std::istream& s) {
 }
 
 void
-PIP_Solution_Node::update_tableau(PIP_Tree_Node **parent_ref,
+PIP_Solution_Node::update_tableau(PIP_Tree_Node ** /* parent_ref */,
                                   dimension_type external_space_dim,
                                   dimension_type first_pending_constraint,
                                   const Constraint_Sequence &input_cs,
@@ -266,8 +280,8 @@ PIP_Solution_Node::update_tableau(PIP_Tree_Node **parent_ref,
 }
 
 PIP_Problem_Status
-PIP_Solution_Node::solve(PIP_Tree_Node **parent_ref,
-                         const Constraint_System& context) {
+PIP_Solution_Node::solve(PIP_Tree_Node** /* parent_ref */,
+                         const Constraint_System& /* context */) {
   //FIXME
   return OPTIMIZED_PIP_PROBLEM;
 }
diff --git a/src/PIP_Tree.defs.hh b/src/PIP_Tree.defs.hh
index e1555a2..c3c1b4b 100644
--- a/src/PIP_Tree.defs.hh
+++ b/src/PIP_Tree.defs.hh
@@ -26,7 +26,8 @@ site: http://www.cs.unipr.it/ppl/ . */
 #include "PIP_Tree.types.hh"
 #include "Variable.defs.hh"
 #include "Linear_Expression.types.hh"
-#include "Constraint_System.types.hh"
+#include "Constraint_System.defs.hh"
+#include "Constraint_System.inlines.hh"
 #include "Constraint.defs.hh"
 #include "PIP_Problem.types.hh"
 #include "Matrix.defs.hh"
@@ -56,6 +57,9 @@ public:
   //! Destructor.
   virtual ~PIP_Tree_Node();
 
+  //! Returns \c true if and only if \p *this is well formed.
+  virtual bool OK() const = 0;
+
 protected:
   //! A type alias for a sequence of constraints.
   typedef std::vector<Constraint> Constraint_Sequence;
@@ -143,6 +147,8 @@ public:
   void ascii_dump(std::ostream& s) const;
   bool ascii_load(std::istream& s);
 
+  bool OK() const;
+
 private:
   //! A rational matrix, with a common nenominator
   class Rational_Matrix : public Matrix {
@@ -301,6 +307,8 @@ public:
   */
   const Constraint_System& constraints();
 
+  bool OK() const;
+
 private:
   //! Pointer to the "true" child of \p *this.
   PIP_Tree_Node* true_child;




More information about the PPL-devel mailing list