mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 15:07:45 +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:
parent
4421d98e30
commit
765936ebae
103 changed files with 219 additions and 362 deletions
|
@ -170,8 +170,7 @@ int main(int argc, char** argv)
|
|||
Crash("Division by zero", []() {
|
||||
volatile int lala = 10;
|
||||
volatile int zero = 0;
|
||||
volatile int test = lala / zero;
|
||||
UNUSED_PARAM(test);
|
||||
[[maybe_unused]] volatile int test = lala / zero;
|
||||
return Crash::Failure::DidNotCrash;
|
||||
}).run(run_type);
|
||||
}
|
||||
|
@ -196,8 +195,7 @@ int main(int argc, char** argv)
|
|||
if (!uninitialized_memory)
|
||||
return Crash::Failure::UnexpectedError;
|
||||
|
||||
volatile auto x = uninitialized_memory[0][0];
|
||||
UNUSED_PARAM(x);
|
||||
[[maybe_unused]] volatile auto x = uninitialized_memory[0][0];
|
||||
return Crash::Failure::DidNotCrash;
|
||||
}).run(run_type);
|
||||
}
|
||||
|
@ -209,8 +207,7 @@ int main(int argc, char** argv)
|
|||
return Crash::Failure::UnexpectedError;
|
||||
|
||||
free(uninitialized_memory);
|
||||
volatile auto x = uninitialized_memory[4][0];
|
||||
UNUSED_PARAM(x);
|
||||
[[maybe_unused]] volatile auto x = uninitialized_memory[4][0];
|
||||
return Crash::Failure::DidNotCrash;
|
||||
}).run(run_type);
|
||||
}
|
||||
|
@ -305,8 +302,7 @@ int main(int argc, char** argv)
|
|||
|
||||
free(ptr);
|
||||
dbgprintf("ptr = %p\n", ptr);
|
||||
volatile auto foo = *ptr;
|
||||
UNUSED_PARAM(foo);
|
||||
[[maybe_unused]] volatile auto foo = *ptr;
|
||||
return Crash::Failure::DidNotCrash;
|
||||
}).run(run_type);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue