mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rong Tao <rtoax@foxmail.com>
To: sj@kernel.org
Cc: damon@lists.linux.dev, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org, linux-mm@kvack.org,
	rongtao@cestc.cn, rtoax@foxmail.com, shuah@kernel.org,
	yuanchu@google.com
Subject: Re: Re: [PATCH] selftests/damon: Fix unnecessary compilation warnings
Date: Sat, 12 Nov 2022 13:01:04 +0800	[thread overview]
Message-ID: <tencent_5695C257F3D13F4417034BA1FBAC95CB3B07@qq.com> (raw)
In-Reply-To: <20221111173855.108360-1-sj@kernel.org>

Hi, Park, I just search on GCC source code, found GCC support
"-Wstringop-overread" at least gcc-11.1.0, commit d14c547abd48("Add
-Wstringop-overread for reading past the end by string functions.").

AND found a testsuite gcc/gcc/testsuite/gcc.dg/pragma-diag-10.c

 10 #pragma GCC diagnostic push
 11 #pragma GCC diagnostic ignored "-Wstringop-overflow"
 12 #pragma GCC diagnostic ignored "-Wstringop-overread"
 13   if (c != 0)
 14     return __builtin_memchr (s, c, (unsigned long)-1);
 15 #pragma GCC diagnostic pop

it's totally same as this PATCH.

I think the motivation for this patch is to eliminate the compilation
warning, maybe one day we will compile the kernel with "-Werror -Wall",
at which point this compilation warning will turn into a compilation
error, and in case we already know it, we should fix this error in
advance.

For old gcc, we can add this?

 #pragma GCC diagnostic push
+#if __GNUC__ >= 11 && __GNUC_MINOR__ >= 1
 /* Ignore read(2) overflow and write(2) overread compile warnings */
 #pragma GCC diagnostic ignored "-Wstringop-overread"
 #pragma GCC diagnostic ignored "-Wstringop-overflow"
+#endif

What do you think?

Good day!
Rong Tao

  reply	other threads:[~2022-11-12  5:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-10 13:34 Rong Tao
2022-11-10 20:09 ` SeongJae Park
2022-11-11  2:37   ` Rong Tao
2022-11-11 17:38     ` SeongJae Park
2022-11-12  5:01       ` Rong Tao [this message]
2022-11-12 18:30         ` SeongJae Park
2022-11-13  0:38           ` [PATCH v3] " Rong Tao
2022-11-13 19:49             ` SeongJae Park

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=tencent_5695C257F3D13F4417034BA1FBAC95CB3B07@qq.com \
    --to=rtoax@foxmail.com \
    --cc=damon@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rongtao@cestc.cn \
    --cc=shuah@kernel.org \
    --cc=sj@kernel.org \
    --cc=yuanchu@google.com \
    /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

all inboxes | Powered by JetHome®