Compilation failure error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result] #11
Comments
Thanks for the report! Sadly I cannot reproduce this, GCC 7 on OS X seems to work just fine. I fixed the errors that threw off your compiler and pushed my fixes into the branch |
Using branch ~/github/e · (fix-unused-result) $ gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
~/github/e · (fix-unused-result) $ make
mkdir -p /home/manu/.estx
cp stx/* /home/manu/.estx
mkdir -p bin/
cc main.c src/clipboard.c src/editor.c src/buffer.c src/util.c src/colors.c src/syntax.c -DSTXDIR=\"/home/manu/.estx\" -o bin/e -Werror -Wall -g -fPIC -O2 -DNDEBUG -ftrapv -Wfloat-equal -Wundef -Wwrite-strings -Wuninitialized -pedantic -std=c11
src/editor.c: In function ‘e_die’:
src/editor.c:24:3: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
(void)write(STDOUT_FILENO, "\x1b[2J\x1b[?47l\x1b""8", 12);
^
src/editor.c: In function ‘e_exit’:
src/editor.c:31:3: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
(void)write(STDOUT_FILENO, "\x1b[2J\x1b[?47l\x1b""8", 12);
^
src/editor.c: In function ‘e_clear_screen’:
src/editor.c:214:3: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
(void)write(STDOUT_FILENO, ab.b, ab.len);
^
src/editor.c: In function ‘e_setup’:
src/editor.c:1214:3: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
(void)write(STDOUT_FILENO, "\x1b""7\x1b[?47h", 8);
^
cc1: all warnings being treated as errors
src/syntax.c: In function ‘syntax_read_extensions’:
src/syntax.c:26:5: error: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Werror=unused-result]
(void)fgets(line, MAX_LINE_WIDTH, f);
^
src/syntax.c: In function ‘syntax_read_pattern’:
src/syntax.c:55:5: error: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Werror=unused-result]
(void)fgets(line, MAX_LINE_WIDTH, f);
^
cc1: all warnings being treated as errors
Makefile:11: recipe for target 'all' failed
make: *** [all] Error 1 |
Okay, thats quite interesting. Ill set up a debug VM and get back to you once I've fixed it for good, okay? |
Same here on Linux |
It should work now; could any of you verify the fix in |
It does work! But after running
|
I’m not sure this issue is related, and I’m going to close this for now. I can, however, reproduce this on Ubuntu and will open a new issue for this. |
GCC version.
Errors.
The text was updated successfully, but these errors were encountered: