update_engine: Fix field assignment order, for compiler warning.
The latest llvm compiler version (r370808), to which we are about to
upgrade Chrome OS, introduces a new warning, -Wreorder-init-list, which
complains if struct field assignments at initialization occur in a
different order than their declartion order. This CL fixes a build
error in the ChromeOS UnitTest stage that is uncovered by this warning.
BUG=chromium:1006866
TEST=compilation works with this fix, with new compiler
Change-Id: Id48ae7b24345d960313eaa03ce58378065a9316e
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/1818788
Tested-by: Caroline Tice <cmtice@chromium.org>
Commit-Queue: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
diff --git a/update_status_utils_unittest.cc b/update_status_utils_unittest.cc
index 3af30c7..e3dd037 100644
--- a/update_status_utils_unittest.cc
+++ b/update_status_utils_unittest.cc
@@ -25,14 +25,16 @@
namespace chromeos_update_engine {
TEST(UpdateStatusUtilsTest, UpdateEngineStatusToStringTest) {
+ // Keep field assignments in same order as they were declared,
+ // to prevent compiler warning, -Wreorder-init-fields.
update_engine::UpdateEngineStatus update_engine_status = {
- .status = update_engine::UpdateStatus::CHECKING_FOR_UPDATE,
- .is_install = true,
- .is_enterprise_rollback = true,
.last_checked_time = 156000000,
+ .status = update_engine::UpdateStatus::CHECKING_FOR_UPDATE,
+ .progress = 0.5,
.new_size_bytes = 888,
.new_version = "12345.0.0",
- .progress = 0.5,
+ .is_enterprise_rollback = true,
+ .is_install = true,
};
string print =
R"(CURRENT_OP=UPDATE_STATUS_CHECKING_FOR_UPDATE