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

Reply via email to