Fix build errors 64/270864/1
authorHyotaek Shim <hyotaek.shim@samsung.com>
Thu, 10 Feb 2022 08:35:02 +0000 (17:35 +0900)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Thu, 10 Feb 2022 08:35:14 +0000 (17:35 +0900)
-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 <hyotaek.shim@samsung.com>
tests/logger/Makefile
tests/logger/logger.c

index 2faf0a7..8c71503 100644 (file)
@@ -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
index bd1637c..0277ed6 100644 (file)
@@ -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);