Userland: Fix new GCC warnings

This commit is contained in:
Gunnar Beutner 2021-04-22 16:39:02 +02:00 committed by Andreas Kling
parent 8cd62b5780
commit c861195557
Notes: sideshowbarker 2024-07-18 18:56:35 +09:00
5 changed files with 12 additions and 3 deletions

View file

@ -142,7 +142,10 @@ void Label::wrap_text()
case '\t':
case ' ': {
if (start.has_value())
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
words.append(m_text.substring(start.value(), i - start.value()));
#pragma GCC diagnostic pop
start.clear();
continue;
}

View file

@ -176,7 +176,10 @@ int main(int argc, char** argv)
if (!uninitialized_memory)
return Crash::Failure::UnexpectedError;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
[[maybe_unused]] volatile auto x = uninitialized_memory[0][0];
#pragma GCC diagnostic pop
return Crash::Failure::DidNotCrash;
}).run(run_type);
}
@ -199,7 +202,10 @@ int main(int argc, char** argv)
if (!uninitialized_memory)
return Crash::Failure::UnexpectedError;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
uninitialized_memory[4][0] = 1;
#pragma GCC diagnostic pop
return Crash::Failure::DidNotCrash;
}).run(run_type);
}

View file

@ -25,7 +25,7 @@ int main(int argc, char** argv)
if (write_to_stdout)
keep_input_files = true;
for (const String& input_filename : filenames) {
for (const String input_filename : filenames) {
auto output_filename = String::formatted("{}.gz", input_filename);
// We map the whole file instead of streaming to reduce size overhead (gzip header) and increase the deflate block size (better compression)

View file

@ -175,7 +175,7 @@ int main(int argc, char** argv)
}
};
for (const String& path : paths) {
for (const String path : paths) {
if (Core::File::is_directory(path)) {
add_directory(path, add_directory);
} else {

View file

@ -104,7 +104,7 @@ int main(int argc, char** argv)
}
};
for (const String& source_path : source_paths) {
for (const String source_path : source_paths) {
if (Core::File::is_directory(source_path)) {
add_directory(source_path, add_directory);
} else {