This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.


On 11/19/2017 01:56 PM, Thomas Schwinge wrote:
> Hi!
> 
> On Wed, 18 Oct 2017 14:48:13 +0200, Martin Liška <mliska@suse.cz> wrote:
>> This is second patch that addresses test-suite fallout. All these tests fail because -Wreturn-type is
>> now on by default.
>>
>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
> 
> ... but alters some LTO test cases as follows:
> 
>> --- a/gcc/testsuite/g++.dg/lto/20080907_0.C
>> +++ b/gcc/testsuite/g++.dg/lto/20080907_0.C
>> @@ -1,3 +1,5 @@
>>  // { dg-lto-do assemble }
>> +// { dg-lto-options "-Wno-return-type" }
> 
> This means that instead of the default (without explicit
> "dg-lto-options") "LTO options torture testing" testing, we're now *only*
> testing one variant, with only the "-Wno-return-type" option specified.
> 
>> --- a/gcc/testsuite/g++.dg/lto/20080915_0.C
>> +++ b/gcc/testsuite/g++.dg/lto/20080915_0.C
>> @@ -1,4 +1,6 @@
>>  // { dg-lto-do assemble }
>> +// { dg-lto-options "-Wno-return-type" }
> 
> Same, but...
> 
>> @@ -16,7 +18,7 @@ int func(const Bar& b) {
>>  }
>>  
>>  struct Baz {
>> - Bar& operator*() {}
>> + Bar& operator*() { static Bar a; return a; }
>>  };
> 
> ... given that you're addressing here the (only, as it seems)
> "-Wreturn-type" issue, you don't need to specify "-Wno-return-type" at
> all.
> 
>> --- a/gcc/testsuite/g++.dg/lto/20091002-1_0.C
>> +++ b/gcc/testsuite/g++.dg/lto/20091002-1_0.C
>> @@ -1,6 +1,6 @@
>>  // { dg-lto-do link }
>>  // { dg-require-effective-target fpic }
>> -// { dg-lto-options {{-fPIC -flto}} }
>> +// { dg-lto-options {{-fPIC -flto -Wno-return-type}} }
>>  // { dg-extra-ld-options "-fPIC -r -nostdlib" }
> 
> ACK.  This only tested one variant: "-fPIC -flto", now testing "-fPIC
> -flto -Wno-return-type".  (Similarly for several more.)
> 
>> --- a/gcc/testsuite/g++.dg/lto/20101010-1_0.C
>> +++ b/gcc/testsuite/g++.dg/lto/20101010-1_0.C
>> @@ -1,4 +1,5 @@
>>  // { dg-lto-do link }
>> +// { dg-lto-options "-Wno-return-type" }
> 
> NACK, see above.
> 
>> --- a/gcc/testsuite/g++.dg/lto/20101010-2_0.C
>> +++ b/gcc/testsuite/g++.dg/lto/20101010-2_0.C
>> @@ -1,4 +1,5 @@
>>  // { dg-lto-do link }
>> +// { dg-lto-options "-Wno-return-type" }
> 
> NACK, see above.
> 
>> --- a/gcc/testsuite/g++.dg/lto/pr65475c_0.C
>> +++ b/gcc/testsuite/g++.dg/lto/pr65475c_0.C
>> @@ -1,6 +1,7 @@
>>  /* { dg-lto-do link } */
>> -/* { dg-lto-options "-O2  -w" } */
>>  /* { dg-extra-ld-options { -O2 -Wno-odr -r -nostdlib } } */
>> +/* { dg-lto-options { "-O2 -w -Wno-return-type" } } */
> 
> I don't know about that one.  This previously tested two variants
> separately: "-O2" and "-w", and you've now changed it to test one
> combined variant: "-O2 -w -Wno-return-type".  Your change is correct if
> this previously meant to test the combined variant "-O2 -w" instead of
> each of them separately -- which I don't know/have not verified.

Hello.

I don't think so, I've just tested that and all invocations of the source file
have '-O2  -w' in corresponding command line. Can you please verify that it builds
all possible combinations of provided arguments of dg-lto-options?

> 
>> --- a/gcc/testsuite/g++.dg/lto/pr69589_0.C
>> +++ b/gcc/testsuite/g++.dg/lto/pr69589_0.C
>> @@ -1,5 +1,5 @@
>>  // { dg-lto-do link }
>> -// { dg-lto-options "-O2 -rdynamic" }
>> +// { dg-lto-options { "-O2 -rdynamic -Wno-return-type" } }
>>  // { dg-extra-ld-options "-r -nostdlib" }
> 
> Same: "-O2" and "-rdynamic" separately vs. now "-O2 -rdynamic
> -Wno-return-type" combined.
> 
> Unfortunately, we can't use "dg-options" or "dg-additional-options" here:
> 
>     WARNING: lto.exp does not support dg-additional-options
>     WARNING: lto.exp does not support dg-options in primary source file

I know, I've tried that :)

Martin

> 
> OK to fix the first four issues as follows?  If approving this, please
> respond with "Reviewed-by: NAME <EMAIL>" so that your effort will be
> recorded.  See <https://gcc.gnu.org/wiki/Reviewed-by>.
> 
> diff --git gcc/testsuite/g++.dg/lto/20080907_0.C gcc/testsuite/g++.dg/lto/20080907_0.C
> index a423196..153d0ab 100644
> --- gcc/testsuite/g++.dg/lto/20080907_0.C
> +++ gcc/testsuite/g++.dg/lto/20080907_0.C
> @@ -1,5 +1,7 @@
>  // { dg-lto-do assemble }
> -// { dg-lto-options "-Wno-return-type" }
> +
> +/* "WARNING: lto.exp does not support dg-additional-options" */
> +#pragma GCC diagnostic ignored "-Wreturn-type"
>  
>  struct Foo { void func (); }; Foo & bar () { } struct Baz { Baz (Baz &); };
>  Baz dummy() { bar().func(); }
> diff --git gcc/testsuite/g++.dg/lto/20080915_0.C gcc/testsuite/g++.dg/lto/20080915_0.C
> index 40c5042..c91e756 100644
> --- gcc/testsuite/g++.dg/lto/20080915_0.C
> +++ gcc/testsuite/g++.dg/lto/20080915_0.C
> @@ -1,5 +1,4 @@
>  // { dg-lto-do assemble }
> -// { dg-lto-options "-Wno-return-type" }
>  
>  struct Foo {
>   static const int dummy;
> diff --git gcc/testsuite/g++.dg/lto/20101010-1_0.C gcc/testsuite/g++.dg/lto/20101010-1_0.C
> index 8f694c7..bb3e6d4 100644
> --- gcc/testsuite/g++.dg/lto/20101010-1_0.C
> +++ gcc/testsuite/g++.dg/lto/20101010-1_0.C
> @@ -1,5 +1,7 @@
>  // { dg-lto-do link }
> -// { dg-lto-options "-Wno-return-type" }
> +
> +/* "WARNING: lto.exp does not support dg-additional-options" */
> +#pragma GCC diagnostic ignored "-Wreturn-type"
>  
>  typedef long size_t;
>  template < class, class > struct pair
> diff --git gcc/testsuite/g++.dg/lto/20101010-2_0.C gcc/testsuite/g++.dg/lto/20101010-2_0.C
> index a26956f..721ac01 100644
> --- gcc/testsuite/g++.dg/lto/20101010-2_0.C
> +++ gcc/testsuite/g++.dg/lto/20101010-2_0.C
> @@ -1,5 +1,7 @@
>  // { dg-lto-do link }
> -// { dg-lto-options "-Wno-return-type" }
> +
> +/* "WARNING: lto.exp does not support dg-additional-options" */
> +#pragma GCC diagnostic ignored "-Wreturn-type"
>  
>  typedef int size_t;
>  template < size_t _Nw > struct _Base_bitset
> 
> 
> Grüße
>  Thomas
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]