You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
after updating to v4.0.1 I am getting -Wunused-result compiler warnings on the two fread() calls in parser.hpp (in parse() and try_parse()) (using Clang 15):
.../parser.hpp:3717:5: error: ignoring return value of function declared with 'warn_unused_result' attribute [-Werror,-Wunused-result]
std::fread(letters.data(), sizeof(char), static_cast<std::size_t>(fsize), fp);
^~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../parser.hpp:3755:5: error: ignoring return value of function declared with 'warn_unused_result' attribute [-Werror,-Wunused-result]
std::fread(letters.data(), sizeof(char), static_cast<std::size_t>(fsize), fp);
^~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
These calls should probably check the return value of std::fread() to make sure the proper number of members were read in?
The text was updated successfully, but these errors were encountered:
Good catch! (I don't know why it does not have any warnings on CI)
And we need to add note that FILE* must be opened in the binary mode, to make sure that the number of characters are kept (to avoid conversion between CRLF and LF) to the docs.
Would you like to create a PullReq on this? I'll be working on it in the next weekend, so if I hear back by then I'll wait for it.
Thank you so much for this great library!
after updating to v4.0.1 I am getting
-Wunused-result
compiler warnings on the twofread()
calls inparser.hpp
(inparse()
andtry_parse()
) (using Clang 15):These calls should probably check the return value of
std::fread()
to make sure the proper number of members were read in?The text was updated successfully, but these errors were encountered: