mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:48:14 +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
|
@ -804,11 +804,9 @@ size_t mbstowcs(wchar_t*, const char*, size_t)
|
|||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
int mbtowc(wchar_t* wch, const char* data, size_t data_size)
|
||||
int mbtowc(wchar_t* wch, const char* data, [[maybe_unused]] size_t data_size)
|
||||
{
|
||||
// FIXME: This needs a real implementation.
|
||||
UNUSED_PARAM(data_size);
|
||||
|
||||
if (wch && data) {
|
||||
*wch = *data;
|
||||
return 1;
|
||||
|
@ -1023,7 +1021,7 @@ unsigned long long strtoull(const char* str, char** endptr, int base)
|
|||
// Serenity's PRNG is not cryptographically secure. Do not rely on this for
|
||||
// any real crypto! These functions (for now) are for compatibility.
|
||||
// TODO: In the future, rand can be made deterministic and this not.
|
||||
uint32_t arc4random(void)
|
||||
uint32_t arc4random()
|
||||
{
|
||||
char buf[4];
|
||||
syscall(SC_getrandom, buf, 4, 0);
|
||||
|
@ -1073,15 +1071,13 @@ int posix_openpt(int flags)
|
|||
return open("/dev/ptmx", flags);
|
||||
}
|
||||
|
||||
int grantpt(int fd)
|
||||
int grantpt([[maybe_unused]] int fd)
|
||||
{
|
||||
(void)fd;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int unlockpt(int fd)
|
||||
int unlockpt([[maybe_unused]] int fd)
|
||||
{
|
||||
(void)fd;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue