Minimize includes in expr.h: remove dups, iostream (#219)
authorAndres Noetzli <andres.noetzli@gmail.com>
Tue, 15 Aug 2017 05:46:48 +0000 (22:46 -0700)
committerGitHub <noreply@github.com>
Tue, 15 Aug 2017 05:46:48 +0000 (22:46 -0700)
src/expr/expr_template.cpp
src/expr/expr_template.h
src/expr/mkexpr

index b0611ccbb128ba14dc96814bac1842d8bfe5afeb..9fbdc81d66de2d10055e571de7ac50b91d153bfd 100644 (file)
@@ -15,6 +15,7 @@
  **/
 #include "expr/expr.h"
 
+#include <iostream>
 #include <iterator>
 #include <utility>
 #include <vector>
@@ -31,7 +32,7 @@ ${includes}
 // compiler directs the user to the template file instead of the
 // generated one.  We don't want the user to modify the generated one,
 // since it'll get overwritten on a later build.
-#line 35 "${template}"
+#line 36 "${template}"
 
 using namespace CVC4::kind;
 using namespace std;
index d2ad45dee20ad5c777afa85236733cfab96a1d91..ead50c1abf695fb9e43978ac223e030d30024968 100644 (file)
@@ -27,7 +27,7 @@ ${includes}
 #define __CVC4__EXPR_H
 
 #include <stdint.h>
-#include <iostream>
+#include <iosfwd>
 #include <iterator>
 #include <string>
 #include <unordered_map>
index 60ee758d87968ea67dcc4c277c204d372a1714b6..010ec9a2e01f7878f08ee4268128a052419f7005 100755 (executable)
@@ -218,8 +218,12 @@ function constant {
   lineno=${BASH_LINENO[0]}
   check_theory_seen
 
-  includes="${includes}
+  # Only add include if it is not in the list of includes yet
+  if [[ "${includes}" != *"#include \"$4\""* ]]; then
+    includes="${includes}
 #include \"$4\""
+  fi
+
   mkConst_instantiations="${mkConst_instantiations}
 #line $lineno \"$kf\"
 template <> Expr ExprManager::mkConst($2 const& val);