Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/xinterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,12 @@ __get_cxx_version ()
auto cout_strbuf = std::cout.rdbuf();
auto cerr_strbuf = std::cerr.rdbuf();

std::unique_ptr<xnull> nullbuf;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "std::unique_ptr" is directly included [misc-include-cleaner]

src/xinterpreter.cpp:21:

- #ifndef EMSCRIPTEN
+ #include <memory>
+ #ifndef EMSCRIPTEN

if (config.silent)
{
auto null = xnull();
std::cout.rdbuf(&null);
std::cerr.rdbuf(&null);
nullbuf = std::make_unique<xnull>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "std::make_unique" is directly included [misc-include-cleaner]

            nullbuf = std::make_unique<xnull>();
                           ^

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can always allocate xnull before checking for the config.silent property and redirect only if this is needed. That would avoid a dynamic allocation here. Also we could take the opportunity of fixing this issue to write a small RAII object to perform the redirection.

std::cout.rdbuf(nullbuf.get());
std::cerr.rdbuf(nullbuf.get());
}

std::string err;
Expand Down