Include deprecation info in preprocess-output-macros file

This commit is contained in:
Celtic Minstrel 2021-08-02 00:42:13 -04:00 committed by Celtic Minstrel
parent b1b79bfd14
commit a9dcc25b20

View file

@ -171,6 +171,14 @@ void preproc_define::write(config_writer& writer, const std::string& name) const
writer.write_key_val("textdomain", textdomain);
writer.write_key_val("linenum", std::to_string(linenum));
writer.write_key_val("location", get_location(location));
if(is_deprecated()) {
writer.open_child("deprecated");
writer.write_key_val("level", int(*deprecation_level));
writer.write_key_val("version", deprecation_version.str());
writer.write_key_val("message", deprecation_message);
writer.close_child("deprecated");
}
for(const std::string& arg : arguments) {
write_argument(writer, arg);
@ -190,6 +198,12 @@ void preproc_define::read(const config& cfg)
textdomain = cfg["textdomain"].str();
linenum = cfg["linenum"];
location = cfg["location"].str();
if(auto deprecated = cfg.optional_child("deprecated")) {
deprecation_level = DEP_LEVEL(deprecated.value()["level"].to_int());
deprecation_version = deprecated.value()["version"].str();
deprecation_message = deprecated.value()["message"].str();
}
for(const config& arg : cfg.child_range("argument")) {
read_argument(arg);