[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221112183050.85200-1-sj@kernel.org>
Date: Sat, 12 Nov 2022 18:30:50 +0000
From: SeongJae Park <sj@...nel.org>
To: Rong Tao <rtoax@...mail.com>
Cc: sj@...nel.org, damon@...ts.linux.dev, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org, linux-mm@...ck.org,
rongtao@...tc.cn, shuah@...nel.org, yuanchu@...gle.com
Subject: Re: Re: [PATCH] selftests/damon: Fix unnecessary compilation warnings
Hi Rong,
On Sat, 12 Nov 2022 13:01:04 +0800 Rong Tao <rtoax@...mail.com> wrote:
> 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?
I think it looks great! Looking forward to your v3 patch!
Thanks,
SJ
>
> Good day!
> Rong Tao
Powered by blists - more mailing lists