From: Muhammad Usama Anjum <Usama.Anjum@collabora.com>
To: David Laight <david.laight.linux@gmail.com>
Cc: Usama.Anjum@collabora.com, "Kees Cook" <kees@kernel.org>,
"Andy Lutomirski" <luto@amacapital.net>,
"Will Drewry" <wad@chromium.org>, "Shuah Khan" <shuah@kernel.org>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Jérôme Glisse" <jglisse@redhat.com>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, kernel@collabora.com
Subject: Re: [PATCH 01/16] selftests/mm: remove argc and argv unused parameters
Date: Sat, 1 Feb 2025 12:32:20 +0500 [thread overview]
Message-ID: <1175024c-6ef7-4557-95ca-180dd0a3dd5b@collabora.com> (raw)
In-Reply-To: <20250110190057.2294fd5a@pumpkin>
On 1/11/25 12:00 AM, David Laight wrote:
> 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.
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
next prev parent reply other threads:[~2025-02-01 7:32 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-09 17:38 [PATCH 00/16] selftest/mm: Remove warnings found by adding compiler flags Muhammad Usama Anjum
2025-01-09 17:38 ` [PATCH 01/16] selftests/mm: remove argc and argv unused parameters Muhammad Usama Anjum
2025-01-09 17:42 ` Kees Cook
2025-01-09 17:48 ` Muhammad Usama Anjum
2025-01-09 17:50 ` Kees Cook
2025-01-10 0:12 ` Andrew Morton
2025-02-01 7:43 ` Muhammad Usama Anjum
2025-01-10 19:00 ` David Laight
2025-02-01 7:32 ` Muhammad Usama Anjum [this message]
2025-01-09 17:38 ` [PATCH 02/16] selftests/mm: Fix unused parameter warnings Muhammad Usama Anjum
2025-01-09 17:38 ` [PATCH 03/16] " Muhammad Usama Anjum
2025-01-09 17:38 ` [PATCH 04/16] selftests/mm: Fix type mismatch warnings Muhammad Usama Anjum
2025-01-09 17:38 ` [PATCH 05/16] selftests/mm: kselftest_harness: Fix warnings Muhammad Usama Anjum
2025-01-15 22:19 ` Mark Brown
2025-01-09 17:38 ` [PATCH 06/16] selftests/mm: cow: remove unused variables and fix type mismatch errors Muhammad Usama Anjum
2025-01-09 17:38 ` [PATCH 07/16] selftests/mm: hmm-tests: Remove always false expressions Muhammad Usama Anjum
2025-01-09 17:38 ` [PATCH 08/16] selftests/mm: guard-pages: Fix type mismatch warnings Muhammad Usama Anjum
2025-01-09 17:38 ` [PATCH 09/16] selftests/mm: hugetlb-madvise: fix type mismatch issues Muhammad Usama Anjum
2025-01-09 17:38 ` [PATCH 10/16] selftests/mm: hugepage-vmemmap: fix type mismatch warnings Muhammad Usama Anjum
2025-01-09 17:38 ` [PATCH 11/16] selftests/mm: hugetlb-read-hwpoison: Fix " Muhammad Usama Anjum
2025-01-09 17:38 ` [PATCH 12/16] selftests/mm: khugepaged: " Muhammad Usama Anjum
2025-01-09 17:38 ` [PATCH 13/16] selftests/mm: protection_keys: Fix variables types " Muhammad Usama Anjum
2025-01-09 17:38 ` [PATCH 14/16] selftests/mm: thuge-gen: Fix type " Muhammad Usama Anjum
2025-01-09 17:38 ` [PATCH 15/16] selftests/mm: uffd-*: Fix all " Muhammad Usama Anjum
2025-01-09 17:38 ` [PATCH 16/16] selftests/mm: Makefile: Add the compiler flags Muhammad Usama Anjum
2025-01-16 5:32 ` [PATCH 00/16] selftest/mm: Remove warnings found by adding " Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1175024c-6ef7-4557-95ca-180dd0a3dd5b@collabora.com \
--to=usama.anjum@collabora.com \
--cc=akpm@linux-foundation.org \
--cc=david.laight.linux@gmail.com \
--cc=jglisse@redhat.com \
--cc=kees@kernel.org \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=luto@amacapital.net \
--cc=shuah@kernel.org \
--cc=wad@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox