On 10/30/20 5:34 AM, Thomas Schwinge wrote: > Hi! > > On 2017-05-22T18:55:29+0200, Tom de Vries <tom_devr...@mentor.com> wrote: >> On 05/16/2017 03:12 PM, Rainer Orth wrote: >>> [...], but the new proc ['dg-line'] needs documenting in sourcebuild.texi. >> Attached patch adds the missing documentation. > OK to expand that with the attached patch to "Document that 'linenumvar' > in 'dg-line' may contain Tcl syntax"? (Hooray for embedded Tcl! -- > Don't hurt me; I (later) have a use case where this does make things > easier.) > > '{ dg-line LINENUMVAR }' > This DejaGnu directive sets the variable LINENUMVAR to the line > number of the source line. The variable LINENUMVAR, which must be > unique per testcase, may then be used in subsequent 'dg-error', > 'dg-warning', 'dg-message' and 'dg-bogus' directives. For example: > > int a; /* { dg-line first_def_a } */ > float a; /* { dg-error "conflicting types of" } */ > /* { dg-message "previous declaration of" "" { target *-*-* } > first_def_a } */ > > Note that LINENUMVAR may contain Tcl syntax, for example: > > #pragma acc parallel loop [...] /* { dg-line line[incr > line_count] } */ > /* { dg-message "note: [...]" "" { target *-*-* } > line$line_count } */ > /* { dg-message "optimized: [...]" "" { target *-*-* } > line$line_count } */ > for (int j = 0; j < nj; ++j) > { > #pragma acc loop [...] /* { dg-line line[incr line_count] > } */ > /* { dg-message "missed: [...]" "" { target *-*-* } > line$line_count } */ > /* { dg-message "optimized: [...]" "" { target *-*-* } > line$line_count } */ > /* { dg-message "note: [...]" "" { target *-*-* } > line$line_count } */ > for (int i = 0; i < ni; ++i) > > For each 'dg-line', this increments a counter variable 'line_count' > to construct unique 'line$line_count' names for LINENUMVAR: > 'line1', 'line2', .... The preceding 'dg-line' may then be > referred to via 'line$line_count'. > > > Grüße > Thomas > > > ----------------- > Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany > Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, > Alexander Walter > > 0001-Document-that-linenumvar-in-dg-line-may-contain-Tcl-.patch > > From 2211acd9a902a5cab874762166dbca116a98bea5 Mon Sep 17 00:00:00 2001 > From: Thomas Schwinge <tho...@codesourcery.com> > Date: Thu, 29 Oct 2020 07:04:54 +0100 > Subject: [PATCH] Document that 'linenumvar' in 'dg-line' may contain Tcl > syntax > > gcc/ > * doc/sourcebuild.texi (dg-line): Document that 'linenumvar' may > contain Tcl syntax. OK jeff