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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/11/25 12:00 AM, David Laight wrote:
> On Thu,  9 Jan 2025 22:38:27 +0500
> Muhammad Usama Anjum <usama.anjum@xxxxxxxxxxxxx> 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.
No, we still get unused argument warning. 

> 
> Just disable -Wunused-parameter - there are far too many places where it produces
> unwanted warnings.
The purpose is to run static analyzer and find obvious errors to enhance quality of
the code which is only possible if we start using these compiler flags. This is just
my thinking.

Feel free to share your thoughts?

-- 
BR,
Muhammad Usama Anjum




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux