language.h
open_ostream.cpp
open_ostream.h
+ option_exception.cpp
option_exception.h
options.h
options_handler.cpp
language.h \
open_ostream.cpp \
open_ostream.h \
+ option_exception.cpp \
option_exception.h \
options.h \
options_handler.cpp \
--- /dev/null
+/********************* */
+/*! \file option_exception.h
+ ** \verbatim
+ ** Top contributors (to current version):
+ ** Andres Noetzli
+ ** This file is part of the CVC4 project.
+ ** Copyright (c) 2009-2018 by the authors listed in the file AUTHORS
+ ** in the top-level source directory) and their institutional affiliations.
+ ** All rights reserved. See the file COPYING in the top-level source
+ ** directory for licensing information.\endverbatim
+ **
+ ** \brief Options-related exceptions
+ **
+ ** Options-related exceptions.
+ **/
+
+#include "options/option_exception.h"
+
+namespace CVC4 {
+const std::string OptionException::s_errPrefix = "Error in option parsing: ";
+} // namespace CVC4
*/
class CVC4_PUBLIC OptionException : public CVC4::Exception {
public:
- OptionException(const std::string& s)
- : CVC4::Exception("Error in option parsing: " + s)
+ OptionException(const std::string& s) : CVC4::Exception(s_errPrefix + s) {}
+
+ /**
+ * Get the error message without the prefix that is automatically added for
+ * OptionExceptions.
+ */
+ std::string getRawMessage() const
{
+ return getMessage().substr(s_errPrefix.size());
}
+
+ private:
+ /** The string to be added in front of the actual error message */
+ static const std::string s_errPrefix;
};/* class OptionException */
/**
ListenerCollection::Registration* registration =
collection.registerListener(listener);
if(notify) {
- listener->notify();
+ try
+ {
+ listener->notify();
+ }
+ catch (OptionException& e)
+ {
+ // It can happen that listener->notify() throws an OptionException. In
+ // that case, we have to make sure that we delete the registration of our
+ // listener before rethrowing the exception. Otherwise the
+ // ListenerCollection deconstructor will complain that not all
+ // registrations have been removed before invoking the deconstructor.
+ delete registration;
+ throw OptionException(e.getRawMessage());
+ }
}
return registration;
}
d_listenerRegistrations->add(d_resourceManager->registerHardListener(
new HardResourceOutListener(d_smt)));
- Options& nodeManagerOptions = NodeManager::currentNM()->getOptions();
- d_listenerRegistrations->add(
- nodeManagerOptions.registerForceLogicListener(
- new SetLogicListener(d_smt), true));
-
- // Multiple options reuse BeforeSearchListener so registration requires an
- // extra bit of care.
- // We can safely not call notify on this before search listener at
- // registration time. This d_smt cannot be beforeSearch at construction
- // time. Therefore the BeforeSearchListener is a no-op. Therefore it does
- // not have to be called.
- d_listenerRegistrations->add(
- nodeManagerOptions.registerBeforeSearchListener(
- new BeforeSearchListener(d_smt)));
-
- // These do need registration calls.
- d_listenerRegistrations->add(
- nodeManagerOptions.registerSetDefaultExprDepthListener(
- new SetDefaultExprDepthListener(), true));
- d_listenerRegistrations->add(
- nodeManagerOptions.registerSetDefaultExprDagListener(
- new SetDefaultExprDagListener(), true));
- d_listenerRegistrations->add(
- nodeManagerOptions.registerSetPrintExprTypesListener(
- new SetPrintExprTypesListener(), true));
- d_listenerRegistrations->add(
- nodeManagerOptions.registerSetDumpModeListener(
- new DumpModeListener(), true));
- d_listenerRegistrations->add(
- nodeManagerOptions.registerSetPrintSuccessListener(
- new PrintSuccessListener(), true));
- d_listenerRegistrations->add(
- nodeManagerOptions.registerSetRegularOutputChannelListener(
- new SetToDefaultSourceListener(&d_managedRegularChannel), true));
- d_listenerRegistrations->add(
- nodeManagerOptions.registerSetDiagnosticOutputChannelListener(
- new SetToDefaultSourceListener(&d_managedDiagnosticChannel), true));
- d_listenerRegistrations->add(
- nodeManagerOptions.registerDumpToFileNameListener(
- new SetToDefaultSourceListener(&d_managedDumpChannel), true));
- d_listenerRegistrations->add(
- nodeManagerOptions.registerSetReplayLogFilename(
- new SetToDefaultSourceListener(&d_managedReplayLog), true));
+ try
+ {
+ Options& nodeManagerOptions = NodeManager::currentNM()->getOptions();
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerForceLogicListener(
+ new SetLogicListener(d_smt), true));
+
+ // Multiple options reuse BeforeSearchListener so registration requires an
+ // extra bit of care.
+ // We can safely not call notify on this before search listener at
+ // registration time. This d_smt cannot be beforeSearch at construction
+ // time. Therefore the BeforeSearchListener is a no-op. Therefore it does
+ // not have to be called.
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerBeforeSearchListener(
+ new BeforeSearchListener(d_smt)));
+
+ // These do need registration calls.
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerSetDefaultExprDepthListener(
+ new SetDefaultExprDepthListener(), true));
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerSetDefaultExprDagListener(
+ new SetDefaultExprDagListener(), true));
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerSetPrintExprTypesListener(
+ new SetPrintExprTypesListener(), true));
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerSetDumpModeListener(new DumpModeListener(),
+ true));
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerSetPrintSuccessListener(
+ new PrintSuccessListener(), true));
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerSetRegularOutputChannelListener(
+ new SetToDefaultSourceListener(&d_managedRegularChannel), true));
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerSetDiagnosticOutputChannelListener(
+ new SetToDefaultSourceListener(&d_managedDiagnosticChannel),
+ true));
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerDumpToFileNameListener(
+ new SetToDefaultSourceListener(&d_managedDumpChannel), true));
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerSetReplayLogFilename(
+ new SetToDefaultSourceListener(&d_managedReplayLog), true));
+ }
+ catch (OptionException& e)
+ {
+ // Registering the option listeners can lead to OptionExceptions, e.g.
+ // when the user chooses a dump tag that does not exist. In that case, we
+ // have to make sure that we delete existing listener registrations and
+ // that we unsubscribe from NodeManager events. Otherwise we will have
+ // errors in the deconstructors of the NodeManager (because the
+ // NodeManager tries to notify an SmtEnginePrivate that does not exist)
+ // and the ListenerCollection (because not all registrations have been
+ // removed before calling the deconstructor).
+ delete d_listenerRegistrations;
+ d_smt.d_nodeManager->unsubscribeEvents(this);
+ throw OptionException(e.getRawMessage());
+ }
}
~SmtEnginePrivate()
regress0/bug605.cvc
regress0/bug639.smt2
regress0/buggy-ite.smt2
+ regress0/bv/ackermann1.smt2
+ regress0/bv/ackermann2.smt2
regress0/bv/bool-to-bv.smt2
regress0/bv/bug260a.smt
regress0/bv/bug260b.smt
regress0/datatypes/cdt-non-canon-stream.smt2
regress0/datatypes/coda_simp_model.smt2
regress0/datatypes/conqueue-dt-enum-iloop.smt2
+ regress0/datatypes/data-nested-codata.smt2
regress0/datatypes/datatype.cvc
regress0/datatypes/datatype0.cvc
regress0/datatypes/datatype1.cvc
regress0/fmf/quant_real_univ.cvc
regress0/fmf/sat-logic.smt2
regress0/fmf/sc_bad_model_1221.smt2
+ regress0/fmf/sort-infer-typed-082718.smt2
regress0/fmf/syn002-si-real-int.smt2
regress0/fmf/tail_rec.smt2
+ regress0/fp/ext-rew-test.smt2
regress0/fp/simple.smt2
regress0/fuzz_1.smt
regress0/fuzz_3.smt
regress0/logops.05.cvc
regress0/model-core.smt2
regress0/nl/coeff-sat.smt2
+ regress0/nl/ext-rew-aggr-test.smt2
regress0/nl/magnitude-wrong-1020-m.smt2
regress0/nl/mult-po.smt2
regress0/nl/nia-wrong-tl.smt2
+ regress0/nl/nlExtPurify-test.smt2
regress0/nl/nta/cos-sig-value.smt2
regress0/nl/nta/exp-n0.5-lb.smt2
regress0/nl/nta/exp-n0.5-ub.smt2
regress0/nl/subs0-unsat-confirm.smt2
regress0/nl/very-easy-sat.smt2
regress0/nl/very-simple-unsat.smt2
+ regress0/options/invalid_dump.smt2
regress0/parallel-let.smt2
regress0/parser/as.smt2
regress0/parser/constraint.smt2
regress0/quantifiers/issue1805.smt2
regress0/quantifiers/issue2031-bv-var-elim.smt2
regress0/quantifiers/issue2033-macro-arith.smt2
+ regress0/quantifiers/issue2035.smt2
regress0/quantifiers/lra-triv-gn.smt2
regress0/quantifiers/macros-int-real.smt2
regress0/quantifiers/macros-real-arg.smt2
regress0/simplification_bug2.smt
regress0/smallcnf.cvc
regress0/smt2output.smt2
+ regress0/smtlib/get-unsat-assumptions.smt2
regress0/strings/bug001.smt2
regress0/strings/bug002.smt2
regress0/strings/bug612.smt2
regress0/strings/norn-31.smt2
regress0/strings/norn-simp-rew.smt2
regress0/strings/repl-rewrites2.smt2
+ regress0/strings/rewrites-re-concat.smt2
regress0/strings/rewrites-v2.smt2
regress0/strings/std2.6.1.smt2
regress0/strings/stoi-solve.smt2
regress0/strings/str003.smt2
regress0/strings/str004.smt2
regress0/strings/str005.smt2
+ regress0/strings/str_unsound_ext_rew_eq.smt2
regress0/strings/strings-charat.cvc
regress0/strings/strings-native-simple.cvc
regress0/strings/strip-endpoint-itos.smt2
regress0/sygus/check-generic-red.sy
regress0/sygus/const-var-test.sy
regress0/sygus/dt-no-syntax.sy
+ regress0/sygus/hd-05-d1-prog-nogrammar.sy
regress0/sygus/inv-different-var-order.sy
regress0/sygus/let-ringer.sy
regress0/sygus/let-simp.sy
regress0/wiki.19.cvc
regress0/wiki.20.cvc
regress0/wiki.21.cvc
- regress0/bv/ackermann1.smt2
- regress0/bv/ackermann2.smt2
- regress0/datatypes/data-nested-codata.smt2
- regress0/fmf/sort-infer-typed-082718.smt2
- regress0/fp/ext-rew-test.smt2
- regress0/nl/ext-rew-aggr-test.smt2
- regress0/nl/nlExtPurify-test.smt2
- regress0/quantifiers/issue2035.smt2
- regress0/smtlib/get-unsat-assumptions.smt2
- regress0/strings/rewrites-re-concat.smt2
- regress0/strings/str_unsound_ext_rew_eq.smt2
- regress0/sygus/hd-05-d1-prog-nogrammar.sy
)
#-----------------------------------------------------------------------------#
regress0/arith/bug547.2.smt2 \
regress0/arith/bug569.smt2 \
regress0/arith/delta-minimized-row-vector-bug.smt \
+ regress0/arith/div-chainable.smt2 \
regress0/arith/div.01.smt2 \
regress0/arith/div.02.smt2 \
regress0/arith/div.04.smt2 \
regress0/arith/div.05.smt2 \
regress0/arith/div.07.smt2 \
- regress0/arith/div-chainable.smt2 \
regress0/arith/fuzz_3-eq.smt \
regress0/arith/integers/arith-int-042.cvc \
regress0/arith/integers/arith-int-042.min.cvc \
regress0/datatypes/cdt-non-canon-stream.smt2 \
regress0/datatypes/coda_simp_model.smt2 \
regress0/datatypes/conqueue-dt-enum-iloop.smt2 \
+ regress0/datatypes/data-nested-codata.smt2 \
regress0/datatypes/datatype.cvc \
regress0/datatypes/datatype0.cvc \
regress0/datatypes/datatype1.cvc \
regress0/datatypes/datatype2.cvc \
regress0/datatypes/datatype3.cvc \
regress0/datatypes/datatype4.cvc \
- regress0/datatypes/data-nested-codata.smt2 \
regress0/datatypes/dt-2.6.smt2 \
regress0/datatypes/dt-match-pat-param-2.6.smt2 \
regress0/datatypes/dt-param-2.6.smt2 \
regress0/fmf/sort-infer-typed-082718.smt2 \
regress0/fmf/syn002-si-real-int.smt2 \
regress0/fmf/tail_rec.smt2 \
- regress0/fp/simple.smt2 \
regress0/fp/ext-rew-test.smt2 \
+ regress0/fp/simple.smt2 \
regress0/fuzz_1.smt \
regress0/fuzz_3.smt \
regress0/get-value-incremental.smt2 \
regress0/nl/subs0-unsat-confirm.smt2 \
regress0/nl/very-easy-sat.smt2 \
regress0/nl/very-simple-unsat.smt2 \
+ regress0/options/invalid_dump.smt2 \
regress0/parallel-let.smt2 \
regress0/parser/as.smt2 \
regress0/parser/constraint.smt2 \
regress0/strings/str003.smt2 \
regress0/strings/str004.smt2 \
regress0/strings/str005.smt2 \
+ regress0/strings/str_unsound_ext_rew_eq.smt2 \
regress0/strings/strings-charat.cvc \
regress0/strings/strings-native-simple.cvc \
regress0/strings/strip-endpoint-itos.smt2 \
- regress0/strings/str_unsound_ext_rew_eq.smt2 \
regress0/strings/substr-rewrites.smt2 \
regress0/strings/type001.smt2 \
regress0/strings/unsound-0908.smt2 \
--- /dev/null
+; COMMAND-LINE: --dump invalidDumpTag
+; ERROR-SCRUBBER: grep -o "unknown option for --dump"
+; EXPECT-ERROR: unknown option for --dump
+; EXIT: 1