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 compilation with -Werror=unused-result #3676

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

dannf
Copy link
Contributor

@dannf dannf commented Dec 9, 2024

Compile-tested only.

~ $ /usr/local/bin/c++ -DFMT_SHARED -DSPDLOG_FMT_EXTERNAL -I/home/build/libmamba/include -isystem /usr/share -fPIC -O3 -DNDEBUG -std=gnu++17 -Wall -Wextra -Wshado w -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual -Wpedantic -Wconversion -Wsign-conversion -Wnull-dereference -Wdouble-promotion - Wformat=2 -Wunreachable-code -Wuninitialized -Werror -Wmisleading-indentation -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wuseless-cast -MD -MT micromam ba/CMakeFiles/micromamba.dir/src/constructor.cpp.o -MF micromamba/CMakeFiles/micromamba.dir/src/constructor.cpp.o.d -o micromamba/CMakeFiles/micromamba.dir/src/co nstructor.cpp.o -c /home/build/micromamba/src/constructor.cpp /home/build/micromamba/src/constructor.cpp: In function 'void read_binary_from_stdin_and_write_to_file(mamba::fs::u8path&)': /home/build/micromamba/src/constructor.cpp:200:17: error: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Werror=unused-result]
200 | std::freopen(nullptr, "rb", stdin);
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~

@jjerphan jjerphan added the release::bug_fixes For PRs fixing bugs label Dec 9, 2024
@JohanMabille
Copy link
Member

JohanMabille commented Dec 9, 2024

Thanks for this fix! Running pre-commit run --all should fix the linter.

Compile-tested only.

~ $ /usr/local/bin/c++ -DFMT_SHARED -DSPDLOG_FMT_EXTERNAL -I/home/build/libmamba/include -isystem /usr/share -fPIC -O3 -DNDEBUG -std=gnu++17 -Wall -Wextra -Wshado
w -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual -Wpedantic -Wconversion -Wsign-conversion -Wnull-dereference -Wdouble-promotion -
Wformat=2 -Wunreachable-code -Wuninitialized -Werror -Wmisleading-indentation -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wuseless-cast -MD -MT micromam
ba/CMakeFiles/micromamba.dir/src/constructor.cpp.o -MF micromamba/CMakeFiles/micromamba.dir/src/constructor.cpp.o.d -o micromamba/CMakeFiles/micromamba.dir/src/co
nstructor.cpp.o -c /home/build/micromamba/src/constructor.cpp
/home/build/micromamba/src/constructor.cpp: In function 'void read_binary_from_stdin_and_write_to_file(mamba::fs::u8path&)':
/home/build/micromamba/src/constructor.cpp:200:17: error: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Werror=unused-result]
  200 |     std::freopen(nullptr, "rb", stdin);
      |     ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: dann frazier <[email protected]>
@JohanMabille JohanMabille merged commit 693ee82 into mamba-org:main Dec 10, 2024
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release::bug_fixes For PRs fixing bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants