1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:27:35 +00:00

Everywhere: Switch from (void) to [[maybe_unused]] (#4473)

Problem:
- `(void)` simply casts the expression to void. This is understood to
  indicate that it is ignored, but this is really a compiler trick to
  get the compiler to not generate a warning.

Solution:
- Use the `[[maybe_unused]]` attribute to indicate the value is unused.

Note:
- Functions taking a `(void)` argument list have also been changed to
  `()` because this is not needed and shows up in the same grep
  command.
This commit is contained in:
Lenny Maiorani 2020-12-20 16:09:48 -07:00 committed by GitHub
parent 4421d98e30
commit 765936ebae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
103 changed files with 219 additions and 362 deletions

View file

@ -183,13 +183,12 @@ void show_properties(const String& container_dir_path, const String& path, const
properties->exec();
}
int run_in_desktop_mode(RefPtr<Core::ConfigFile> config)
int run_in_desktop_mode([[maybe_unused]] RefPtr<Core::ConfigFile> config)
{
static constexpr const char* process_name = "FileManager (Desktop)";
set_process_name(process_name, strlen(process_name));
pthread_setname_np(pthread_self(), process_name);
(void)config;
auto window = GUI::Window::construct();
window->set_title("Desktop Manager");
window->set_window_type(GUI::WindowType::Desktop);
@ -198,8 +197,7 @@ int run_in_desktop_mode(RefPtr<Core::ConfigFile> config)
auto& desktop_widget = window->set_main_widget<FileManager::DesktopWidget>();
desktop_widget.set_layout<GUI::VerticalBoxLayout>();
auto& directory_view = desktop_widget.add<DirectoryView>(DirectoryView::Mode::Desktop);
(void)directory_view;
[[maybe_unused]] auto& directory_view = desktop_widget.add<DirectoryView>(DirectoryView::Mode::Desktop);
auto copy_action = GUI::CommonActions::make_copy_action(
[&](auto&) {