Hi Dave!

On 2026-10-26T20:28:09-0400, John David Anglin <[email protected]> wrote:
> testsuite: Fix g++.dg/gomp/deprecate-1.C on hppa targets (v2)

That's confusing (... to me), in several aspects.  ;-)

> The g++.dg/gomp/deprecate-1.C test fails on hppa targets (such as
> hppa64-hp-hpux11.11 and hppa-unknown-linux-gnu) because the leading '#'
> character is stripped from the diagnostic source line mirror snippet
> during metadirective warning expansions.

I have difficulties (a) parsing that last sentence, and (b) understanding
why/how '#' appearing as part of diagnostics would be handled differently
for HPPA vs. other targets?

Why is this (apparently) a problem only in 'g++.dg/gomp/deprecate-1.C',
but not 'gcc.dg/gomp/deprecate-1.c', which uses a lot of the same
patterns?

> This patch fixes the failure by restricting the rigid literal multiline

This test case 'g++.dg/gomp/deprecate-1.C' was added in 
commit d5320610cd3614a83ea1f2c8122a6cfbad987eab
"openmp: Provide fixit hints for -Wdeprecated-openmp diagnostics from C++ FE",
and I presume Jakub's intent was to test the exact multiline output
formatting -- which we've now (partly) lost?

> block to non-hppa targets, and appending target-specific dg-regexp
> directives to the end of the file to gracefully consume the unhashed
> caret fragments on PA-RISC architectures without altering file line
> indices.

As far as I can tell, there doesn't exist a concept of "target-specific
dg-regexp directives": 'dg-regexp' effectively only considers its first
argument, and silently drops everything else.

(Of course, that's not the most friendly API, and also it's not
documented in 'gcc/doc/sourcebuild.texi' at all.  ..., and I've just
realized that I already had filed <https://gcc.gnu.org/PR119511>
"Harden 'dg-regexp', fix misuses"...)  ;-)

> gcc/testsuite/ChangeLog:
>
>       * g++.dg/gomp/deprecate-1.C: Restrict the final literal multiline
>       verification block to non-hppa targets, and append trailing
>       dg-regexp directives to consume the unhashed diagnostic caret
>       fragments on hppa targets.

> --- a/gcc/testsuite/g++.dg/gomp/deprecate-1.C
> +++ b/gcc/testsuite/g++.dg/gomp/deprecate-1.C
> @@ -109,16 +109,14 @@ bar ()
>     { dg-end-multiline-output "" } */
>    ;
>    #pragma omp master                         /* { dg-warning "'master' 
> construct deprecated since OpenMP 5.1, use 'masked'" } */
> -/* { dg-begin-multiline-output "" }
> +/* { dg-begin-multiline-output "" { target { ! hppa*-*-* } } }
>     #pragma omp master
>                                                                               
>                                                        ^
>     { dg-end-multiline-output "" } */
>    ;
>    #pragma omp metadirective when (device={arch("blahblah")}: nothing) 
> default (nothing)              /* { dg-warning "'default' clause on 
> metadirectives deprecated since OpenMP 5.2, use 'otherwise'" } */
> -/* { dg-begin-multiline-output "" }
> -   #pragma omp metadirective when (device={arch("blahblah")}: nothing) 
> default (nothing)
> -                                                                       
> ^~~~~~~
> -                                                                       
> otherwise
> -   { dg-end-multiline-output "" } */

Was it intentional that you've dropped this multiline output check
entirely, instead of restricting to 'target { ! hppa*-*-* }' (as above)?

> +/* { dg-regexp ".*pragma omp metadirective when.*" { target hppa*-*-* } } */
> +/* { dg-regexp ".*\\^~~~~~~.*" { target hppa*-*-* } } */
> +/* { dg-regexp ".*otherwise.*" { target hppa*-*-* } } */
>    ;
>  }

As per my comment above, while the '{ target hppa*-*-* }' appears to
conditionalize this DejaGnu directive in the usual way, in reality it
doesn't, so these 'dg-regexp's are actually effective unconditionally.
They PASS, at least, but not anymore fully testing what was intended to
be tested.

I don't want us to get hung up about this one test case, but...  :-)


Grüße
 Thomas

Reply via email to