Skip to content

Commit

Permalink
Include deprecation info in preprocess-output-macros file
Browse files Browse the repository at this point in the history
  • Loading branch information
CelticMinstrel committed Aug 16, 2021
1 parent 606e98e commit 28d8c6a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/serialization/preprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 28d8c6a

Please sign in to comment.