When compiling the program under Ubuntu 19.10, I get the folowing error, saying that write() function has to be casted to void :
➜ libft-unit-test git:(master) make
[ Building #0 ]
➤ clang -O2 -funroll-loops -Werror -Wall -Wextra -I./include -o obj/src/main.o -c src/main.c
In file included from src/main.c:21:
src/main.c: In function ‘run_subtests’:
./include/libft_test.h:238:54: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
238 | # define RESET_DIFF lseek(g_diff_fd, 0, SEEK_SET); write(g_diff_fd, "\0", 1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
src/main.c:147:3: note: in expansion of macro ‘RESET_DIFF’
147 | RESET_DIFF;
| ^~~~~~~~~~
src/main.c: In function ‘run_subbench’:
./include/libft_test.h:238:54: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
238 | # define RESET_DIFF lseek(g_diff_fd, 0, SEEK_SET); write(g_diff_fd, "\0", 1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
src/main.c:172:3: note: in expansion of macro ‘RESET_DIFF’
172 | RESET_DIFF;
| ^~~~~~~~~~
src/main.c: In function ‘main’:
src/main.c:282:2: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
282 | write(fd, &g_shared_mem, 8);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/main.c:21:
./include/libft_test.h:238:54: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
238 | # define RESET_DIFF lseek(g_diff_fd, 0, SEEK_SET); write(g_diff_fd, "\0", 1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
src/main.c:289:2: note: in expansion of macro ‘RESET_DIFF’
289 | RESET_DIFF;
| ^~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [Makefile:193: obj/src/main.o] Error 1
Also I had to make a symlink for clang because it is not existing by default on my OS :
sudo ln -s /usr/bin/gcc /usr/bin/clang
Informations :
➜ libft-unit-test git:(master) clang --version
cc (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
➜ libft-unit-test git:(master) uname -a
Linux mreho-XPS-15-7590 5.3.0-19-generic #20-Ubuntu SMP Fri Oct 18 09:04:39 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
When compiling the program under Ubuntu 19.10, I get the folowing error, saying that write() function has to be casted to void :
Also I had to make a symlink for clang because it is not existing by default on my OS :
sudo ln -s /usr/bin/gcc /usr/bin/clang
Informations :
Thank you in advance.