diff options
author | Aina Niemetz <aina.niemetz@gmail.com> | 2021-04-20 11:58:46 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-20 18:58:46 +0000 |
commit | 92fa57d6ec03ea19cf5ef177905ee59f29231e8f (patch) | |
tree | 704f9ef88ac86122358dac4b95300146d03fb35a /src/options/options_template.cpp | |
parent | 1d5a6e4a0773064ca0f1465b5e94a301af4eee2e (diff) |
Add guards to disable clang-format around placeholders in templates. (#6375)
Diffstat (limited to 'src/options/options_template.cpp')
-rw-r--r-- | src/options/options_template.cpp | 59 |
1 files changed, 38 insertions, 21 deletions
diff --git a/src/options/options_template.cpp b/src/options/options_template.cpp index b9b80aa7e..c06a7aab3 100644 --- a/src/options/options_template.cpp +++ b/src/options/options_template.cpp @@ -65,6 +65,7 @@ ${headers_handler}$ using namespace cvc5; using namespace cvc5::options; +// clang-format on namespace cvc5 { @@ -249,7 +250,9 @@ std::string Options::formatThreadOptionException(const std::string& option) { void Options::setListener(OptionsListener* ol) { d_olisten = ol; } +// clang-format off ${custom_handlers}$ +// clang-format on #if defined(CVC5_MUZZLED) || defined(CVC5_COMPETITION_MODE) # define DO_SEMANTIC_CHECKS_BY_DEFAULT false @@ -257,22 +260,26 @@ ${custom_handlers}$ # define DO_SEMANTIC_CHECKS_BY_DEFAULT true #endif /* CVC5_MUZZLED || CVC5_COMPETITION_MODE */ +// clang-format off options::OptionsHolder::OptionsHolder() : ${module_defaults}$ { } +// clang-format on - -static const std::string mostCommonOptionsDescription = "\ +static const std::string mostCommonOptionsDescription = + "\ Most commonly-used cvc5 options:\n" -${help_common}$; - + // clang-format off +${help_common}$ + // clang-format on + ; -static const std::string optionsDescription = mostCommonOptionsDescription + "\n\ -\n\ -Additional cvc5 options:\n" +// clang-format off +static const std::string optionsDescription = + mostCommonOptionsDescription + "\n\nAdditional cvc5 options:\n" ${help_others}$; - +// clang-format on static const std::string optionsFootnote = "\n\ [*] Each of these options has a --no-OPTIONNAME variant, which reverses the\n\ @@ -343,10 +350,11 @@ void Options::printLanguageHelp(std::ostream& out) { * If you add something that has a short option equivalent, you should * add it to the getopt_long() call in parseOptions(). */ +// clang-format off static struct option cmdlineOptions[] = { ${cmdline_options}$ - { NULL, no_argument, NULL, '\0' } -};/* cmdlineOptions */ + {nullptr, no_argument, nullptr, '\0'}}; +// clang-format on namespace options { @@ -469,9 +477,11 @@ void Options::parseOptionsRecursive(Options* options, Debug("options") << "[ before, optind == " << optind << " ]" << std::endl; Debug("options") << "[ argc == " << argc << ", argv == " << argv << " ]" << std::endl; + // clang-format off int c = getopt_long(argc, argv, "+:${options_short}$", cmdlineOptions, NULL); + // clang-format on main_optind = optind; @@ -503,23 +513,24 @@ void Options::parseOptionsRecursive(Options* options, Debug("preemptGetopt") << "processing option " << c << " (`" << char(c) << "'), " << option << std::endl; + // clang-format off switch(c) { ${options_handler}$ - - case ':': + case ':' : // This can be a long or short option, and the way to get at the // name of it is different. - throw OptionException(std::string("option `") + option + - "' missing its required argument"); + throw OptionException(std::string("option `") + option + + "' missing its required argument"); - case '?': - default: - throw OptionException(std::string("can't understand option `") + option + - "'" + suggestCommandLineOptions(option)); + case '?': + default: + throw OptionException(std::string("can't understand option `") + option + + "'" + suggestCommandLineOptions(option)); } } + // clang-format on Debug("options") << "got " << nonoptions->size() << " non-option arguments." << std::endl; @@ -537,10 +548,11 @@ std::string Options::suggestCommandLineOptions(const std::string& optionName) return didYouMean.getMatchAsString(optionName.substr(0, optionName.find('='))); } +// clang-format off static const char* smtOptions[] = { ${options_smt}$ - NULL -};/* smtOptions[] */ + nullptr}; +// clang-format on std::vector<std::string> Options::suggestSmtOptions( const std::string& optionName) @@ -557,15 +569,16 @@ std::vector<std::string> Options::suggestSmtOptions( return suggestions; } +// clang-format off std::vector<std::vector<std::string> > Options::getOptions() const { std::vector< std::vector<std::string> > opts; ${options_getoptions}$ - return opts; } +// clang-format on void Options::setOption(const std::string& key, const std::string& optionarg) { @@ -580,6 +593,7 @@ void Options::setOption(const std::string& key, const std::string& optionarg) } } +// clang-format off void Options::setOptionInternal(const std::string& key, const std::string& optionarg) { @@ -588,7 +602,9 @@ void Options::setOptionInternal(const std::string& key, ${setoption_handlers}$ throw UnrecognizedOptionException(key); } +// clang-format on +// clang-format off std::string Options::getOption(const std::string& key) const { Trace("options") << "Options::getOption(" << key << ")" << std::endl; @@ -596,6 +612,7 @@ std::string Options::getOption(const std::string& key) const throw UnrecognizedOptionException(key); } +// clang-format on #undef USE_EARLY_TYPE_CHECKING_BY_DEFAULT #undef DO_SEMANTIC_CHECKS_BY_DEFAULT |