summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKshitij Bansal <kshitij@cs.nyu.edu>2015-10-13 19:59:22 -0400
committerKshitij Bansal <kshitij@cs.nyu.edu>2016-01-03 12:40:35 -0500
commit4bc07031126a1fa195a05ce1d5f7eca5b55a94da (patch)
tree0e2652afad48e701251357a2dbc2e36ae3a5da9a
parent5c99a9b0fb5f8c0f0aabc8ddcee1cbb93d493eca (diff)
remove options infrastructure code which depended on undefined behavior1.4.x
appears to be source of crashes on mac
-rw-r--r--src/expr/expr_template.h6
-rw-r--r--src/options/options.h5
-rw-r--r--src/printer/printer.h2
3 files changed, 9 insertions, 4 deletions
diff --git a/src/expr/expr_template.h b/src/expr/expr_template.h
index c5e8e77de..3b3233490 100644
--- a/src/expr/expr_template.h
+++ b/src/expr/expr_template.h
@@ -649,7 +649,7 @@ public:
long& l = out.iword(s_iosIndex);
if(l == 0) {
// set the default print depth on this ostream
- if(&Options::current() != NULL) {
+ if(not Options::isCurrentNull()) {
l = options::defaultExprDepth();
}
if(l == 0) {
@@ -801,7 +801,7 @@ public:
if(l == 0) {
// set the default dag setting on this ostream
// (offset by one to detect whether default has been set yet)
- if(&Options::current() != NULL) {
+ if(not Options::isCurrentNull()) {
l = options::defaultDagThresh() + 1;
}
if(l == 0) {
@@ -884,7 +884,7 @@ public:
if(l == 0) {
// set the default language on this ostream
// (offset by one to detect whether default has been set yet)
- if(&Options::current() != NULL) {
+ if(not Options::isCurrentNull()) {
l = options::outputLanguage() + 1;
}
if(l <= 0 || l > language::output::LANG_MAX) {
diff --git a/src/options/options.h b/src/options/options.h
index b41c9a66e..b35ed004c 100644
--- a/src/options/options.h
+++ b/src/options/options.h
@@ -60,6 +60,11 @@ class CVC4_PUBLIC Options {
public:
+ /** Return true if current Options are null */
+ static inline bool isCurrentNull() {
+ return s_current == NULL;
+ }
+
/** Get the current Options in effect */
static inline Options& current() {
return *s_current;
diff --git a/src/printer/printer.h b/src/printer/printer.h
index beb2438e2..c9f6eba51 100644
--- a/src/printer/printer.h
+++ b/src/printer/printer.h
@@ -58,7 +58,7 @@ public:
//
// Options can be null in certain circumstances (e.g., when printing
// the singleton "null" expr. So we guard against segfault
- if(&Options::current() != NULL) {
+ if(not Options::isCurrentNull()) {
if(options::outputLanguage.wasSetByUser()) {
lang = options::outputLanguage();
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback