[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_5695C257F3D13F4417034BA1FBAC95CB3B07@qq.com>
Date: Sat, 12 Nov 2022 13:01:04 +0800
From: Rong Tao <rtoax@...mail.com>
To: sj@...nel.org
Cc: damon@...ts.linux.dev, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org, linux-mm@...ck.org,
rongtao@...tc.cn, rtoax@...mail.com, shuah@...nel.org,
yuanchu@...gle.com
Subject: Re: Re: [PATCH] selftests/damon: Fix unnecessary compilation warnings
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
Powered by blists - more mailing lists