From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 125914 invoked by alias); 11 Jun 2017 00:42:32 -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 125894 invoked by uid 89); 11 Jun 2017 00:42:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: gate.crashing.org Received: from gate.crashing.org (HELO gate.crashing.org) (63.228.1.57) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 11 Jun 2017 00:42:31 +0000 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.13.8) with ESMTP id v5B0gNue026080; Sat, 10 Jun 2017 19:42:23 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id v5B0gLC1026079; Sat, 10 Jun 2017 19:42:21 -0500 Date: Sun, 11 Jun 2017 00:42:00 -0000 From: Segher Boessenkool To: Tom de Vries Cc: GCC Patches , Jakub Jelinek , Rainer Orth , Mike Stump Subject: Re: [RFC] Dejagnu patch to handle multi-line directives Message-ID: <20170611004221.GP19687@gate.crashing.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-IsSubscribed: yes X-SW-Source: 2017-06/txt/msg00719.txt.bz2 Hi! On Sat, Jun 10, 2017 at 10:03:04AM +0200, Tom de Vries wrote: > >/* { dg-additional-options } > > { dg-dc "-DSTACK_SIZE=[dg-effective-target-value stack_size]" } > > { dg-dc { target { stack_size } } } */ > >... > > > >Good idea to fix this? I like it. What is the exact semantics though? What directives does this not work on? > 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 you use {} instead of "" you don't need all these backslashes. If you use expanded syntax (see "man tcl re_syntax") you can make it even more readable (and you don't need the join) (but it is a short regexp anyway). You might want to use \s instead of [ \t]. Segher