From e1d5982202bebb794d8bd28833efb0b31642744f Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Thu, 21 Oct 2021 21:55:29 +0000 Subject: tree: Work around clang bug clang warns: error: initializer element is not a compile-time constant There is an upstream LLVM review with proposed fix: https://reviews.llvm.org/D76096. In the meantime, we will work around it. BRANCH=none BUG=b:172020503, b:202062363 TEST=./util/compare_builds.sh -b all -j 120 => MATCH Signed-off-by: Tom Hughes Change-Id: I066e082870bcd726555a5f2461f09988d4e6ce55 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3237042 Reviewed-by: Aseda Aboagye --- board/magolor/board.c | 58 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 24 deletions(-) (limited to 'board/magolor') diff --git a/board/magolor/board.c b/board/magolor/board.c index 75c965b2e0..3d3765dbe0 100644 --- a/board/magolor/board.c +++ b/board/magolor/board.c @@ -336,31 +336,41 @@ const struct temp_sensor_t temp_sensors[] = { }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); -const static struct ec_thermal_config thermal_a = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = C_TO_K(85), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = 0, - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_A \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A; -const static struct ec_thermal_config thermal_b = { - .temp_host = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(73), - [EC_TEMP_THRESH_HALT] = C_TO_K(85), - }, - .temp_host_release = { - [EC_TEMP_THRESH_WARN] = 0, - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - [EC_TEMP_THRESH_HALT] = 0, - }, -}; +/* + * TODO(b/202062363): Remove when clang is fixed. + */ +#define THERMAL_B \ + { \ + .temp_host = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(73), \ + [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ + }, \ + .temp_host_release = { \ + [EC_TEMP_THRESH_WARN] = 0, \ + [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \ + [EC_TEMP_THRESH_HALT] = 0, \ + }, \ + } +__maybe_unused static const struct ec_thermal_config thermal_b = THERMAL_B; struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT]; -- cgit v1.2.1