lkml.org 
[lkml]   [2022]   [Nov]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Re: [PATCH] selftests/damon: Fix unnecessary compilation warnings
Date
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

\
 
 \ /
  Last update: 2022-11-12 06:04    [W:0.057 / U:0.460 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site