-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
(void)fwrite triggers -Wunused-result again #2185
Comments
What gcc version are you using? I wasn't able to repro this on gcc 9.1: https://godbolt.org/z/5EPcbY. |
It's GCC 8.3, but I think the more important thing is the system's glibc version, as the
least-annoying fix for this that I've seen is to use an if condition to uselessly examine the result.
|
Fixed in 308510e. |
Regression of #1098 introduced here 211d312
https://github.com/fmtlib/fmt/blob/master/include/fmt/format-inl.h#L158
Unfortunately the
(void)
cast doesn't actually convince GCC that we've paid attention to thestd::fwrite
result.Maybe
report_error
can return a bool indicating whether the error was reported successfullly, calculated from the fwrite result. We don't have to actually look at that bool, but GCC may shut up if we look like we care.It's all kind of silly. The
std::fputc
on the next line has no such annotation but it's just as capable of failing.The text was updated successfully, but these errors were encountered: