summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorManoj Gupta <manojgupta@google.com>2016-11-14 11:27:29 -0800
committerchrome-bot <chrome-bot@chromium.org>2016-11-16 07:10:41 -0800
commitb2bc2341978884cf0bde01c1b9de06ea0c092576 (patch)
treef57a59f7132ceceebe2e9f0f1cdbf2dcdb758ee8 /util
parent173d77a63d4a58b5f5ec417c9f8b0e879053419d (diff)
downloadchrome-ec-b2bc2341978884cf0bde01c1b9de06ea0c092576.tar.gz
Fix EC build for latest llvm
BRANCH=none util/ectool.c:1158 merror: taking address of packed member 'size' of class or structure 'ec_params_usb_pd_fw_update' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member] For this case, the pointer is always aligned but clang complains. Workaround using double pointer casts to char and uint. uint32_t *data = &(p->size) + 1; BUG=chromium:665240 TEST=Builds now Change-Id: Ibccf0f6e409b9724fc9e5acf28dde570e9d341e3 Reviewed-on: https://chromium-review.googlesource.com/411384 Commit-Ready: Manoj Gupta <manojgupta@chromium.org> Tested-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Yunlian Jiang <yunlian@chromium.org>
Diffstat (limited to 'util')
-rw-r--r--util/ectool.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/util/ectool.c b/util/ectool.c
index 3ba5804095..07510c529b 100644
--- a/util/ectool.c
+++ b/util/ectool.c
@@ -1155,7 +1155,11 @@ int cmd_flash_pd(int argc, char *argv[])
int rv, fsize, step = 96;
char *e;
char *buf;
- uint32_t *data = &(p->size) + 1;
+ /* Double casting is a workaround to silent clang error.
+ * The pointer is always aligned but clang complains.
+ * https://crbug.com/665240
+ */
+ uint32_t *data = (uint32_t *) ((char *)&(p->size)) + 1;
if (argc < 4) {
fprintf(stderr, "Usage: %s <dev_id> <port> <filename>\n",