Re: [PATCH 01/16] selftests/mm: remove argc and argv unused parameters

David Laight
2025-01-10T19:01:00Z

On Thu, 9 Jan 2025 22:38:27 +0500
Muhammad Usama Anjum <usama.anjum@collabora.com> wrote:

> Remove the following warnings by removing unused argc and argv
> parameters:
> In function ‘main’:
> warning: unused parameter ‘argc’ [-Wunused-parameter]
> 158 | int main(int argc, char *argv[])
> | ~~~~^~~~
> warning: unused parameter ‘argv’ [-Wunused-parameter]
> 158 | int main(int argc, char *argv[])
...
> diff --git a/tools/testing/selftests/mm/compaction_test.c b/tools/testing/selftests/mm/compaction_test.c
> index 2c3a0eb6b22d3..8d23b698ce9db 100644
> --- a/tools/testing/selftests/mm/compaction_test.c
> +++ b/tools/testing/selftests/mm/compaction_test.c
> @@ -194,7 +194,7 @@ int set_zero_hugepages(unsigned long *initial_nr_hugepages)
> return ret;
> }
>
> -int main(int argc, char **argv)
> +int main(void)

Doesn't that generate a different warning because main() is a special function
and gcc knows the arguments it should have.

Just disable -Wunused-parameter - there are far too many places where it produces
unwanted warnings.

David