config/File: print warning about deprecated options
This commit is contained in:
parent
dcac32a6c4
commit
a82d864c91
@ -116,6 +116,11 @@ ReadConfigBlock(ConfigData &config_data, BufferedReader &reader,
|
||||
const unsigned i = unsigned(o);
|
||||
const ConfigTemplate &option = config_block_templates[i];
|
||||
|
||||
if (option.deprecated)
|
||||
FormatWarning(config_file_domain,
|
||||
"config parameter \"%s\" on line %u is deprecated",
|
||||
name, reader.GetLineNumber());
|
||||
|
||||
if (!option.repeatable)
|
||||
if (const auto *block = config_data.GetBlock(o))
|
||||
throw FormatRuntimeError("config parameter \"%s\" is first defined "
|
||||
@ -143,6 +148,11 @@ ReadConfigParam(ConfigData &config_data, BufferedReader &reader,
|
||||
const unsigned i = unsigned(o);
|
||||
const ConfigTemplate &option = config_param_templates[i];
|
||||
|
||||
if (option.deprecated)
|
||||
FormatWarning(config_file_domain,
|
||||
"config parameter \"%s\" on line %u is deprecated",
|
||||
name, reader.GetLineNumber());
|
||||
|
||||
if (!option.repeatable)
|
||||
if (const auto *param = config_data.GetParam(o))
|
||||
throw FormatRuntimeError("config parameter \"%s\" is first defined "
|
||||
|
@ -24,7 +24,6 @@ struct ConfigTemplate {
|
||||
const char *const name;
|
||||
const bool repeatable;
|
||||
|
||||
// TODO: print warning when a deprecated option is used
|
||||
const bool deprecated;
|
||||
|
||||
constexpr ConfigTemplate(const char *_name,
|
||||
|
Loading…
Reference in New Issue
Block a user