Merge "init: enable C++17" am: e3aef3dd99

am: e4275b52a8

Change-Id: I75ce732b58516e45084845da2c42a65c2b31aed1
This commit is contained in:
Tom Cherry 2017-03-14 17:25:33 +00:00 committed by android-build-merger
commit fdad550029
2 changed files with 6 additions and 8 deletions

View file

@ -17,6 +17,7 @@ init_cflags += \
-Wall -Wextra \
-Wno-unused-parameter \
-Werror \
-std=gnu++1z \
# --

View file

@ -146,8 +146,7 @@ bool Action::ParsePropertyTrigger(const std::string& trigger, std::string* err)
std::string prop_value(prop_name.substr(equal_pos + 1));
prop_name.erase(equal_pos);
auto res = property_triggers_.emplace(prop_name, prop_value);
if (res.second == false) {
if (auto [it, inserted] = property_triggers_.emplace(prop_name, prop_value); !inserted) {
*err = "multiple property triggers found for same property";
return false;
}
@ -212,9 +211,7 @@ bool Action::CheckPropertyTriggers(const std::string& name,
}
bool found = name.empty();
for (const auto& t : property_triggers_) {
const auto& trigger_name = t.first;
const auto& trigger_value = t.second;
for (const auto& [trigger_name, trigger_value] : property_triggers_) {
if (trigger_name == name) {
if (trigger_value != "*" && trigger_value != value) {
return false;
@ -251,10 +248,10 @@ bool Action::TriggersEqual(const Action& other) const {
std::string Action::BuildTriggersString() const {
std::string result;
for (const auto& t : property_triggers_) {
result += t.first;
for (const auto& [trigger_name, trigger_value] : property_triggers_) {
result += trigger_name;
result += '=';
result += t.second;
result += trigger_value;
result += ' ';
}
if (!event_trigger_.empty()) {