From 875d16f878a8b4a67ca7d2e6ca4549cea9392e81 Mon Sep 17 00:00:00 2001 From: Hyotaek Shim Date: Thu, 10 Feb 2022 17:35:02 +0900 Subject: [PATCH] Fix build errors -Wno-error=unused-result is applied to tests/logger since it's a test module. [ 160s] logger.c: In function 'dump_logger': [ 160s] logger.c:33:27: error: initialization of 'struct logger_entry *' from incompatible pointer type 'char *' [-Werror=incompatible-pointer-types] [ 160s] 33 | struct logger_entry *e = buf; ... [ 160s] logger.c: In function 'tstart': [ 160s] logger.c:24:2: error: ignoring return value of 'write', declared with attribute warn_unused_result [-Werror=unused-result] [ 160s] 24 | write(*fd, "child thread msg #1\nchild thread msg #2", 39); [ 160s] | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ... Change-Id: I1496c7591031e3c61c3b3646712d641bdbdbdfe9 Signed-off-by: Hyotaek Shim --- tests/logger/Makefile | 1 + tests/logger/logger.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/logger/Makefile b/tests/logger/Makefile index 2faf0a7..8c71503 100644 --- a/tests/logger/Makefile +++ b/tests/logger/Makefile @@ -2,6 +2,7 @@ CC := $(CROSS_COMPILE)gcc CFLAGS += -I../../include/uapi CFLAGS += -std=gnu99 CFLAGS += -D_GNU_SOURCE +CFLAGS += -Wno-error=unused-result LDFLAGS = -pthread .PHONY: all clean diff --git a/tests/logger/logger.c b/tests/logger/logger.c index bd1637c..0277ed6 100644 --- a/tests/logger/logger.c +++ b/tests/logger/logger.c @@ -30,7 +30,7 @@ int dump_logger(const char *device) int fd; int ret = 0; char buf[sizeof(struct logger_entry) + LOGGER_ENTRY_MAX_PAYLOAD]; - struct logger_entry *e = buf; + struct logger_entry *e = (struct logger_entry *)buf; int version = 2; fd = open(device, O_RDONLY | O_NONBLOCK); -- 2.34.1