From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 53537 invoked by alias); 10 Jun 2017 08:03:17 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 53514 invoked by uid 89); 10 Jun 2017 08:03:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.5 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 10 Jun 2017 08:03:14 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-MBX-04.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1dJbMb-0007Kr-6m from Tom_deVries@mentor.com ; Sat, 10 Jun 2017 01:03:17 -0700 Received: from [127.0.0.1] (137.202.0.87) by SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Sat, 10 Jun 2017 09:03:12 +0100 Subject: Re: [RFC] Dejagnu patch to handle multi-line directives From: Tom de Vries To: GCC Patches CC: Jakub Jelinek , Rainer Orth , Mike Stump References: Message-ID: Date: Sat, 10 Jun 2017 08:03:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------55A50F4508E7B8F22224C157" X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) X-SW-Source: 2017-06/txt/msg00701.txt.bz2 --------------55A50F4508E7B8F22224C157 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-length: 776 [ attached patch ] On 06/10/2017 09:57 AM, Tom de Vries wrote: > Hi, > > one thing that has bothered me on a regular basis is the inability to > spread long dejagnu directives over multiple lines. > > I've written a demonstrator patch (for the dejagnu sources) and tested > it by splitting this 108 chars line: > ... > /* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value > stack_size]" { target { stack_size } } } */ > ... > into: > ... > /* { dg-additional-options } > { dg-dc "-DSTACK_SIZE=[dg-effective-target-value stack_size]" } > { dg-dc { target { stack_size } } } */ > ... > > Good idea to fix this? > > Good idea to fix this like this? > > If so, any other comments, before I suggest this at dejagnu project? > > Thanks, > - Tom > --------------55A50F4508E7B8F22224C157 Content-Type: text/x-patch; name="0001-Add-dg-dc-support.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="0001-Add-dg-dc-support.patch" Content-length: 1827 Add dg-dc support --- lib/dg.exp | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 4 deletions(-) diff --git a/lib/dg.exp b/lib/dg.exp index 7a894cb..67f46ab 100644 --- a/lib/dg.exp +++ b/lib/dg.exp @@ -181,15 +181,64 @@ proc dg-format-linenum { linenum } { # we return: # # { dg-prms-id 1 1234 } { dg-build 2 fatal "some comment" } +# +# Directive dg-dc (short for dg-directive-continue) can be used for multi-line +# directives. This: +# +# /* { dg-x a b c } */ +# +# is equivalent to: +# +# /* { dg-x } */ +# /* { dg-dc a b } */ +# /* { dg-dc c } */ +# +# and to: +# +# /* { dg-x a } */ +# /* { dg-dc b c} */ proc dg-get-options { prog } { set result "" - - set tmp [grep $prog "{\[ \t\]\+dg-\[-a-z\]\+\[ \t\]\+.*\[ \t\]\+}" line] + set cmd_prev "" + + set grep_pattern [join { + "{" + "\[ \t\]\+" + "dg-\[-a-z\]\+" + "\[ \t\]\+" + "(.*\[ \t\]\+)?" + "}" + } ""] + set tmp [grep $prog $grep_pattern line] if {![string match "" $tmp]} { + set pattern [join { + "(\[0-9\]+)" + "\[ \t\]+" + "{" + "\[ \t\]+" + "(dg-\[-a-z\]+)" + "\[ \t\]+" + "((.*)\[ \t\]+)?" + "}" + "\[^\}\]*" + "(\n|$)" + } ""] foreach i $tmp { - regexp "(\[0-9\]+)\[ \t\]+{\[ \t\]+(dg-\[-a-z\]+)\[ \t\]+(.*)\[ \t\]+}\[^\}\]*(\n|$)" $i i line cmd args - append result " { $cmd $line $args }" + regexp $pattern $i dummy line cmd ws_args args + if { "$cmd" == "dg-dc" } { + set args_prev "$args_prev $args" + } else { + if { "$cmd_prev" != "" } { + append result " { $cmd_prev $line_prev $args_prev }" + } + set cmd_prev $cmd + set line_prev $line + set args_prev "$args" + } + } + if { "$cmd_prev" != "" } { + append result " { $cmd_prev $line_prev $args_prev }" } } return $result --------------55A50F4508E7B8F22224C157--