From bd0ddcd5e8794511395bf668833acc5c2da69fb0 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Thu, 4 May 2017 13:03:18 -0700 Subject: Remove EXPAND/STRINGIFY macros. This reverts commit 8be0f39fec7f26164fd0791ff6d15bde65fc849c to reland the change that removes EXPAND/STRINGIFY macros. It's error-prone by putting anything into a string (e.g. EXPAND(RECOVERY_API_VERSION) would become "RECOVER_API_VERSION" if we forgot to pass -DRECOVERY_API_VERSION=3). The initial attempt put RECOVERY_API_VERSION into common.h, which might be included by device-specific codes but without defining that when compiling the module. This CL avoids the issue by using a constant in the header, with a static_assert in recovery.cpp that guards the consistency. Test: recovery_component_test Test: Sideload OTAs on bullhead and sailfish respectively. Change-Id: I12af3f73392a85554ba703f04970ec9d984ccbaa --- common.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'common.h') diff --git a/common.h b/common.h index 62fb1324b..8b336f806 100644 --- a/common.h +++ b/common.h @@ -22,8 +22,9 @@ #include -#define STRINGIFY(x) #x -#define EXPAND(x) STRINGIFY(x) +// Not using the command-line defined macro here because this header could be included by +// device-specific recovery libraries. We static assert the value consistency in recovery.cpp. +static constexpr int kRecoveryApiVersion = 3; class RecoveryUI; -- cgit v1.2.3