Richard Sandiford <richard.sandif...@arm.com> writes:

> Xi Ruoyao <xry...@xry111.site> writes:
>> On Sat, 2024-07-20 at 06:52 +0100, Sam James wrote:
>>> Some distributions like Gentoo make -Wformat and -Wformat-security
>>> enabled by default. Pass -Wno-format to the test to avoid a spurious
>>> fail in such environments.
>>> 
>>> gcc/testsuite/
>>>     PR rtl-optimization/115929
>>>     * gcc.dg/torture/pr115929-1.c: Pass -Wno-format.
>>> ---
>>
>> IMO if you are patching GCC downstream to enable some options, you can
>> patch the test case in the same .patch file anyway instead of pushing it
>> upstream.
>>
>> If we take the responsibility to make the test suite anticipate random
>> downstream changes, the test suite will ended up filled with different
>> workarounds for 42 distros.
>
> Yeah, I'm worried about that too.
>
>> If we have to anticipate downstream changes we should make a policy
>> about which changes we must anticipate (hmm and if we'll anticipate -
>> Wformat by default why not add a configuration option for it by the
>> way?), or do it in a more generic way (using a .spec file to explicitly
>> give the "baseline" options for testing?)
>
> Two systematic ways of dealing with this under the current testsuite
> framework would be:
>
> (1) Make dg-torture.exp add -w by default.  This is what gcc.c-torture
>     already does.  Then, tests that want to test for warnings can
>     enable them explicitly.
>
>     Some of the existing dg-warnings are already due to lack of -w,
>     rather than something that the test was originally designed for.
>     E.g. pr26565.c.
>
> (2) Make dg-torture.exp add -Wall -Wextra by default, so that tests
>     have to suppress any warnings they don't want.
>
> Personally, I'd prefer one of those two rather than patching upstream
> tests for downstream changes.

I don't mind doing the work once we have consensus. (1) feels more pure
but (2) is more progressive and lets us make things error out by default
in future upstream with a bit more freedom.

In the meantime, I'll return to other testsuite bits I have in mind.

thanks,
sam

Reply via email to