From d054289f668499d6acea307f14c62d44d35b6840 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 11 Dec 2014 01:04:15 +0100 Subject: options: add slightly more sophistcated mechanism for option deprecation --- options/m_option.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'options/m_option.h') diff --git a/options/m_option.h b/options/m_option.h index 41b1d9ec56..c05e2d760c 100644 --- a/options/m_option.h +++ b/options/m_option.h @@ -65,6 +65,10 @@ extern const m_option_type_t m_option_type_size_box; extern const m_option_type_t m_option_type_chmap; extern const m_option_type_t m_option_type_node; +// Used internally by m_config.c +extern const m_option_type_t m_option_type_alias; +extern const m_option_type_t m_option_type_removed; + // Callback used by m_option_type_print_fn options. typedef void (*m_opt_print_fn)(struct mp_log *log); @@ -679,4 +683,13 @@ extern const char m_option_path_separator; .type = &m_option_type_subconfig, \ .priv = (void*)&subconf) +// If "--name" was removed, but "--newname" has the same semantics. +// It will be redirected, and a warning will be printed on first use. +#define OPT_REPLACED(optname, newname) \ + {.name = optname, .type = &m_option_type_alias, .priv = newname, .offset = -1} + +// "--name" doesn't exist, but inform the user about a replacement with msg. +#define OPT_REMOVED(optname, msg) \ + {.name = optname, .type = &m_option_type_removed, .priv = msg, .offset = -1} + #endif /* MPLAYER_M_OPTION_H */ -- cgit v1.2.3