mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-15 12:23:15 +00:00
Userland: Silence or resolve new GCC 13 warnings
GCC 13 produces the following true positive warnings: - `-Wredundant-move` when trying to move `result->tooltip()`, which is a const reference in `Assistant/main.cpp` - `-Wuse-after-free` when freeing an environment variable before removing it from `s_malloced_environment_variables` - `-Wdangling-pointer` when storing an AST node's `this` pointer to the interpreter's node stack in LibJS. This is not actually an issue, as it is popped when the scope ends, but GCC has no way of telling this.
This commit is contained in:
parent
2123fdd678
commit
fc003cd248
|
@ -251,7 +251,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto& match = results_container.add<Assistant::ResultRow>();
|
||||
match.set_icon(result->bitmap());
|
||||
match.set_text(String::from_deprecated_string(result->title()).release_value_but_fixme_should_propagate_errors());
|
||||
match.set_tooltip(move(result->tooltip()));
|
||||
match.set_tooltip(result->tooltip());
|
||||
match.on_click = [&result](auto) {
|
||||
result->activate();
|
||||
GUI::Application::the()->quit();
|
||||
|
|
|
@ -399,8 +399,8 @@ static void free_environment_variable_if_needed(char const* var)
|
|||
{
|
||||
if (!s_malloced_environment_variables.contains((FlatPtr)var))
|
||||
return;
|
||||
free(const_cast<char*>(var));
|
||||
s_malloced_environment_variables.remove((FlatPtr)var);
|
||||
free(const_cast<char*>(var));
|
||||
}
|
||||
|
||||
char* getenv(char const* name)
|
||||
|
|
|
@ -48,7 +48,11 @@ public:
|
|||
, m_chain_node { nullptr, node }
|
||||
{
|
||||
m_interpreter.vm().running_execution_context().current_node = &node;
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdangling-pointer"
|
||||
// The node pointer is popped from the interpreter in the destructor.
|
||||
m_interpreter.push_ast_node(m_chain_node);
|
||||
#pragma GCC diagnostic push
|
||||
}
|
||||
|
||||
~InterpreterNodeScope()
|
||||
|
|
Loading…
Reference in a new issue