Commit a82d864c authored by Max Kellermann's avatar Max Kellermann

config/File: print warning about deprecated options

parent dcac32a6
...@@ -116,6 +116,11 @@ ReadConfigBlock(ConfigData &config_data, BufferedReader &reader, ...@@ -116,6 +116,11 @@ ReadConfigBlock(ConfigData &config_data, BufferedReader &reader,
const unsigned i = unsigned(o); const unsigned i = unsigned(o);
const ConfigTemplate &option = config_block_templates[i]; 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 (!option.repeatable)
if (const auto *block = config_data.GetBlock(o)) if (const auto *block = config_data.GetBlock(o))
throw FormatRuntimeError("config parameter \"%s\" is first defined " throw FormatRuntimeError("config parameter \"%s\" is first defined "
...@@ -143,6 +148,11 @@ ReadConfigParam(ConfigData &config_data, BufferedReader &reader, ...@@ -143,6 +148,11 @@ ReadConfigParam(ConfigData &config_data, BufferedReader &reader,
const unsigned i = unsigned(o); const unsigned i = unsigned(o);
const ConfigTemplate &option = config_param_templates[i]; 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 (!option.repeatable)
if (const auto *param = config_data.GetParam(o)) if (const auto *param = config_data.GetParam(o))
throw FormatRuntimeError("config parameter \"%s\" is first defined " throw FormatRuntimeError("config parameter \"%s\" is first defined "
......
...@@ -24,7 +24,6 @@ struct ConfigTemplate { ...@@ -24,7 +24,6 @@ struct ConfigTemplate {
const char *const name; const char *const name;
const bool repeatable; const bool repeatable;
// TODO: print warning when a deprecated option is used
const bool deprecated; const bool deprecated;
constexpr ConfigTemplate(const char *_name, constexpr ConfigTemplate(const char *_name,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment