1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-28 10:02:17 +00:00

options: add a deprecation warning printing mechanism

We have a warning mechanism for removed and for replaced options, but
none yet for options which have been simply deprecated.

For the following commit.

(Fun fact: just adding the m_option field increases binary size by
14KB.)
This commit is contained in:
wm4 2016-06-29 18:09:30 +02:00
parent c6953bfa8c
commit 9ed5dae480
2 changed files with 11 additions and 0 deletions

View File

@ -499,6 +499,13 @@ struct m_config_option *m_config_get_co(const struct m_config *config,
co->warning_was_printed = true;
}
return NULL;
} else if (co->opt->deprecation_message) {
if (!co->warning_was_printed) {
MP_WARN(config, "Warning: option %s%s is deprecated "
"and might be removed in the future (%s).\n",
prefix, co->name, co->opt->deprecation_message);
co->warning_was_printed = true;
}
}
return co;
}

View File

@ -333,6 +333,10 @@ struct m_option {
// Initialize variable to given default before parsing options
const void *defval;
// Print a warning when this option is used (for options with no direct
// replacement.)
const char *deprecation_message;
};