On Wed, Oct 16, 2024 at 11:01:49AM +0000, Joseph Myers wrote:
> --- a/gcc/testsuite/c-c++-common/Wcast-function-type.c
> +++ b/gcc/testsuite/c-c++-common/Wcast-function-type.c
> @@ -1,5 +1,6 @@
>  /* { dg-do compile } */
> -/* { dg-options "-Wcast-function-type" } */
> +/* { dg-options "-std=gnu17 -Wcast-function-type" { target c } } */
> +/* { dg-options "-Wcast-function-type" { target c++ } } */

I think better would be
/* { dg-options "-Wcast-function-type" } */
/* { dg-additional-options "-std=gnu17" { target c } } */

> --- a/gcc/testsuite/c-c++-common/Wformat-pr84258.c
> +++ b/gcc/testsuite/c-c++-common/Wformat-pr84258.c
> @@ -1,4 +1,5 @@
> -/* { dg-options "-Wformat" } */
> +/* { dg-options "-std=gnu17 -Wformat" { target c } } */
> +/* { dg-options "-Wformat" { target c++ } } */

Similarly.

> --- a/gcc/testsuite/c-c++-common/Wvarargs.c
> +++ b/gcc/testsuite/c-c++-common/Wvarargs.c
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-options "-std=gnu17" { target c } } */

Wasn't the test -pedantic-errors before?
Generally, I'd prefer dg-additional-options for tests
which don't already have dg-options into which one can just add the new
flag, or as in the above cases where a new flag is added only conditionally.
Just am not 100% sure if it works in lto tests...

> --- a/gcc/testsuite/c-c++-common/sizeof-array-argument.c
> +++ b/gcc/testsuite/c-c++-common/sizeof-array-argument.c
> @@ -1,5 +1,6 @@
>  /* PR c/6940 */
>  /* { dg-do compile } */
> +/* { dg-options "-Wno-old-style-definition" { target c } } */

Likewise.

> --- a/gcc/testsuite/gcc.c-torture/compile/20040214-2.c
> +++ b/gcc/testsuite/gcc.c-torture/compile/20040214-2.c
> @@ -1,4 +1,5 @@
>  /* http://gcc.gnu.org/ml/gcc-patches/2004-02/msg01307.html */
> +/* { dg-options "-std=gnu17" } */

I think better use dg-additional-options in gcc.c-torture/
(several times).  Wonder if dg-options e.g. doesn't override the
default -w.

> --- a/gcc/testsuite/gcc.c-torture/compile/pr100241-1.c
> +++ b/gcc/testsuite/gcc.c-torture/compile/pr100241-1.c
> @@ -1,5 +1,6 @@
>  /* { dg-require-visibility "" } */
> -/* { dg-options "-fvisibility=internal -fPIC" { target fpic } } */
> +/* { dg-options "-std=gnu17" { target { ! fpic } } } */
> +/* { dg-options "-std=gnu17 -fvisibility=internal -fPIC" { target fpic } } */

I'd keep it as is + dg-additional-options.  Duplicating the options is
errror-prone.

Otherwise LGTM.

        Jakub

Reply via email to