Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix -Werror failure on Alpine/MUSL libc & GCC 10 #27

Merged
merged 2 commits into from
Apr 30, 2022

Conversation

overhacked
Copy link

Two compiler warnings result in a build failure. One is standards pedantry from MUSL libc, the other is a mishandled error value that GCC 10 issues a warning for. See details in PR commit messages.

`poll.h` is the POSIX standard include location, and MUSL
libc issues a warning (which infnoise's `-Werror` in CFLAGS
makes into an error).

For more context:
- [Linux manpage for `poll(2)`][1]
- [Open Group UNIX Specification][2]
- [Relevant discussion over at the `emscripten` project][3]

[1]: https://man7.org/linux/man-pages/man2/poll.2.html
[2]: https://pubs.opengroup.org/onlinepubs/7908799/xsh/poll.h.html
[3]: emscripten-core/emscripten#5447 (comment)
The return type of `getc(3)` is a signed integer,
with negative values indicating an error. The changed
line stored the return value in an *unsigned* integer,
then tested it against a negative error constant, so
the error condition would never be detected. This
also results in a warning on GCC 10.

Further information:
- [`getc(3)`](https://man7.org/linux/man-pages/man3/fgetc.3.html)
- [C FAQ question 12.1](http://c-faq.com/stdio/getcharc.html)
@adudek16 adudek16 mentioned this pull request Mar 31, 2022
@manuel-domke manuel-domke merged commit 291fc06 into leetronics:master Apr 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants