diff --git a/string/tester.c b/string/tester.c index 8de70ad3ce..da42c72141 100644 --- a/string/tester.c +++ b/string/tester.c @@ -26,6 +26,14 @@ #undef __USE_STRING_INLINES #endif +#include +#include + +/* Triggered by strncpy fortify wrapper when it is enabled. */ +#if __GNUC_PREREQ (8, 0) +DIAG_IGNORE_NEEDS_COMMENT (8, "-Wstringop-truncation"); +#endif + #include #include #include @@ -33,7 +41,6 @@ #include #include #include -#include /* This file tests a range of corner cases of string functions, including cases where truncation occurs or where sizes specified @@ -45,9 +52,6 @@ DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Wmemset-transposed-args"); DIAG_IGNORE_NEEDS_COMMENT (9, "-Wrestrict"); DIAG_IGNORE_NEEDS_COMMENT (7, "-Wstringop-overflow="); #endif -#if __GNUC_PREREQ (8, 0) -DIAG_IGNORE_NEEDS_COMMENT (8, "-Wstringop-truncation"); -#endif #if __GNUC_PREREQ (11, 0) DIAG_IGNORE_NEEDS_COMMENT (11, "-Wstringop-overread"); #endif