summaryrefslogtreecommitdiff
path: root/Userland/DynamicLoader/main.cpp
diff options
context:
space:
mode:
authorLenny Maiorani <lenny@colorado.edu>2020-12-20 16:09:48 -0700
committerGitHub <noreply@github.com>2020-12-21 00:09:48 +0100
commit765936ebaedfaa3a339d99a9865b555ddd7c23e2 (patch)
treee092294ec99ca5b3ba9c92139f847dcd9a8a20bc /Userland/DynamicLoader/main.cpp
parent4421d98e30763424055eefe729c9cab28abdf19d (diff)
downloadserenity-765936ebaedfaa3a339d99a9865b555ddd7c23e2.zip
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.
Diffstat (limited to 'Userland/DynamicLoader/main.cpp')
-rw-r--r--Userland/DynamicLoader/main.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/Userland/DynamicLoader/main.cpp b/Userland/DynamicLoader/main.cpp
index fefef44f3a..6da94306c8 100644
--- a/Userland/DynamicLoader/main.cpp
+++ b/Userland/DynamicLoader/main.cpp
@@ -188,8 +188,7 @@ static void allocate_tls()
total_tls_size += data.value->tls_size();
}
if (total_tls_size) {
- void* tls_address = allocate_tls(total_tls_size);
- (void)tls_address;
+ [[maybe_unused]] void* tls_address = allocate_tls(total_tls_size);
VERBOSE("from userspace, tls_address: %p", tls_address);
}
g_total_tls_size = total_tls_size;
@@ -211,7 +210,7 @@ static void initialize_libc()
res = global_symbol_lookup("__libc_init");
ASSERT(res.found);
- typedef void libc_init_func(void);
+ typedef void libc_init_func();
((libc_init_func*)res.address)();
}
@@ -262,8 +261,7 @@ static FlatPtr loader_main(auxv_t* auxvp)
map_dependencies(main_program_name);
VERBOSE("loaded all dependencies");
- for (auto& lib : g_loaders) {
- (void)lib;
+ for ([[maybe_unused]] auto& lib : g_loaders) {
VERBOSE("%s - tls size: $u, tls offset: %u", lib.key.characters(), lib.value->tls_size(), lib.value->tls_offset());
}
@@ -301,8 +299,7 @@ void _start(int argc, char** argv, char** envp)
FlatPtr entry = loader_main(auxvp);
VERBOSE("Loaded libs:\n");
- for (auto& obj : g_loaded_objects) {
- (void)obj;
+ for ([[maybe_unused]] auto& obj : g_loaded_objects) {
VERBOSE("%s: %p\n", obj.key.characters(), obj.value->base_address().as_ptr());
}