summaryrefslogtreecommitdiff
path: root/src/expr
diff options
context:
space:
mode:
authorMorgan Deters <mdeters@gmail.com>2012-07-08 17:36:50 +0000
committerMorgan Deters <mdeters@gmail.com>2012-07-08 17:36:50 +0000
commitc0dcc5ff59473a45864f818cfdda037c0ee4ea12 (patch)
treefba897c7bea5f5a12b65c0818b7c5260f48e0070 /src/expr
parent8b01efc32d61391d8d3cd2aaac0de49cd8e88ecc (diff)
Bugs resolved by this commit: #314, #322, #359, #364, #365.
See below for details. * Fix the "assert" name-collision bug (resolves bug #364). Our identifiers should never be named "assert", as that's a preprocessor definition in <assert.h>, which is often #included indirectly (so simply having a policy of not including <assert.h> isn't good enough---one of our dependences might include it). It was once the case that we didn't have anything named "assert", but "assert()" has now crept back in. Instead, name things "assertFoo()" or similar. Thanks to Tim for the report. To fix this, I've changed some of Dejan's circuit-propagator code from "assert()" to "assertTrue()". Ditto for Andy's explanation manager. Guys, if you prefer a different name in your code, please change it. * Fix the incorrect parsing of lets in SMT-LIBv2 parser (resolves bug #365). Inner lets now shadow outer lets (previously, they incorrectly gave an error). Additionally, while looking at this, I found that a sequential let was implemented rather than a parallel let. This is now fixed. Thanks to Liana for the report. * Remove ANTLR parser generation warnings in CVC parser (resolves bug #314). * There were a lot of Debug lines in bitvectors that had embedded toString() calls. This wasted a LOT of time in debug builds for BV benchmarks (like in "make regress"). Added if(Debug.isOn(...)) guards; much faster now. * Support for building public-facing interface documentation only (as opposed to all internals documentation). Now "make doc" does the public-facing and "make doc-internals" does documentation of everything. (Along with changes to the nightly build script---which will now build and publish both types of Doxygen documentation---this resolves bug #359). * Fix the lambda typechecking bug (resolves bug #322). Thanks to Andy for the report (a long long time ago--sorry). * The default output language for all streams is now based on the current set of Options (if there is one). This has been a constant annoyance, especially when stringstreams are used to construct output. However, it doesn't work for calls from outside the library, so it's mainly an annoyance-fixer for CVC4 library code itself. * Add some CVC4_UNUSED markers to local variables in theory_arith.cpp that are used only in assertions-enabled builds (and thus give warnings in production builds). This was briefly discussed at the meeting this week.
Diffstat (limited to 'src/expr')
-rw-r--r--src/expr/expr_template.h27
-rw-r--r--src/expr/node_manager.cpp6
-rw-r--r--src/expr/type_properties_template.h14
3 files changed, 27 insertions, 20 deletions
diff --git a/src/expr/expr_template.h b/src/expr/expr_template.h
index 5129cd73a..dc82daec4 100644
--- a/src/expr/expr_template.h
+++ b/src/expr/expr_template.h
@@ -36,12 +36,13 @@ ${includes}
#include "util/exception.h"
#include "util/language.h"
#include "util/hash.h"
+#include "util/options.h"
// This is a hack, but an important one: if there's an error, the
// 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 45 "${template}"
+#line 46 "${template}"
namespace CVC4 {
@@ -682,7 +683,12 @@ public:
long& l = out.iword(s_iosIndex);
if(l == 0) {
// set the default print depth on this ostream
- l = s_defaultPrintDepth;
+ if(Options::current() != NULL) {
+ l = Options::current()->defaultExprDepth;
+ }
+ if(l == 0) {
+ l = s_defaultPrintDepth;
+ }
}
return l;
}
@@ -877,9 +883,10 @@ class CVC4_PUBLIC ExprSetLanguage {
/**
* The default language to use, for ostreams that haven't yet had a
- * setlanguage() applied to them.
+ * setlanguage() applied to them and where the current Options
+ * information isn't available.
*/
- static const int s_defaultLanguage = language::output::LANG_AST;
+ static const int s_defaultOutputLanguage = language::output::LANG_AST;
/**
* When this manipulator is used, the setting is stored here.
@@ -902,7 +909,15 @@ public:
if(l == 0) {
// set the default language on this ostream
// (offset by one to detect whether default has been set yet)
- l = s_defaultLanguage + 1;
+ if(Options::current() != NULL) {
+ l = Options::current()->outputLanguage + 1;
+ }
+ if(l <= 0 || l > language::output::LANG_MAX) {
+ // if called from outside the library, we may not have options
+ // available to us at this point (or perhaps the output language
+ // is not set in Options). Default to something reasonable.
+ l = s_defaultOutputLanguage + 1;
+ }
}
return OutputLanguage(l - 1);
}
@@ -942,7 +957,7 @@ public:
${getConst_instantiations}
-#line 946 "${template}"
+#line 961 "${template}"
namespace expr {
diff --git a/src/expr/node_manager.cpp b/src/expr/node_manager.cpp
index a2fddadfc..1abcf398b 100644
--- a/src/expr/node_manager.cpp
+++ b/src/expr/node_manager.cpp
@@ -336,8 +336,7 @@ TypeNode NodeManager::mkPredicateSubtype(Expr lambda)
if(! tn.isPredicateLike() ||
tn.getArgTypes().size() != 1) {
std::stringstream ss;
- ss << Expr::setlanguage(Options::current()->outputLanguage)
- << "expected a predicate of one argument to define predicate subtype, but got type `" << tn << "'";
+ ss << "expected a predicate of one argument to define predicate subtype, but got type `" << tn << "'";
throw TypeCheckingExceptionPrivate(lambdan, ss.str());
}
@@ -357,8 +356,7 @@ TypeNode NodeManager::mkPredicateSubtype(Expr lambda, Expr witness)
if(! tn.isPredicateLike() ||
tn.getArgTypes().size() != 1) {
std::stringstream ss;
- ss << Expr::setlanguage(Options::current()->outputLanguage)
- << "expected a predicate of one argument to define predicate subtype, but got type `" << tn << "'";
+ ss << "expected a predicate of one argument to define predicate subtype, but got type `" << tn << "'";
throw TypeCheckingExceptionPrivate(lambdan, ss.str());
}
diff --git a/src/expr/type_properties_template.h b/src/expr/type_properties_template.h
index 28aa2f884..1e983e86c 100644
--- a/src/expr/type_properties_template.h
+++ b/src/expr/type_properties_template.h
@@ -71,8 +71,6 @@ ${type_cardinalities}
#line 72 "${template}"
default: {
std::stringstream ss;
- ss << Expr::setlanguage(language::toOutputLanguage
- ( Options::current()->inputLanguage ));
ss << "A theory kinds file did not provide a cardinality "
<< "or cardinality computer for type:\n" << typeNode
<< "\nof kind " << k;
@@ -84,7 +82,7 @@ ${type_cardinalities}
inline bool isWellFounded(TypeConstant tc) {
switch(tc) {
${type_constant_wellfoundednesses}
-#line 88 "${template}"
+#line 86 "${template}"
default: {
std::stringstream ss;
ss << "No well-foundedness status known for type constant: " << tc;
@@ -99,11 +97,9 @@ inline bool isWellFounded(TypeNode typeNode) {
case TYPE_CONSTANT:
return isWellFounded(typeNode.getConst<TypeConstant>());
${type_wellfoundednesses}
-#line 103 "${template}"
+#line 101 "${template}"
default: {
std::stringstream ss;
- ss << Expr::setlanguage(language::toOutputLanguage
- ( Options::current()->inputLanguage ));
ss << "A theory kinds file did not provide a well-foundedness "
<< "or well-foundedness computer for type:\n" << typeNode
<< "\nof kind " << k;
@@ -115,7 +111,7 @@ ${type_wellfoundednesses}
inline Node mkGroundTerm(TypeConstant tc) {
switch(tc) {
${type_constant_groundterms}
-#line 119 "${template}"
+#line 115 "${template}"
default: {
std::stringstream ss;
ss << "No ground term known for type constant: " << tc;
@@ -130,11 +126,9 @@ inline Node mkGroundTerm(TypeNode typeNode) {
case TYPE_CONSTANT:
return mkGroundTerm(typeNode.getConst<TypeConstant>());
${type_groundterms}
-#line 134 "${template}"
+#line 130 "${template}"
default: {
std::stringstream ss;
- ss << Expr::setlanguage(language::toOutputLanguage
- ( Options::current()->inputLanguage ));
ss << "A theory kinds file did not provide a ground term "
<< "or ground term computer for type:\n" << typeNode
<< "\nof kind " << k;
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback