Re: Re: [PATCH] selftests/damon: Fix unnecessary compilation warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux