1 /********************* */
2 /*! \file options_template.cpp
4 ** Top contributors (to current version):
5 ** Tim King, Morgan Deters, Mathias Preiner
6 ** This file is part of the CVC4 project.
7 ** Copyright (c) 2009-2019 by the authors listed in the file AUTHORS
8 ** in the top-level source directory) and their institutional affiliations.
9 ** All rights reserved. See the file COPYING in the top-level source
10 ** directory for licensing information.\endverbatim
12 ** \brief Contains code for handling command-line options.
14 ** Contains code for handling command-line options
17 #if !defined(_BSD_SOURCE) && defined(__MINGW32__) && !defined(__MINGW64__)
18 // force use of optreset; mingw32 croaks on argv-switching otherwise
19 # include "cvc4autoconfig.h"
21 # undef HAVE_DECL_OPTRESET
22 # define HAVE_DECL_OPTRESET 1
23 # define CVC4_IS_NOT_REALLY_BSD
24 #endif /* !_BSD_SOURCE && __MINGW32__ && !__MINGW64__ */
28 #endif /* __MINGW64__ */
33 #ifdef CVC4_IS_NOT_REALLY_BSD
35 #endif /* CVC4_IS_NOT_REALLY_BSD */
51 #include "base/check.h"
52 #include "base/exception.h"
53 #include "base/output.h"
54 #include "options/argument_extender.h"
55 #include "options/argument_extender_implementation.h"
56 #include "options/didyoumean.h"
57 #include "options/language.h"
58 #include "options/options_handler.h"
63 #include "options/options_holder.h"
64 #include "cvc4autoconfig.h"
65 #include "options/base_handlers.h"
71 using namespace CVC4::options
;
75 thread_local Options
* Options::s_current
= NULL
;
80 * This is a default handler for options of built-in C++ type. This
81 * template is really just a helper for the handleOption() template,
82 * below. Variants of this template handle numeric and non-numeric,
83 * integral and non-integral, signed and unsigned C++ types.
84 * handleOption() makes sure to instantiate the right one.
86 * This implements default behavior when e.g. an option is
87 * unsigned but the user specifies a negative argument; etc.
89 template <class T
, bool is_numeric
, bool is_integer
>
90 struct OptionHandler
{
91 static T
handle(std::string option
, std::string optionarg
);
92 };/* struct OptionHandler<> */
94 /** Variant for integral C++ types */
96 struct OptionHandler
<T
, true, true> {
97 static bool stringToInt(T
& t
, const std::string
& str
) {
98 std::istringstream
ss(str
);
101 return !(ss
.fail() || ss
.get(tmp
));
104 static bool containsMinus(const std::string
& str
) {
105 return str
.find('-') != std::string::npos
;
108 static T
handle(const std::string
& option
, const std::string
& optionarg
) {
111 bool success
= stringToInt(i
, optionarg
);
114 throw OptionException(option
+ ": failed to parse "+ optionarg
+
115 " as an integer of the appropriate type.");
118 // Depending in the platform unsigned numbers with '-' signs may parse.
119 // Reject these by looking for any minus if it is not signed.
120 if( (! std::numeric_limits
<T
>::is_signed
) && containsMinus(optionarg
) ) {
121 // unsigned type but user gave negative argument
122 throw OptionException(option
+ " requires a nonnegative argument");
123 } else if(i
< std::numeric_limits
<T
>::min()) {
124 // negative overflow for type
125 std::stringstream ss
;
126 ss
<< option
<< " requires an argument >= "
127 << std::numeric_limits
<T
>::min();
128 throw OptionException(ss
.str());
129 } else if(i
> std::numeric_limits
<T
>::max()) {
130 // positive overflow for type
131 std::stringstream ss
;
132 ss
<< option
<< " requires an argument <= "
133 << std::numeric_limits
<T
>::max();
134 throw OptionException(ss
.str());
139 // if(std::numeric_limits<T>::is_signed) {
140 // return T(i.getLong());
142 // return T(i.getUnsignedLong());
144 } catch(std::invalid_argument
&) {
145 // user gave something other than an integer
146 throw OptionException(option
+ " requires an integer argument");
149 };/* struct OptionHandler<T, true, true> */
151 /** Variant for numeric but non-integral C++ types */
153 struct OptionHandler
<T
, true, false> {
154 static T
handle(std::string option
, std::string optionarg
) {
155 std::stringstream
in(optionarg
);
159 // we didn't consume the whole string (junk at end)
160 throw OptionException(option
+ " requires a numeric argument");
163 if(! std::numeric_limits
<T
>::is_signed
&& r
< 0.0) {
164 // unsigned type but user gave negative value
165 throw OptionException(option
+ " requires a nonnegative argument");
166 } else if(r
< -std::numeric_limits
<T
>::max()) {
167 // negative overflow for type
168 std::stringstream ss
;
169 ss
<< option
<< " requires an argument >= "
170 << -std::numeric_limits
<T
>::max();
171 throw OptionException(ss
.str());
172 } else if(r
> std::numeric_limits
<T
>::max()) {
173 // positive overflow for type
174 std::stringstream ss
;
175 ss
<< option
<< " requires an argument <= "
176 << std::numeric_limits
<T
>::max();
177 throw OptionException(ss
.str());
182 };/* struct OptionHandler<T, true, false> */
184 /** Variant for non-numeric C++ types */
186 struct OptionHandler
<T
, false, false> {
187 static T
handle(std::string option
, std::string optionarg
) {
188 T::unsupported_handleOption_call___please_write_me
;
189 // The above line causes a compiler error if this version of the template
190 // is ever instantiated (meaning that a specialization is missing). So
191 // don't worry about the segfault in the next line, the "return" is only
192 // there to keep the compiler from giving additional, distracting errors
196 };/* struct OptionHandler<T, false, false> */
198 /** Handle an option of type T in the default way. */
200 T
handleOption(std::string option
, std::string optionarg
) {
201 return OptionHandler
<T
, std::numeric_limits
<T
>::is_specialized
, std::numeric_limits
<T
>::is_integer
>::handle(option
, optionarg
);
204 /** Handle an option of type std::string in the default way. */
206 std::string handleOption
<std::string
>(std::string option
, std::string optionarg
) {
211 * Run handler, and any user-given predicates, for option T.
212 * If a user specifies a :handler or :predicates, it overrides this.
215 typename
T::type
runHandlerAndPredicates(T
, std::string option
, std::string optionarg
, options::OptionsHandler
* handler
) {
216 // By default, parse the option argument in a way appropriate for its type.
217 // E.g., for "unsigned int" options, ensure that the provided argument is
218 // a nonnegative integer that fits in the unsigned int type.
220 return handleOption
<typename
T::type
>(option
, optionarg
);
224 void runBoolPredicates(T
, std::string option
, bool b
, options::OptionsHandler
* handler
) {
225 // By default, nothing to do for bool. Users add things with
226 // :predicate in options files to provide custom checking routines
227 // that can throw exceptions.
232 : d_holder(new options::OptionsHolder())
233 , d_handler(new options::OptionsHandler(this))
234 , d_beforeSearchListeners()
235 , d_tlimitListeners()
236 , d_tlimitPerListeners()
237 , d_rlimitListeners()
238 , d_rlimitPerListeners()
241 Options::~Options() {
246 void Options::copyValues(const Options
& options
){
247 if(this != &options
) {
249 d_holder
= new options::OptionsHolder(*options
.d_holder
);
253 std::string
Options::formatThreadOptionException(const std::string
& option
) {
254 std::stringstream ss
;
255 ss
<< "can't understand option `" << option
256 << "': expected something like --threadN=\"--option1 --option2\","
257 << " where N is a nonnegative integer";
261 ListenerCollection::Registration
* Options::registerAndNotify(
262 ListenerCollection
& collection
, Listener
* listener
, bool notify
)
264 ListenerCollection::Registration
* registration
=
265 collection
.registerListener(listener
);
271 catch (OptionException
& e
)
273 // It can happen that listener->notify() throws an OptionException. In
274 // that case, we have to make sure that we delete the registration of our
275 // listener before rethrowing the exception. Otherwise the
276 // ListenerCollection deconstructor will complain that not all
277 // registrations have been removed before invoking the deconstructor.
279 throw OptionException(e
.getRawMessage());
285 ListenerCollection::Registration
* Options::registerBeforeSearchListener(
288 return d_beforeSearchListeners
.registerListener(listener
);
291 ListenerCollection::Registration
* Options::registerTlimitListener(
292 Listener
* listener
, bool notifyIfSet
)
294 bool notify
= notifyIfSet
&&
295 wasSetByUser(options::cumulativeMillisecondLimit
);
296 return registerAndNotify(d_tlimitListeners
, listener
, notify
);
299 ListenerCollection::Registration
* Options::registerTlimitPerListener(
300 Listener
* listener
, bool notifyIfSet
)
302 bool notify
= notifyIfSet
&& wasSetByUser(options::perCallMillisecondLimit
);
303 return registerAndNotify(d_tlimitPerListeners
, listener
, notify
);
306 ListenerCollection::Registration
* Options::registerRlimitListener(
307 Listener
* listener
, bool notifyIfSet
)
309 bool notify
= notifyIfSet
&& wasSetByUser(options::cumulativeResourceLimit
);
310 return registerAndNotify(d_rlimitListeners
, listener
, notify
);
313 ListenerCollection::Registration
* Options::registerRlimitPerListener(
314 Listener
* listener
, bool notifyIfSet
)
316 bool notify
= notifyIfSet
&& wasSetByUser(options::perCallResourceLimit
);
317 return registerAndNotify(d_rlimitPerListeners
, listener
, notify
);
320 ListenerCollection::Registration
* Options::registerSetDefaultExprDepthListener(
321 Listener
* listener
, bool notifyIfSet
)
323 bool notify
= notifyIfSet
&& wasSetByUser(options::defaultExprDepth
);
324 return registerAndNotify(d_setDefaultExprDepthListeners
, listener
, notify
);
327 ListenerCollection::Registration
* Options::registerSetDefaultExprDagListener(
328 Listener
* listener
, bool notifyIfSet
)
330 bool notify
= notifyIfSet
&& wasSetByUser(options::defaultDagThresh
);
331 return registerAndNotify(d_setDefaultDagThreshListeners
, listener
, notify
);
334 ListenerCollection::Registration
* Options::registerSetPrintExprTypesListener(
335 Listener
* listener
, bool notifyIfSet
)
337 bool notify
= notifyIfSet
&& wasSetByUser(options::printExprTypes
);
338 return registerAndNotify(d_setPrintExprTypesListeners
, listener
, notify
);
341 ListenerCollection::Registration
* Options::registerSetDumpModeListener(
342 Listener
* listener
, bool notifyIfSet
)
344 bool notify
= notifyIfSet
&& wasSetByUser(options::dumpModeString
);
345 return registerAndNotify(d_setDumpModeListeners
, listener
, notify
);
348 ListenerCollection::Registration
* Options::registerSetPrintSuccessListener(
349 Listener
* listener
, bool notifyIfSet
)
351 bool notify
= notifyIfSet
&& wasSetByUser(options::printSuccess
);
352 return registerAndNotify(d_setPrintSuccessListeners
, listener
, notify
);
355 ListenerCollection::Registration
* Options::registerDumpToFileNameListener(
356 Listener
* listener
, bool notifyIfSet
)
358 bool notify
= notifyIfSet
&& wasSetByUser(options::dumpToFileName
);
359 return registerAndNotify(d_dumpToFileListeners
, listener
, notify
);
362 ListenerCollection::Registration
*
363 Options::registerSetRegularOutputChannelListener(
364 Listener
* listener
, bool notifyIfSet
)
366 bool notify
= notifyIfSet
&& wasSetByUser(options::regularChannelName
);
367 return registerAndNotify(d_setRegularChannelListeners
, listener
, notify
);
370 ListenerCollection::Registration
*
371 Options::registerSetDiagnosticOutputChannelListener(
372 Listener
* listener
, bool notifyIfSet
)
374 bool notify
= notifyIfSet
&& wasSetByUser(options::diagnosticChannelName
);
375 return registerAndNotify(d_setDiagnosticChannelListeners
, listener
, notify
);
382 # define USE_EARLY_TYPE_CHECKING_BY_DEFAULT true
383 #else /* CVC4_DEBUG */
384 # define USE_EARLY_TYPE_CHECKING_BY_DEFAULT false
385 #endif /* CVC4_DEBUG */
387 #if defined(CVC4_MUZZLED) || defined(CVC4_COMPETITION_MODE)
388 # define DO_SEMANTIC_CHECKS_BY_DEFAULT false
389 #else /* CVC4_MUZZLED || CVC4_COMPETITION_MODE */
390 # define DO_SEMANTIC_CHECKS_BY_DEFAULT true
391 #endif /* CVC4_MUZZLED || CVC4_COMPETITION_MODE */
393 options::OptionsHolder::OptionsHolder() :
399 static const std::string mostCommonOptionsDescription
= "\
400 Most commonly-used CVC4 options:\n"
404 static const std::string optionsDescription
= mostCommonOptionsDescription
+ "\n\
406 Additional CVC4 options:\n"
410 static const std::string optionsFootnote
= "\n\
411 [*] Each of these options has a --no-OPTIONNAME variant, which reverses the\n\
412 sense of the option.\n\
415 static const std::string languageDescription
=
417 Languages currently supported as arguments to the -L / --lang option:\n\
418 auto attempt to automatically determine language\n\
419 cvc4 | presentation | pl CVC4 presentation language\n\
420 smt | smtlib | smt2 |\n\
421 smt2.0 | smtlib2 | smtlib2.0 SMT-LIB format 2.0\n\
422 smt2.5 | smtlib2.5 SMT-LIB format 2.5\n\
423 smt2.6 | smtlib2.6 SMT-LIB format 2.6\n\
424 smt2.6.1 | smtlib2.6.1 SMT-LIB format 2.6 with support for the strings standard\n\
425 tptp TPTP format (cnf, fof and tff)\n\
426 sygus | sygus2 SyGuS version 1.0 and 2.0 formats\n\
428 Languages currently supported as arguments to the --output-lang option:\n\
429 auto match output language to input language\n\
430 cvc4 | presentation | pl CVC4 presentation language\n\
431 cvc3 CVC3 presentation language\n\
432 smt | smtlib | smt2 |\n\
433 smt2.0 | smtlib2.0 | smtlib2 SMT-LIB format 2.0\n\
434 smt2.5 | smtlib2.5 SMT-LIB format 2.5\n\
435 smt2.6 | smtlib2.6 SMT-LIB format 2.6\n\
436 smt2.6.1 | smtlib2.6.1 SMT-LIB format 2.6 with support for the strings standard\n\
438 z3str SMT-LIB 2.0 with Z3-str string constraints\n\
439 ast internal format (simple syntax trees)\n\
442 std::string
Options::getDescription() const {
443 return optionsDescription
;
446 void Options::printUsage(const std::string msg
, std::ostream
& out
) {
447 out
<< msg
<< optionsDescription
<< std::endl
448 << optionsFootnote
<< std::endl
<< std::flush
;
451 void Options::printShortUsage(const std::string msg
, std::ostream
& out
) {
452 out
<< msg
<< mostCommonOptionsDescription
<< std::endl
453 << optionsFootnote
<< std::endl
454 << "For full usage, please use --help."
455 << std::endl
<< std::endl
<< std::flush
;
458 void Options::printLanguageHelp(std::ostream
& out
) {
459 out
<< languageDescription
<< std::flush
;
463 * This is a table of long options. By policy, each short option
464 * should have an equivalent long option (but the reverse isn't the
465 * case), so this table should thus contain all command-line options.
467 * Each option in this array has four elements:
469 * 1. the long option string
470 * 2. argument behavior for the option:
471 * no_argument - no argument permitted
472 * required_argument - an argument is expected
473 * optional_argument - an argument is permitted but not required
474 * 3. this is a pointer to an int which is set to the 4th entry of the
475 * array if the option is present; or NULL, in which case
476 * getopt_long() returns the 4th entry
477 * 4. the return value for getopt_long() when this long option (or the
478 * value to set the 3rd entry to; see #3)
480 * If you add something here, you should add it in src/main/usage.h
481 * also, to document it.
483 * If you add something that has a short option equivalent, you should
484 * add it to the getopt_long() call in parseOptions().
486 static struct option cmdlineOptions
[] = {
488 { NULL
, no_argument
, NULL
, '\0' }
489 };/* cmdlineOptions */
492 // static void preemptGetopt(int& argc, char**& argv, const char* opt) {
494 // Debug("preemptGetopt") << "preempting getopt() with " << opt << std::endl;
496 // AlwaysAssert(opt != NULL && *opt != '\0');
497 // AlwaysAssert(strlen(opt) <= maxoptlen);
501 // while(argv[i] != NULL && argv[i][0] != '\0') {
505 // if(argv[i] == NULL) {
506 // argv = (char**) realloc(argv, (i + 6) * sizeof(char*));
507 // for(unsigned j = i; j < i + 5; ++j) {
508 // argv[j] = (char*) malloc(sizeof(char) * maxoptlen);
509 // argv[j][0] = '\0';
511 // argv[i + 5] = NULL;
514 // strncpy(argv[i], opt, maxoptlen - 1);
515 // argv[i][maxoptlen - 1] = '\0'; // ensure NUL-termination even on overflow
520 /** Set a given Options* as "current" just for a particular scope. */
525 OptionsGuard(Options
** field
, Options
* opts
) :
533 };/* class OptionsGuard */
535 }/* CVC4::options namespace */
538 * Parse argc/argv and put the result into a CVC4::Options.
539 * The return value is what's left of the command line (that is, the
540 * non-option arguments).
542 * Throws OptionException on failures.
544 std::vector
<std::string
> Options::parseOptions(Options
* options
,
548 Assert(options
!= NULL
);
549 Assert(argv
!= NULL
);
551 options::OptionsGuard
guard(&s_current
, options
);
553 const char *progName
= argv
[0];
555 // To debug options parsing, you may prefer to simply uncomment this
556 // and recompile. Debug flags have not been parsed yet so these have
558 //DebugChannel.on("options");
560 Debug("options") << "Options::parseOptions == " << options
<< std::endl
;
561 Debug("options") << "argv == " << argv
<< std::endl
;
563 // Find the base name of the program.
564 const char *x
= strrchr(progName
, '/');
568 options
->d_holder
->binary_name
= std::string(progName
);
570 ArgumentExtender
* argumentExtender
= new ArgumentExtenderImplementation();
571 for(int position
= 1; position
< argc
; position
++) {
572 argumentExtender
->pushBackArgument(argv
[position
]);
575 std::vector
<std::string
> nonoptions
;
576 parseOptionsRecursive(options
, argumentExtender
, &nonoptions
);
577 if(Debug
.isOn("options")){
578 for(std::vector
<std::string
>::const_iterator i
= nonoptions
.begin(),
579 iend
= nonoptions
.end(); i
!= iend
; ++i
){
580 Debug("options") << "nonoptions " << *i
<< std::endl
;
584 delete argumentExtender
;
588 void Options::parseOptionsRecursive(Options
* options
,
589 ArgumentExtender
* extender
,
590 std::vector
<std::string
>* nonoptions
)
595 extender
->movePreemptionsToArguments();
596 extender
->pushFrontArgument("");
597 extender
->getArguments(&argc
, &argv
);
599 if(Debug
.isOn("options")) {
600 Debug("options") << "starting a new parseOptionsRecursive with "
601 << argc
<< " arguments" << std::endl
;
602 for( int i
= 0; i
< argc
; i
++ ){
603 Assert(argv
[i
] != NULL
);
604 Debug("options") << " argv[" << i
<< "] = " << argv
[i
] << std::endl
;
608 // Having this synonym simplifies the generation code in mkoptions.
609 options::OptionsHandler
* handler
= options
->d_handler
;
611 // Reset getopt(), in the case of multiple calls to parseOptions().
612 // This can be = 1 in newer GNU getopt, but older (< 2007) require = 0.
614 #if HAVE_DECL_OPTRESET
615 optreset
= 1; // on BSD getopt() (e.g. Mac OS), might need this
616 #endif /* HAVE_DECL_OPTRESET */
623 while(true) { // Repeat Forever
625 if(extender
->hasPreemptions()){
626 // Stop this round of parsing. We now parse recursively
627 // to start on a new character array for argv.
628 parseOptionsRecursive(options
, extender
, nonoptions
);
633 std::string option
, optionarg
;
635 optind
= main_optind
;
636 old_optind
= main_optind
;
637 //optind_ref = &main_optind;
640 // If we encounter an element that is not at zero and does not start
641 // with a "-", this is a non-option. We consume this element as a
643 if (main_optind
> 0 && main_optind
< argc
&&
644 argv
[main_optind
][0] != '-') {
645 Debug("options") << "enqueueing " << argv
[main_optind
]
646 << " as a non-option." << std::endl
;
647 nonoptions
->push_back(argv
[main_optind
]);
649 extender
->popFrontArgument();
654 Debug("options") << "[ before, main_optind == " << main_optind
<< " ]"
656 Debug("options") << "[ before, optind == " << optind
<< " ]" << std::endl
;
657 Debug("options") << "[ argc == " << argc
<< ", argv == " << argv
<< " ]"
659 int c
= getopt_long(argc
, argv
,
660 "+:${options_short}$",
661 cmdlineOptions
, NULL
);
663 while(main_optind
< optind
) {
665 extender
->popFrontArgument();
668 Debug("options") << "[ got " << int(c
) << " (" << char(c
) << ") ]"
669 << "[ next option will be at pos: " << optind
<< " ]"
672 // The initial getopt_long call should always determine that argv[0]
673 // is not an option and returns -1. We always manually advance beyond
676 // We have to reinitialize optind to 0 instead of 1 as we need to support
677 // changing the argv array passed to getopt.
678 // This is needed as are using GNU extensions.
679 // From: http://man7.org/linux/man-pages/man3/getopt.3.html
680 // A program that scans multiple argument vectors, or rescans the same
681 // vector more than once, and wants to make use of GNU extensions such
682 // as '+' and '-' at the start of optstring, or changes the value of
683 // POSIXLY_CORRECT between scans, must reinitialize getopt() by
684 // resetting optind to 0, rather than the traditional value of 1.
685 // (Resetting to 0 forces the invocation of an internal initialization
686 // routine that rechecks POSIXLY_CORRECT and checks for GNU extensions
688 if ( old_optind
== 0 && c
== -1 ) {
689 Assert(main_optind
> 0);
694 if(Debug
.isOn("options")) {
695 Debug("options") << "done with option parsing" << std::endl
;
696 for(int index
= optind
; index
< argc
; ++index
) {
697 Debug("options") << "remaining " << argv
[index
] << std::endl
;
703 option
= argv
[old_optind
== 0 ? 1 : old_optind
];
704 optionarg
= (optarg
== NULL
) ? "" : optarg
;
706 Debug("preemptGetopt") << "processing option " << c
707 << " (`" << char(c
) << "'), " << option
<< std::endl
;
714 // This can be a long or short option, and the way to get at the
715 // name of it is different.
716 throw OptionException(std::string("option `") + option
+
717 "' missing its required argument");
721 throw OptionException(std::string("can't understand option `") + option
+
722 "'" + suggestCommandLineOptions(option
));
726 Debug("options") << "got " << nonoptions
->size()
727 << " non-option arguments." << std::endl
;
732 std::string
Options::suggestCommandLineOptions(const std::string
& optionName
)
734 DidYouMean didYouMean
;
737 for(size_t i
= 0; (opt
= cmdlineOptions
[i
].name
) != NULL
; ++i
) {
738 didYouMean
.addWord(std::string("--") + cmdlineOptions
[i
].name
);
741 return didYouMean
.getMatchAsString(optionName
.substr(0, optionName
.find('=')));
744 static const char* smtOptions
[] = {
749 std::vector
<std::string
> Options::suggestSmtOptions(
750 const std::string
& optionName
)
752 std::vector
<std::string
> suggestions
;
755 for(size_t i
= 0; (opt
= smtOptions
[i
]) != NULL
; ++i
) {
756 if(std::strstr(opt
, optionName
.c_str()) != NULL
) {
757 suggestions
.push_back(opt
);
764 std::vector
<std::vector
<std::string
> > Options::getOptions() const
766 std::vector
< std::vector
<std::string
> > opts
;
768 $
{options_getoptions
}$
774 void Options::setOption(const std::string
& key
, const std::string
& optionarg
)
776 options::OptionsHandler
* handler
= d_handler
;
777 Options
*options
= Options::current();
778 Trace("options") << "SMT setOption(" << key
<< ", " << optionarg
<< ")"
781 $
{setoption_handlers
}$
784 throw UnrecognizedOptionException(key
);
787 std::string
Options::getOption(const std::string
& key
) const
789 Trace("options") << "SMT getOption(" << key
<< ")" << std::endl
;
791 $
{getoption_handlers
}$
794 throw UnrecognizedOptionException(key
);
797 #undef USE_EARLY_TYPE_CHECKING_BY_DEFAULT
798 #undef DO_SEMANTIC_CHECKS_BY_DEFAULT