This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Disable warnings in string/tester.c at top level
* Joseph Myers:
> On Wed, 2 Oct 2019, Florian Weimer wrote:
>
>> * Joseph Myers:
>>
>> > diff --git a/string/tester.c b/string/tester.c
>> > index 24b0dad1cb..128d2c7731 100644
>> > --- a/string/tester.c
>> > +++ b/string/tester.c
>> > @@ -34,6 +34,20 @@
>> > #include <fcntl.h>
>> > #include <libc-diag.h>
>> >
>> > +/* This file tests a range of corner cases of string functions,
>> > + including cases where truncation occurs or where sizes specified
>> > + are larger than the actual buffers, which result in various
>> > + warnings. */
>> > +DIAG_IGNORE_NEEDS_COMMENT (8, "-Warray-bounds");
>> > +DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Wmemset-transposed-args");
>> > +#if __GNUC_PREREQ (7, 0)
>> > +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
>> > +
>>
>> Should this come before the #include directives, in case the headers
>> contain inline functions?
>
> We've generally moved away from such inlines in installed headers. This
> position follows stdio-common/tst-printf.c which also disables some
> warnings at top level after all the headers have been included.
Okay, then this patch is okay.
Thanks,
Florian