public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, gfortran] Cleanup the submodule tests
@ 2017-04-15 11:01 Dominique d'Humières
  2017-04-15 13:57 ` Janus Weil
  0 siblings, 1 reply; 11+ messages in thread
From: Dominique d'Humières @ 2017-04-15 11:01 UTC (permalink / raw)
  To: Paul Richard Thomas; +Cc: fortran, gcc-patches

Hi!

Unless someone objects, I am planning to commit the following cleanup

--- ../_clean/gcc/testsuite/gfortran.dg/submodule_17.f08	2016-08-24 21:57:16.000000000 +0200
+++ gcc/testsuite/gfortran.dg/submodule_17.f08	2017-04-15 10:19:32.000000000 +0200
@@ -25,3 +25,4 @@ end submodule
   use hello_interface
   if (get() .ne. string) call abort
 end
+! { dg-final { cleanup-submodules "hello_interface@hello_implementation" } }
--- ../_clean/gcc/testsuite/gfortran.dg/submodule_22.f08	2016-11-27 20:08:35.000000000 +0100
+++ gcc/testsuite/gfortran.dg/submodule_22.f08	2017-04-15 10:21:50.000000000 +0200
@@ -45,3 +45,5 @@ contains
     s = 2.0
   end subroutine sub3
 end
+! { dg-final { cleanup-submodules "mtop@submod" } }
+! { dg-final { cleanup-submodules "mtop@subsubmod" } }
--- ../_clean/gcc/testsuite/gfortran.dg/submodule_23.f90	2017-02-19 19:28:37.000000000 +0100
+++ gcc/testsuite/gfortran.dg/submodule_23.f90	2017-04-15 10:26:53.000000000 +0200
@@ -27,3 +27,4 @@ end submodule
   use mod
   print *, fun1(10)
 end
+! { dg-final { cleanup-submodules "mod@submod" } }
--- ../_clean/gcc/testsuite/gfortran.dg/submodule_24.f08	2017-02-19 22:13:44.000000000 +0100
+++ gcc/testsuite/gfortran.dg/submodule_24.f08	2017-04-15 10:11:15.000000000 +0200
@@ -21,3 +21,4 @@ contains
     end procedure
    !end subroutine ! gfortran accepted this invalid workaround
 end submodule
+! { dg-final { cleanup-submodules "foo_interface@foo_implementation" } }
--- ../_clean/gcc/testsuite/gfortran.dg/submodule_26.f08	2017-03-18 13:14:10.000000000 +0100
+++ gcc/testsuite/gfortran.dg/submodule_26.f08	2017-04-15 10:13:03.000000000 +0200
@@ -44,3 +44,4 @@ contains
   module procedure cgca_clvgp
   end procedure cgca_clvgp
 end submodule m3clvg_sm3
+! { dg-final { cleanup-submodules "cgca_m3clvg@m3clvg_sm3" } }
--- ../_clean/gcc/testsuite/gfortran.dg/submodule_27.f08	2017-03-18 13:14:10.000000000 +0100
+++ gcc/testsuite/gfortran.dg/submodule_27.f08	2017-04-15 10:13:35.000000000 +0200
@@ -42,3 +42,4 @@ end submodule m3clvg_sm3
   call cgca_clvgp (hello)
   if (trim (greeting) .ne. "hello") call abort
 end
+! { dg-final { cleanup-submodules "cgca_m3clvg@m3clvg_sm3" } }
--- ../_clean/gcc/testsuite/gfortran.dg/submodule_28.f08	2017-03-18 13:48:04.000000000 +0100
+++ gcc/testsuite/gfortran.dg/submodule_28.f08	2017-04-15 10:14:32.000000000 +0200
@@ -50,3 +50,4 @@ program hello
   call routine1(2)
   if (answer .ne. 4) call abort
 end program
+! { dg-final { cleanup-submodules "my_mod@my_submod" } }

Dominique

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH, gfortran] Cleanup the submodule tests
  2017-04-15 11:01 [PATCH, gfortran] Cleanup the submodule tests Dominique d'Humières
@ 2017-04-15 13:57 ` Janus Weil
  2017-04-15 14:46   ` Dominique d'Humières
  0 siblings, 1 reply; 11+ messages in thread
From: Janus Weil @ 2017-04-15 13:57 UTC (permalink / raw)
  To: Dominique d'Humières; +Cc: Paul Richard Thomas, gfortran, gcc-patches

Hi Dominique,

if I'm not mistaken, the cleanup of module file in the testsuite is
done automatically by now, right? Couldn't one do the same also for
submodules?

Cheers,
Janus



2017-04-15 10:34 GMT+02:00 Dominique d'Humières <dominiq@lps.ens.fr>:
> Hi!
>
> Unless someone objects, I am planning to commit the following cleanup
>
> --- ../_clean/gcc/testsuite/gfortran.dg/submodule_17.f08        2016-08-24 21:57:16.000000000 +0200
> +++ gcc/testsuite/gfortran.dg/submodule_17.f08  2017-04-15 10:19:32.000000000 +0200
> @@ -25,3 +25,4 @@ end submodule
>    use hello_interface
>    if (get() .ne. string) call abort
>  end
> +! { dg-final { cleanup-submodules "hello_interface@hello_implementation" } }
> --- ../_clean/gcc/testsuite/gfortran.dg/submodule_22.f08        2016-11-27 20:08:35.000000000 +0100
> +++ gcc/testsuite/gfortran.dg/submodule_22.f08  2017-04-15 10:21:50.000000000 +0200
> @@ -45,3 +45,5 @@ contains
>      s = 2.0
>    end subroutine sub3
>  end
> +! { dg-final { cleanup-submodules "mtop@submod" } }
> +! { dg-final { cleanup-submodules "mtop@subsubmod" } }
> --- ../_clean/gcc/testsuite/gfortran.dg/submodule_23.f90        2017-02-19 19:28:37.000000000 +0100
> +++ gcc/testsuite/gfortran.dg/submodule_23.f90  2017-04-15 10:26:53.000000000 +0200
> @@ -27,3 +27,4 @@ end submodule
>    use mod
>    print *, fun1(10)
>  end
> +! { dg-final { cleanup-submodules "mod@submod" } }
> --- ../_clean/gcc/testsuite/gfortran.dg/submodule_24.f08        2017-02-19 22:13:44.000000000 +0100
> +++ gcc/testsuite/gfortran.dg/submodule_24.f08  2017-04-15 10:11:15.000000000 +0200
> @@ -21,3 +21,4 @@ contains
>      end procedure
>     !end subroutine ! gfortran accepted this invalid workaround
>  end submodule
> +! { dg-final { cleanup-submodules "foo_interface@foo_implementation" } }
> --- ../_clean/gcc/testsuite/gfortran.dg/submodule_26.f08        2017-03-18 13:14:10.000000000 +0100
> +++ gcc/testsuite/gfortran.dg/submodule_26.f08  2017-04-15 10:13:03.000000000 +0200
> @@ -44,3 +44,4 @@ contains
>    module procedure cgca_clvgp
>    end procedure cgca_clvgp
>  end submodule m3clvg_sm3
> +! { dg-final { cleanup-submodules "cgca_m3clvg@m3clvg_sm3" } }
> --- ../_clean/gcc/testsuite/gfortran.dg/submodule_27.f08        2017-03-18 13:14:10.000000000 +0100
> +++ gcc/testsuite/gfortran.dg/submodule_27.f08  2017-04-15 10:13:35.000000000 +0200
> @@ -42,3 +42,4 @@ end submodule m3clvg_sm3
>    call cgca_clvgp (hello)
>    if (trim (greeting) .ne. "hello") call abort
>  end
> +! { dg-final { cleanup-submodules "cgca_m3clvg@m3clvg_sm3" } }
> --- ../_clean/gcc/testsuite/gfortran.dg/submodule_28.f08        2017-03-18 13:48:04.000000000 +0100
> +++ gcc/testsuite/gfortran.dg/submodule_28.f08  2017-04-15 10:14:32.000000000 +0200
> @@ -50,3 +50,4 @@ program hello
>    call routine1(2)
>    if (answer .ne. 4) call abort
>  end program
> +! { dg-final { cleanup-submodules "my_mod@my_submod" } }
>
> Dominique
>

2017-04-15 10:34 GMT+02:00 Dominique d'Humières <dominiq@lps.ens.fr>:
> Hi!
>
> Unless someone objects, I am planning to commit the following cleanup
>
> --- ../_clean/gcc/testsuite/gfortran.dg/submodule_17.f08        2016-08-24 21:57:16.000000000 +0200
> +++ gcc/testsuite/gfortran.dg/submodule_17.f08  2017-04-15 10:19:32.000000000 +0200
> @@ -25,3 +25,4 @@ end submodule
>    use hello_interface
>    if (get() .ne. string) call abort
>  end
> +! { dg-final { cleanup-submodules "hello_interface@hello_implementation" } }
> --- ../_clean/gcc/testsuite/gfortran.dg/submodule_22.f08        2016-11-27 20:08:35.000000000 +0100
> +++ gcc/testsuite/gfortran.dg/submodule_22.f08  2017-04-15 10:21:50.000000000 +0200
> @@ -45,3 +45,5 @@ contains
>      s = 2.0
>    end subroutine sub3
>  end
> +! { dg-final { cleanup-submodules "mtop@submod" } }
> +! { dg-final { cleanup-submodules "mtop@subsubmod" } }
> --- ../_clean/gcc/testsuite/gfortran.dg/submodule_23.f90        2017-02-19 19:28:37.000000000 +0100
> +++ gcc/testsuite/gfortran.dg/submodule_23.f90  2017-04-15 10:26:53.000000000 +0200
> @@ -27,3 +27,4 @@ end submodule
>    use mod
>    print *, fun1(10)
>  end
> +! { dg-final { cleanup-submodules "mod@submod" } }
> --- ../_clean/gcc/testsuite/gfortran.dg/submodule_24.f08        2017-02-19 22:13:44.000000000 +0100
> +++ gcc/testsuite/gfortran.dg/submodule_24.f08  2017-04-15 10:11:15.000000000 +0200
> @@ -21,3 +21,4 @@ contains
>      end procedure
>     !end subroutine ! gfortran accepted this invalid workaround
>  end submodule
> +! { dg-final { cleanup-submodules "foo_interface@foo_implementation" } }
> --- ../_clean/gcc/testsuite/gfortran.dg/submodule_26.f08        2017-03-18 13:14:10.000000000 +0100
> +++ gcc/testsuite/gfortran.dg/submodule_26.f08  2017-04-15 10:13:03.000000000 +0200
> @@ -44,3 +44,4 @@ contains
>    module procedure cgca_clvgp
>    end procedure cgca_clvgp
>  end submodule m3clvg_sm3
> +! { dg-final { cleanup-submodules "cgca_m3clvg@m3clvg_sm3" } }
> --- ../_clean/gcc/testsuite/gfortran.dg/submodule_27.f08        2017-03-18 13:14:10.000000000 +0100
> +++ gcc/testsuite/gfortran.dg/submodule_27.f08  2017-04-15 10:13:35.000000000 +0200
> @@ -42,3 +42,4 @@ end submodule m3clvg_sm3
>    call cgca_clvgp (hello)
>    if (trim (greeting) .ne. "hello") call abort
>  end
> +! { dg-final { cleanup-submodules "cgca_m3clvg@m3clvg_sm3" } }
> --- ../_clean/gcc/testsuite/gfortran.dg/submodule_28.f08        2017-03-18 13:48:04.000000000 +0100
> +++ gcc/testsuite/gfortran.dg/submodule_28.f08  2017-04-15 10:14:32.000000000 +0200
> @@ -50,3 +50,4 @@ program hello
>    call routine1(2)
>    if (answer .ne. 4) call abort
>  end program
> +! { dg-final { cleanup-submodules "my_mod@my_submod" } }
>
> Dominique
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH, gfortran] Cleanup the submodule tests
  2017-04-15 13:57 ` Janus Weil
@ 2017-04-15 14:46   ` Dominique d'Humières
  2017-04-15 15:17     ` Janus Weil
  0 siblings, 1 reply; 11+ messages in thread
From: Dominique d'Humières @ 2017-04-15 14:46 UTC (permalink / raw)
  To: Janus Weil; +Cc: Paul Richard Thomas, gfortran, gcc-patches


> Le 15 avr. 2017 à 13:00, Janus Weil <janus@gcc.gnu.org> a écrit :
> 
> Hi Dominique,
> 
> if I'm not mistaken, the cleanup of module file in the testsuite is
> done automatically by now, right? Couldn't one do the same also for
> submodules?
> 
> Cheers,
> Janus
> 

This is indeed doable, but before I’ld like to improve the module cleanup with the following patch (+remove all the non-necessary module cleanup)

--- ../_clean/gcc/testsuite/lib/fortran-modules.exp	2017-01-01 17:38:58.000000000 +0100
+++ gcc/testsuite/lib/fortran-modules.exp	2017-01-03 09:19:02.000000000 +0100
@@ -79,10 +79,11 @@ proc list-module-names { files } {
 
 proc list-module-names-1 { file } {
     set result {}
-    set tmp [grep $file "^\[ \t\]*((#)?\[ \t\]*include|\[mM\]\[oO\]\[dD\]\[uU\]\[lL\]\[eE\](?!\[ \t\]+\[pP\]\[rR\]\[oO\]\[cC\]\[eE\]\[dD\]\[uU\]\[rR\]\[eE\]\[ \t\]+))\[ \t\]+.*" line]
+    if {[file isdirectory $file]} {return}
+    set tmp [igrep $file "^\[ \t\]*((#)?\[ \t\]*include|module(?!\[ \t\]+procedure\[ \t\]+))\[ \t\]+.*" line]
     if {![string match "" $tmp]} {
 	foreach i $tmp {
-	    regexp "(\[0-9\]+)\[ \t\]+(?:(?:#)?\[ \t\]*include\[ \t\]+)\[\"\](\[^\"\]*)\[\"\]" $i dummy lineno include_file
+	    regexp -nocase "(\[0-9\]+)\[ \t\]+(?:(?:#)?\[ \t\]*include\[ \t\]+)\[\"\'\](\[^\"\'\]*)\[\"\'\]" $i dummy lineno include_file
 	    if {[info exists include_file]} {
 		set dir [file dirname $file]
 		set inc "$dir/$include_file"
@@ -99,7 +100,7 @@ proc list-module-names-1 { file } {
 		}
 		continue
 	    }
-	    regexp "(\[0-9\]+)\[ \t\]+(?:(\[mM\]\[oO\]\[dD\]\[uU\]\[lL\]\[eE\]\[ \t\]+(?!\[pP\]\[rR\]\[oO\]\[cC\]\[eE\]\[dD\]\[uU\]\[rR\]\[eE\]\[ \t\]+)))(\[^ \t;\]*)" $i i lineno keyword mod
+	    regexp -nocase "(\[0-9\]+)\[ \t\]+(?:(\module\[ \t\]+(?!procedure\[ \t\]+)))(\[^ \t;\]*)" $i i lineno keyword mod
 	    if {![info exists lineno]} {
 		continue
 	    }
@@ -111,3 +112,54 @@ proc list-module-names-1 { file } {
     }
     return $result
 }
+
+# Looks for case insensitive occurrences of a string in a file.
+#     return:list of lines that matched or NULL if none match.
+#     args:  first arg is the filename,
+#            second is the pattern,
+#            third are any options.
+#     Options: line  - puts line numbers of match in list
+#
+proc igrep { args } {
+
+    set file [lindex $args 0]
+    set pattern [lindex $args 1]
+
+    verbose "Grepping $file for the pattern \"$pattern\"" 3
+
+    set argc [llength $args]
+    if { $argc > 2 } {
+        for { set i 2 } { $i < $argc } { incr i } {
+            append options [lindex $args $i]
+            append options " "
+        }
+    } else {
+        set options ""
+    }
+
+    set i 0
+    set fd [open $file r]
+    while { [gets $fd cur_line]>=0 } {
+        incr i
+        if {[regexp -nocase -- "$pattern" $cur_line match]} {
+            if {![string match "" $options]} {
+                foreach opt $options {
+                    switch $opt {
+                        "line" {
+                            lappend grep_out [concat $i $match]
+                        }
+                    }
+                }
+            } else {
+                lappend grep_out $match
+            }
+        }
+    }
+    close $fd
+    unset fd
+    unset i
+    if {![info exists grep_out]} {
+        set grep_out ""
+    }
+    return $grep_out
+}

Dominique

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH, gfortran] Cleanup the submodule tests
  2017-04-15 14:46   ` Dominique d'Humières
@ 2017-04-15 15:17     ` Janus Weil
  2017-04-15 16:50       ` Dominique d'Humières
  0 siblings, 1 reply; 11+ messages in thread
From: Janus Weil @ 2017-04-15 15:17 UTC (permalink / raw)
  To: Dominique d'Humières; +Cc: Paul Richard Thomas, gfortran, gcc-patches

2017-04-15 15:57 GMT+02:00 Dominique d'Humières <dominiq@lps.ens.fr>:
>
>> Le 15 avr. 2017 à 13:00, Janus Weil <janus@gcc.gnu.org> a écrit :
>>
>> Hi Dominique,
>>
>> if I'm not mistaken, the cleanup of module file in the testsuite is
>> done automatically by now, right? Couldn't one do the same also for
>> submodules?
>>
>> Cheers,
>> Janus
>>
>
> This is indeed doable, but before I’ld like to improve the module cleanup with the following patch

Yes, looks very useful to me (makes the regexps much more compact &
readable). In addition, couldn't one use \s for whitespace instead of
\[ \t\]   ?

I assume your igrep is just a copy of dejagnu's grep with an additional -nocase?

Cheers,
Janus



> --- ../_clean/gcc/testsuite/lib/fortran-modules.exp     2017-01-01 17:38:58.000000000 +0100
> +++ gcc/testsuite/lib/fortran-modules.exp       2017-01-03 09:19:02.000000000 +0100
> @@ -79,10 +79,11 @@ proc list-module-names { files } {
>
>  proc list-module-names-1 { file } {
>      set result {}
> -    set tmp [grep $file "^\[ \t\]*((#)?\[ \t\]*include|\[mM\]\[oO\]\[dD\]\[uU\]\[lL\]\[eE\](?!\[ \t\]+\[pP\]\[rR\]\[oO\]\[cC\]\[eE\]\[dD\]\[uU\]\[rR\]\[eE\]\[ \t\]+))\[ \t\]+.*" line]
> +    if {[file isdirectory $file]} {return}
> +    set tmp [igrep $file "^\[ \t\]*((#)?\[ \t\]*include|module(?!\[ \t\]+procedure\[ \t\]+))\[ \t\]+.*" line]
>      if {![string match "" $tmp]} {
>         foreach i $tmp {
> -           regexp "(\[0-9\]+)\[ \t\]+(?:(?:#)?\[ \t\]*include\[ \t\]+)\[\"\](\[^\"\]*)\[\"\]" $i dummy lineno include_file
> +           regexp -nocase "(\[0-9\]+)\[ \t\]+(?:(?:#)?\[ \t\]*include\[ \t\]+)\[\"\'\](\[^\"\'\]*)\[\"\'\]" $i dummy lineno include_file
>             if {[info exists include_file]} {
>                 set dir [file dirname $file]
>                 set inc "$dir/$include_file"
> @@ -99,7 +100,7 @@ proc list-module-names-1 { file } {
>                 }
>                 continue
>             }
> -           regexp "(\[0-9\]+)\[ \t\]+(?:(\[mM\]\[oO\]\[dD\]\[uU\]\[lL\]\[eE\]\[ \t\]+(?!\[pP\]\[rR\]\[oO\]\[cC\]\[eE\]\[dD\]\[uU\]\[rR\]\[eE\]\[ \t\]+)))(\[^ \t;\]*)" $i i lineno keyword mod
> +           regexp -nocase "(\[0-9\]+)\[ \t\]+(?:(\module\[ \t\]+(?!procedure\[ \t\]+)))(\[^ \t;\]*)" $i i lineno keyword mod
>             if {![info exists lineno]} {
>                 continue
>             }
> @@ -111,3 +112,54 @@ proc list-module-names-1 { file } {
>      }
>      return $result
>  }
> +
> +# Looks for case insensitive occurrences of a string in a file.
> +#     return:list of lines that matched or NULL if none match.
> +#     args:  first arg is the filename,
> +#            second is the pattern,
> +#            third are any options.
> +#     Options: line  - puts line numbers of match in list
> +#
> +proc igrep { args } {
> +
> +    set file [lindex $args 0]
> +    set pattern [lindex $args 1]
> +
> +    verbose "Grepping $file for the pattern \"$pattern\"" 3
> +
> +    set argc [llength $args]
> +    if { $argc > 2 } {
> +        for { set i 2 } { $i < $argc } { incr i } {
> +            append options [lindex $args $i]
> +            append options " "
> +        }
> +    } else {
> +        set options ""
> +    }
> +
> +    set i 0
> +    set fd [open $file r]
> +    while { [gets $fd cur_line]>=0 } {
> +        incr i
> +        if {[regexp -nocase -- "$pattern" $cur_line match]} {
> +            if {![string match "" $options]} {
> +                foreach opt $options {
> +                    switch $opt {
> +                        "line" {
> +                            lappend grep_out [concat $i $match]
> +                        }
> +                    }
> +                }
> +            } else {
> +                lappend grep_out $match
> +            }
> +        }
> +    }
> +    close $fd
> +    unset fd
> +    unset i
> +    if {![info exists grep_out]} {
> +        set grep_out ""
> +    }
> +    return $grep_out
> +}
>
> Dominique
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH, gfortran] Cleanup the submodule tests
  2017-04-15 15:17     ` Janus Weil
@ 2017-04-15 16:50       ` Dominique d'Humières
  2017-04-15 18:18         ` Janus Weil
  0 siblings, 1 reply; 11+ messages in thread
From: Dominique d'Humières @ 2017-04-15 16:50 UTC (permalink / raw)
  To: Janus Weil; +Cc: Paul Richard Thomas, gfortran, gcc-patches


> Le 15 avr. 2017 à 17:13, Janus Weil <janus@gcc.gnu.org> a écrit :
> 
> 2017-04-15 15:57 GMT+02:00 Dominique d'Humières <dominiq@lps.ens.fr>:
>> 
>>> Le 15 avr. 2017 à 13:00, Janus Weil <janus@gcc.gnu.org> a écrit :
>>> 
>>> Hi Dominique,
>>> 
>>> if I'm not mistaken, the cleanup of module file in the testsuite is
>>> done automatically by now, right? Couldn't one do the same also for
>>> submodules?
>>> 
>>> Cheers,
>>> Janus
>>> 
>> 
>> This is indeed doable, but before I’ld like to improve the module cleanup with the following patch
> 
> Yes, looks very useful to me (makes the regexps much more compact &
> readable). In addition, couldn't one use \s for whitespace instead of
> \[ \t\]   ?

I have posted what I have in my working tree. I’ll test the use of \s instead of \[ \t\] . Is it really portable?
> 
> 
> I assume your igrep is just a copy of dejagnu's grep with an additional -nocase?

Yes!

> Cheers,
> Janus

Dominique

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH, gfortran] Cleanup the submodule tests
  2017-04-15 16:50       ` Dominique d'Humières
@ 2017-04-15 18:18         ` Janus Weil
  2017-04-16  8:37           ` Dominique d'Humières
  0 siblings, 1 reply; 11+ messages in thread
From: Janus Weil @ 2017-04-15 18:18 UTC (permalink / raw)
  To: Dominique d'Humières; +Cc: Paul Richard Thomas, gfortran, gcc-patches

2017-04-15 17:54 GMT+02:00 Dominique d'Humières <dominiq@lps.ens.fr>:
>>> This is indeed doable, but before I’ld like to improve the module cleanup with the following patch
>>
>> Yes, looks very useful to me (makes the regexps much more compact &
>> readable). In addition, couldn't one use \s for whitespace instead of
>> \[ \t\]   ?
>
> I have posted what I have in my working tree. I’ll test the use of \s instead of \[ \t\] . Is it really portable?

Not sure. But at least some of the other files in gcc/testsuite/lib
seem to use \s as well (e.g. gcc-dg.exp).


>> I assume your igrep is just a copy of dejagnu's grep with an additional -nocase?
>
> Yes!

Ok to commit  from my side, if you have tested that it works properly.

Cheers,
Janus

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH, gfortran] Cleanup the submodule tests
  2017-04-15 18:18         ` Janus Weil
@ 2017-04-16  8:37           ` Dominique d'Humières
  2017-04-17  9:08             ` Janus Weil
  0 siblings, 1 reply; 11+ messages in thread
From: Dominique d'Humières @ 2017-04-16  8:37 UTC (permalink / raw)
  To: Janus Weil; +Cc: Paul Richard Thomas, gfortran, gcc-patches

I am currently testing the following patch that handle both modules and submodules. It is a little bit clumsy and may not handle all the possible syntax variants. Any comment welcomed!-) Testing in progress.

Dominique

--- ../_clean/gcc/testsuite/lib/fortran-modules.exp	2017-01-01 17:38:58.000000000 +0100
+++ gcc/testsuite/lib/fortran-modules.exp	2017-04-16 01:16:25.000000000 +0200
@@ -79,10 +79,11 @@ proc list-module-names { files } {
 
 proc list-module-names-1 { file } {
     set result {}
-    set tmp [grep $file "^\[ \t\]*((#)?\[ \t\]*include|\[mM\]\[oO\]\[dD\]\[uU\]\[lL\]\[eE\](?!\[ \t\]+\[pP\]\[rR\]\[oO\]\[cC\]\[eE\]\[dD\]\[uU\]\[rR\]\[eE\]\[ \t\]+))\[ \t\]+.*" line]
+    if {[file isdirectory $file]} {return}
+    set tmp [igrep $file "^\\s*((#)?\\s*include|(sub)?module(?!\\s+(recursive\\s+)?(procedure|subroutine|function)\\s*))\\s*.*" line]
     if {![string match "" $tmp]} {
 	foreach i $tmp {
-	    regexp "(\[0-9\]+)\[ \t\]+(?:(?:#)?\[ \t\]*include\[ \t\]+)\[\"\](\[^\"\]*)\[\"\]" $i dummy lineno include_file
+	    regexp -nocase "(\[0-9\]+)\\s+(?:(?:#)?\\s*include\\s+)\[\"\'\](\[^\"\'\]*)\[\"\'\]" $i dummy lineno include_file
 	    if {[info exists include_file]} {
 		set dir [file dirname $file]
 		set inc "$dir/$include_file"
@@ -99,7 +100,11 @@ proc list-module-names-1 { file } {
 		}
 		continue
 	    }
-	    regexp "(\[0-9\]+)\[ \t\]+(?:(\[mM\]\[oO\]\[dD\]\[uU\]\[lL\]\[eE\]\[ \t\]+(?!\[pP\]\[rR\]\[oO\]\[cC\]\[eE\]\[dD\]\[uU\]\[rR\]\[eE\]\[ \t\]+)))(\[^ \t;\]*)" $i i lineno keyword mod
+	    regexp -nocase "(\[0-9\]+)\\s+(module|submodule)\\s*(\[^;\]*)" $i i lineno keyword mod
+	    regsub "\\s*!.*" $mod "" mod
+	    regsub ":\[^)\]*" $mod "" mod
+	    regsub "\\(\\s*" $mod "" mod
+	    regsub "\\s*\\)\\s*" $mod "@" mod
 	    if {![info exists lineno]} {
 		continue
 	    }
@@ -111,3 +116,54 @@ proc list-module-names-1 { file } {
     }
     return $result
 }
+
+# Looks for case insensitive occurrences of a string in a file.
+#     return:list of lines that matched or NULL if none match.
+#     args:  first arg is the filename,
+#            second is the pattern,
+#            third are any options.
+#     Options: line  - puts line numbers of match in list
+#
+proc igrep { args } {
+
+    set file [lindex $args 0]
+    set pattern [lindex $args 1]
+
+    verbose "Grepping $file for the pattern \"$pattern\"" 3
+
+    set argc [llength $args]
+    if { $argc > 2 } {
+        for { set i 2 } { $i < $argc } { incr i } {
+            append options [lindex $args $i]
+            append options " "
+        }
+    } else {
+        set options ""
+    }
+
+    set i 0
+    set fd [open $file r]
+    while { [gets $fd cur_line]>=0 } {
+        incr i
+        if {[regexp -nocase -- "$pattern" $cur_line match]} {
+            if {![string match "" $options]} {
+                foreach opt $options {
+                    switch $opt {
+                        "line" {
+                            lappend grep_out [concat $i $match]
+                        }
+                    }
+                }
+            } else {
+                lappend grep_out $match
+            }
+        }
+    }
+    close $fd
+    unset fd
+    unset i
+    if {![info exists grep_out]} {
+        set grep_out ""
+    }
+    return $grep_out
+}

> Le 15 avr. 2017 à 18:50, Janus Weil <janus@gcc.gnu.org> a écrit :
> 
> 2017-04-15 17:54 GMT+02:00 Dominique d'Humières <dominiq@lps.ens.fr>:
>>>> This is indeed doable, but before I’ld like to improve the module cleanup with the following patch
>>> 
>>> Yes, looks very useful to me (makes the regexps much more compact &
>>> readable). In addition, couldn't one use \s for whitespace instead of
>>> \[ \t\]   ?
>> 
>> I have posted what I have in my working tree. I’ll test the use of \s instead of \[ \t\] . Is it really portable?
> 
> Not sure. But at least some of the other files in gcc/testsuite/lib
> seem to use \s as well (e.g. gcc-dg.exp).
> 
> 
>>> I assume your igrep is just a copy of dejagnu's grep with an additional -nocase?
>> 
>> Yes!
> 
> Ok to commit  from my side, if you have tested that it works properly.
> 
> Cheers,
> Janus

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH, gfortran] Cleanup the submodule tests
  2017-04-16  8:37           ` Dominique d'Humières
@ 2017-04-17  9:08             ` Janus Weil
  2017-04-17 15:57               ` Segher Boessenkool
       [not found]               ` <256853B4-70F5-43BD-A256-42942B1B4AA7@lps.ens.fr>
  0 siblings, 2 replies; 11+ messages in thread
From: Janus Weil @ 2017-04-17  9:08 UTC (permalink / raw)
  To: Dominique d'Humières; +Cc: Paul Richard Thomas, gfortran, gcc-patches

Hi Dominique,

> I am currently testing the following patch that handle both modules and submodules. It is a little bit clumsy and may not handle all the possible syntax variants. Any comment welcomed!-) Testing in progress.

so, how did the testing go?


>  proc list-module-names-1 { file } {
>      set result {}
> -    set tmp [grep $file "^\[ \t\]*((#)?\[ \t\]*include|\[mM\]\[oO\]\[dD\]\[uU\]\[lL\]\[eE\](?!\[ \t\]+\[pP\]\[rR\]\[oO\]\[cC\]\[eE\]\[dD\]\[uU\]\[rR\]\[eE\]\[ \t\]+))\[ \t\]+.*" line]
> +    if {[file isdirectory $file]} {return}
> +    set tmp [igrep $file "^\\s*((#)?\\s*include|(sub)?module(?!\\s+(recursive\\s+)?(procedure|subroutine|function)\\s*))\\s*.*" line]

This is supposed to catch all lines including "module", but not
"module procedure", "module subroutine" etc, right? Why do you need
"recursive" here, but no other attributes like "pure" or "elemental"?


>      if {![string match "" $tmp]} {
>         foreach i $tmp {
> -           regexp "(\[0-9\]+)\[ \t\]+(?:(?:#)?\[ \t\]*include\[ \t\]+)\[\"\](\[^\"\]*)\[\"\]" $i dummy lineno include_file
> +           regexp -nocase "(\[0-9\]+)\\s+(?:(?:#)?\\s*include\\s+)\[\"\'\](\[^\"\'\]*)\[\"\'\]" $i dummy lineno include_file

My regex sorcery may be a bit rusty, but why does \\s need a double
escape while \t appears with single escape?


> @@ -99,7 +100,11 @@ proc list-module-names-1 { file } {
>                 }
>                 continue
>             }
> -           regexp "(\[0-9\]+)\[ \t\]+(?:(\[mM\]\[oO\]\[dD\]\[uU\]\[lL\]\[eE\]\[ \t\]+(?!\[pP\]\[rR\]\[oO\]\[cC\]\[eE\]\[dD\]\[uU\]\[rR\]\[eE\]\[ \t\]+)))(\[^ \t;\]*)" $i i lineno keyword mod
> +           regexp -nocase "(\[0-9\]+)\\s+(module|submodule)\\s*(\[^;\]*)" $i i lineno keyword mod
> +           regsub "\\s*!.*" $mod "" mod
> +           regsub ":\[^)\]*" $mod "" mod
> +           regsub "\\(\\s*" $mod "" mod
> +           regsub "\\s*\\)\\s*" $mod "@" mod
>             if {![info exists lineno]} {
>                 continue
>             }

Not sure I understand this part. Guess I'm spending too little time
with regexps to find them readable :(

Cheers,
Janus

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH, gfortran] Cleanup the submodule tests
  2017-04-17  9:08             ` Janus Weil
@ 2017-04-17 15:57               ` Segher Boessenkool
       [not found]               ` <256853B4-70F5-43BD-A256-42942B1B4AA7@lps.ens.fr>
  1 sibling, 0 replies; 11+ messages in thread
From: Segher Boessenkool @ 2017-04-17 15:57 UTC (permalink / raw)
  To: Janus Weil
  Cc: Dominique d'Humières, Paul Richard Thomas, gfortran,
	gcc-patches

On Sun, Apr 16, 2017 at 10:13:07PM +0200, Janus Weil wrote:
> >      if {![string match "" $tmp]} {
> >         foreach i $tmp {
> > -           regexp "(\[0-9\]+)\[ \t\]+(?:(?:#)?\[ \t\]*include\[ \t\]+)\[\"\](\[^\"\]*)\[\"\]" $i dummy lineno include_file
> > +           regexp -nocase "(\[0-9\]+)\\s+(?:(?:#)?\\s*include\\s+)\[\"\'\](\[^\"\'\]*)\[\"\'\]" $i dummy lineno include_file
> 
> My regex sorcery may be a bit rusty, but why does \\s need a double
> escape while \t appears with single escape?

"\t" is a tab character.
"\\t" is the string \t (which in a regexp stands for a tab).
"\s" is just s (since \s is not a special character).
"\\s" is \s .

Since you do not want any substitution in the regexp string anyway, it is
way more readable if written as a braced string than as a double-quoted
string:

+           regexp -nocase {([0-9]+)\s+(?:(?:#)?\s*include\s+)["']([^"']*)["']} $i dummy lineno include_file

You can also write [0-9] as \d, and (?:#) as just # and the other (?:...)
doesn't do anything either.  So that gives

+           regexp -nocase {(\d+)\s+#?\s*include\s+["']([^"']*)["']} $i dummy lineno include_file

and a little bit more work may make it fit on a line even ;-)


Segher

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Fwd: [PATCH, gfortran] Cleanup the submodule tests
       [not found]               ` <256853B4-70F5-43BD-A256-42942B1B4AA7@lps.ens.fr>
@ 2017-06-04 12:54                 ` Dominique d'Humières
  2017-06-04 18:26                 ` Segher Boessenkool
  1 sibling, 0 replies; 11+ messages in thread
From: Dominique d'Humières @ 2017-06-04 12:54 UTC (permalink / raw)
  To: gfortran; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 4732 bytes --]



> Début du message réexpédié :
> 
> De: Dominique d'Humières <dominiq@lps.ens.fr>
> Objet: Rép : [PATCH, gfortran] Cleanup the submodule tests
> Date: 4 juin 2017 à 14:52:36 UTC+2
> À: Janus Weil <janus@gcc.gnu.org>
> Cc: Paul Richard Thomas <paul.richard.thomas@gmail.com>, segher@kernel.crashing.org, gfortran <fortran@gcc.gnu.org>, gcc-patches <gcc-patches@gcc.gnu.org>
> 
>> 
>> Le 16 avr. 2017 à 22:13, Janus Weil <janus@gcc.gnu.org> a écrit :
>> 
>> Hi Dominique,
>> 
>>> I am currently testing the following patch that handle both modules and submodules. It is a little bit clumsy and may not handle all the possible syntax variants. Any comment welcomed!-) Testing in progress.
>> 
>> so, how did the testing go?
> 
> It took more time than expected!-(everything should be fixed now, but for some cleanup-modules left as explained below.
> 
>>> proc list-module-names-1 { file } {
>>>     set result {}
>>> -    set tmp [grep $file "^\[ \t\]*((#)?\[ \t\]*include|\[mM\]\[oO\]\[dD\]\[uU\]\[lL\]\[eE\](?!\[ \t\]+\[pP\]\[rR\]\[oO\]\[cC\]\[eE\]\[dD\]\[uU\]\[rR\]\[eE\]\[ \t\]+))\[ \t\]+.*" line]
>>> +    if {[file isdirectory $file]} {return}
>>> +    set tmp [igrep $file "^\\s*((#)?\\s*include|(sub)?module(?!\\s+(recursive\\s+)?(procedure|subroutine|function)\\s*))\\s*.*" line]
>> 
>> This is supposed to catch all lines including "module", but not
>> "module procedure", "module subroutine" etc, right? Why do you need
>> "recursive" here, but no other attributes like "pure" or "elemental »
> 
> I need "recursive" because it is present in submodule_(4|14|16).f08. I have added "PURE|(IMPURE\s+)?ELEMENTAL », but this is untested.
> 
>>>     if {![string match "" $tmp]} {
>>>        foreach i $tmp {
>>> -           regexp "(\[0-9\]+)\[ \t\]+(?:(?:#)?\[ \t\]*include\[ \t\]+)\[\"\](\[^\"\]*)\[\"\]" $i dummy lineno include_file
>>> +           regexp -nocase "(\[0-9\]+)\\s+(?:(?:#)?\\s*include\\s+)\[\"\'\](\[^\"\'\]*)\[\"\'\]" $i dummy lineno include_file
>> 
>> My regex sorcery may be a bit rusty, but why does \\s need a double
>> escape while \t appears with single escape?
> 
> I have used the Segher’s tips.
> 
>>> @@ -99,7 +100,11 @@ proc list-module-names-1 { file } {
>>>                }
>>>                continue
>>>            }
>>> -           regexp "(\[0-9\]+)\[ \t\]+(?:(\[mM\]\[oO\]\[dD\]\[uU\]\[lL\]\[eE\]\[ \t\]+(?!\[pP\]\[rR\]\[oO\]\[cC\]\[eE\]\[dD\]\[uU\]\[rR\]\[eE\]\[ \t\]+)))(\[^ \t;\]*)" $i i lineno keyword mod
>>> +           regexp -nocase "(\[0-9\]+)\\s+(module|submodule)\\s*(\[^;\]*)" $i i lineno keyword mod
>>> +           regsub "\\s*!.*" $mod "" mod
>>> +           regsub ":\[^)\]*" $mod "" mod
>>> +           regsub "\\(\\s*" $mod "" mod
>>> +           regsub "\\s*\\)\\s*" $mod "@" mod
>>>            if {![info exists lineno]} {
>>>                continue
>>>            }
>> 
>> Not sure I understand this part. Guess I'm spending too little time
>> with regexps to find them readable :(
> 
> I have added a few comments.
> 
>> Cheers,
>> Janus
> 
> I had to leave the following files
> 
> gcc/testsuite/gfortran.dg/binding_label_tests_10_main.f03:! { dg-final { cleanup-modules "binding_label_tests_10" } }
> gcc/testsuite/gfortran.dg/binding_label_tests_11_main.f03:! { dg-final { cleanup-modules "binding_label_tests_11" } }
> gcc/testsuite/gfortran.dg/binding_label_tests_13_main.f03:! { dg-final { cleanup-modules "binding_label_tests_13" } }
> gcc/testsuite/gfortran.dg/binding_label_tests_26b.f90:! { dg-final { cleanup-modules "fg f" } }
> gcc/testsuite/gfortran.dg/class_45b.f03:! { dg-final { cleanup-modules "G_Nodes" } }
> gcc/testsuite/gfortran.dg/coarray_29_2.f90:! { dg-final { cleanup-modules "co_sum_module" } }
> gcc/testsuite/gfortran.dg/coarray_35a.f90:! { dg-final { cleanup-modules "global_coarrays" } }
> gcc/testsuite/gfortran.dg/namelist_83.f90:! { dg-final { cleanup-modules "gfcbug126" } }
> gcc/testsuite/gfortran.dg/pr37287-1.f90:! { dg-final { cleanup-modules "pr37287_2" } }
> gcc/testsuite/gfortran.dg/test_common_binding_labels_2_main.f03:! { dg-final { cleanup-modules "test_common_binding_labels_2" } }
> gcc/testsuite/gfortran.dg/test_common_binding_labels_3_main.f03:! { dg-final { cleanup-modules "test_common_binding_labels_3" } }
> gcc/testsuite/gfortran.dg/whole_file_29.f90:! { dg-final { cleanup-modules "iso_red" } }
> gcc/testsuite/gfortran.dg/whole_file_31.f90:! { dg-final { cleanup-modules "system_defs_m" } }
> 
> with cleanup-modules because they are either called with dg-compile-aux-modules or with dg-additional-sources. I am planning to fix that once these patches have been accepted.
> 
> Cheers,
> 
> Dominique
> 

[-- Attachment #2: patch-cl --]
[-- Type: application/octet-stream, Size: 3575 bytes --]

2017-06-04  Dominique d'Humieres  <dominiq@lps.ens.fr>

	* lib/fortran-modules.exp (igrep): New procedure, case insensitive
	vesrion of the dejagnu grep.
	(list-module-names): Use it and adjust the regular expressions for
	modules and submodules.
	* gfortran.dg/prof/prof.exp: Cleanup modules.
	* gfortran.dg/allocate_class_4.f90: Remove cleanup-(sub)?modules
	directives.
	* gfortran.dg/altreturn_8.f90: Likewise.
	* gfortran.dg/associate_12.f90: Likewise.
	* gfortran.dg/c_f_pointer_shape_test.f90: Likewise.
	* gfortran.dg/charlen_15.f90: Likewise.
	* gfortran.dg/class_4a.f03: Likewise.
	* gfortran.dg/class_54.f90: Likewise.
	* gfortran.dg/class_dummy_4.f03: Likewise.
	* gfortran.dg/class_dummy_5.f90: Likewise.
	* gfortran.dg/constructor_9.f90: Likewise.
	* gfortran.dg/dec_structure_15.f90: Likewise.
	* gfortran.dg/do_check_8.f90: Likewise.
	* gfortran.dg/dtio_26.f03: Likewise.
	* gfortran.dg/dynamic_dispatch_12.f90: Likewise.
	* gfortran.dg/equiv_9.f90: Likewise.
	* gfortran.dg/extends_15.f90: Likewise.
	* gfortran.dg/finalize_22.f90: Likewise.
	* gfortran.dg/finalize_23.f90: Likewise.
	* gfortran.dg/generic_26.f90: Likewise.
	* gfortran.dg/generic_27.f90: Likewise.
	* gfortran.dg/namelist_76.f90: Likewise.
	* gfortran.dg/pointer_init_8.f90: Likewise.
	* gfortran.dg/pr61318.f90: Likewise.
	* gfortran.dg/pr77260_1.f90: Likewise.
	* gfortran.dg/pr77260_2.f90: Likewise.
	* gfortran.dg/pr77420_3.f90: Likewise.
	* gfortran.dg/proc_ptr_39.f90: Likewise.
	* gfortran.dg/proc_ptr_41.f90: Likewise.
	* gfortran.dg/proc_ptr_42.f90: Likewise.
	* gfortran.dg/proc_ptr_comp_43.f90: Likewise.
	* gfortran.dg/submodule_1.f08: Likewise.
	* gfortran.dg/submodule_10.f08: Likewise.
	* gfortran.dg/submodule_14.f08: Likewise.
	* gfortran.dg/submodule_15.f08: Likewise.
	* gfortran.dg/submodule_2.f08: Likewise.
	* gfortran.dg/submodule_5.f08: Likewise.
	* gfortran.dg/submodule_6.f08: Likewise.
	* gfortran.dg/submodule_7.f08: Likewise.
	* gfortran.dg/submodule_8.f08: Likewise.
	* gfortran.dg/submodule_9.f08: Likewise.
	* gfortran.dg/transfer_class_2.f90: Likewise.
	* gfortran.dg/typebound_assignment_7.f90: Likewise.
	* gfortran.dg/typebound_call_24.f03: Likewise.
	* gfortran.dg/typebound_call_25.f90: Likewise.
	* gfortran.dg/typebound_deferred_1.f90: Likewise.
	* gfortran.dg/typebound_generic_12.f03: Likewise.
	* gfortran.dg/typebound_generic_13.f03: Likewise.
	* gfortran.dg/typebound_generic_14.f03: Likewise.
	* gfortran.dg/typebound_generic_15.f90: Likewise.
	* gfortran.dg/typebound_operator_16.f03: Likewise.
	* gfortran.dg/typebound_operator_18.f90: Likewise.
	* gfortran.dg/typebound_operator_20.f90: Likewise.
	* gfortran.dg/typebound_override_3.f90: Likewise.
	* gfortran.dg/typebound_override_4.f90: Likewise.
	* gfortran.dg/typebound_override_5.f90: Likewise.
	* gfortran.dg/typebound_override_6.f90: Likewise.
	* gfortran.dg/typebound_override_7.f90: Likewise.
	* gfortran.dg/typebound_proc_28.f03: Likewise.
	* gfortran.dg/typebound_proc_29.f90: Likewise.
	* gfortran.dg/typebound_proc_30.f90: Likewise.
	* gfortran.dg/typebound_proc_31.f90: Likewise.
	* gfortran.dg/typebound_proc_32.f90: Likewise.
	* gfortran.dg/typebound_proc_33.f90: Likewise.
	* gfortran.dg/unlimited_polymorphic_16.f90: Likewise.
	* gfortran.dg/unlimited_polymorphic_19.f90: Likewise.
	* gfortran.dg/unlimited_polymorphic_24.f03: Likewise.
	* gfortran.dg/use_only_3.f90: Likewise.
	* gfortran.dg/use_without_only_1.f90: Likewise.
	* gfortran.dg/warn_unused_function.f90: Likewise.
	* gfortran.dg/warn_unused_function_2.f90: Likewise.
	* gfortran.dg/ieee/ieee_8.f90: Likewise.

[-- Attachment #3: Type: text/plain, Size: 3 bytes --]

> 

[-- Attachment #4: patch-exp --]
[-- Type: application/octet-stream, Size: 4226 bytes --]

--- ../_clean/gcc/testsuite/lib/fortran-modules.exp	2017-01-01 17:38:58.000000000 +0100
+++ gcc/testsuite/lib/fortran-modules.exp	2017-04-27 15:53:24.000000000 +0200
@@ -79,10 +79,14 @@ proc list-module-names { files } {
 
 proc list-module-names-1 { file } {
     set result {}
-    set tmp [grep $file "^\[ \t\]*((#)?\[ \t\]*include|\[mM\]\[oO\]\[dD\]\[uU\]\[lL\]\[eE\](?!\[ \t\]+\[pP\]\[rR\]\[oO\]\[cC\]\[eE\]\[dD\]\[uU\]\[rR\]\[eE\]\[ \t\]+))\[ \t\]+.*" line]
+    if {[file isdirectory $file]} {return}
+    # Find lines containing INCLUDE, MODULE, and SUBMODULE, excluding the lines containing
+    # MODULE [PURE|(IMPURE\s+)?ELEMENTAL|RECURSIVE] (PROCEDURE|FUNCTION|SUBROUTINE)
+    set pat {^\s*((#)?\s*include|(sub)?module(?!\s+((pure|(impure\s+)?elemental|recursive)\s+)?(procedure|function|subroutine)[:\s]+))\s*.*}
+    set tmp [igrep $file $pat line]
     if {![string match "" $tmp]} {
 	foreach i $tmp {
-	    regexp "(\[0-9\]+)\[ \t\]+(?:(?:#)?\[ \t\]*include\[ \t\]+)\[\"\](\[^\"\]*)\[\"\]" $i dummy lineno include_file
+	    regexp -nocase {(\d+)\s+#?\s*include\s+["']([^"']*)["']} $i dummy lineno include_file
 	    if {[info exists include_file]} {
 		set dir [file dirname $file]
 		set inc "$dir/$include_file"
@@ -99,10 +103,16 @@ proc list-module-names-1 { file } {
 		}
 		continue
 	    }
-	    regexp "(\[0-9\]+)\[ \t\]+(?:(\[mM\]\[oO\]\[dD\]\[uU\]\[lL\]\[eE\]\[ \t\]+(?!\[pP\]\[rR\]\[oO\]\[cC\]\[eE\]\[dD\]\[uU\]\[rR\]\[eE\]\[ \t\]+)))(\[^ \t;\]*)" $i i lineno keyword mod
-	    if {![info exists lineno]} {
+	    regexp -nocase {(\d+)\s+(module|submodule)\s*([^;]*)} $i i lineno keyword mod
+	    if {![info exists mod]} {
 		continue
 	    }
+	    # Generates the file name mod_name@submod_name from
+	    # (\s*mod_name[:submod_name]\s*)\s*submod_name\s*[! comment]
+	    regsub {\s*!.*} $mod "" mod
+	    regsub {:[^)]*} $mod "" mod
+	    regsub {\(\s*} $mod "" mod
+	    regsub {\s*\)\s*} $mod "@" mod
 	    verbose "Line $lineno mentions module `$mod'" 3
 	    if {[lsearch $result $mod] < 0} {
 		lappend result $mod
@@ -111,3 +121,54 @@ proc list-module-names-1 { file } {
     }
     return $result
 }
+
+# Looks for case insensitive occurrences of a string in a file.
+#     return:list of lines that matched or NULL if none match.
+#     args:  first arg is the filename,
+#            second is the pattern,
+#            third are any options.
+#     Options: line  - puts line numbers of match in list
+#
+proc igrep { args } {
+
+    set file [lindex $args 0]
+    set pattern [lindex $args 1]
+
+    verbose "Grepping $file for the pattern \"$pattern\"" 3
+
+    set argc [llength $args]
+    if { $argc > 2 } {
+        for { set i 2 } { $i < $argc } { incr i } {
+            append options [lindex $args $i]
+            append options " "
+        }
+    } else {
+        set options ""
+    }
+
+    set i 0
+    set fd [open $file r]
+    while { [gets $fd cur_line]>=0 } {
+        incr i
+        if {[regexp -nocase -- "$pattern" $cur_line match]} {
+            if {![string match "" $options]} {
+                foreach opt $options {
+                    switch $opt {
+                        "line" {
+                            lappend grep_out [concat $i $match]
+                        }
+                    }
+                }
+            } else {
+                lappend grep_out $match
+            }
+        }
+    }
+    close $fd
+    unset fd
+    unset i
+    if {![info exists grep_out]} {
+        set grep_out ""
+    }
+    return $grep_out
+}
--- ../_clean/gcc/testsuite/gfortran.dg/prof/prof.exp	2017-01-01 17:38:58.000000000 +0100
+++ gcc/testsuite/gfortran.dg/prof/prof.exp	2017-01-03 09:19:02.000000000 +0100
@@ -18,6 +18,7 @@
 # ordering using -fprofile-generate followed by -fprofile-use.
 
 load_lib target-supports.exp
+load_lib fortran-modules.exp
 
 # Some targets don't support tree profiling.
 if { ![check_profiling_available "-fprofile-generate"] } {
@@ -50,7 +51,9 @@ foreach src [lsort [glob -nocomplain $sr
     if ![runtest_file_p $runtests $src] then {
         continue
     }
+    list-module-names $src
     profopt-execute $src
+    cleanup-modules ""
 }
 
 foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.f*]] {

[-- Attachment #5: Type: text/plain, Size: 3 bytes --]

> 

[-- Attachment #6: patch-tsts --]
[-- Type: application/octet-stream, Size: 38835 bytes --]

diff -up ../_clean/gcc/testsuite/gfortran.dg/allocate_class_4.f90 gcc/testsuite/gfortran.dg/allocate_class_4.f90
--- ../_clean/gcc/testsuite/gfortran.dg/allocate_class_4.f90	2015-03-24 11:33:29.000000000 +0100
+++ gcc/testsuite/gfortran.dg/allocate_class_4.f90	2017-04-16 08:52:52.000000000 +0200
@@ -31,6 +31,3 @@ module integrable_model_module
       end subroutine
 
 end module integrable_model_module
-
-! { dg-final { cleanup-modules "integrable_model_module" } }
- 
diff -up ../_clean/gcc/testsuite/gfortran.dg/altreturn_8.f90 gcc/testsuite/gfortran.dg/altreturn_8.f90
--- ../_clean/gcc/testsuite/gfortran.dg/altreturn_8.f90	2013-04-03 09:54:08.000000000 +0200
+++ gcc/testsuite/gfortran.dg/altreturn_8.f90	2014-05-07 15:47:33.000000000 +0200
@@ -1,23 +1,21 @@
-! { dg-do compile }
-! { dg-options "-std=gnu" }
-!
-! PR 56284: [OOP] ICE with alternate return in type-bound procedure
-!
-! Contributed by Arjen Markus <arjen.markus@deltares.nl>
-
-module try_this
-  implicit none
-
-  type :: table_t
-  contains
-    procedure, nopass :: getRecord
-  end type
-
-contains
-
-  subroutine getRecord ( * )
-  end subroutine
-
-end module
-
-! { dg-final { cleanup-modules "try_this" } }
+! { dg-do compile }
+! { dg-options "-std=gnu" }
+!
+! PR 56284: [OOP] ICE with alternate return in type-bound procedure
+!
+! Contributed by Arjen Markus <arjen.markus@deltares.nl>
+
+module try_this
+  implicit none
+
+  type :: table_t
+  contains
+    procedure, nopass :: getRecord
+  end type
+
+contains
+
+  subroutine getRecord ( * )
+  end subroutine
+
+end module
diff -up ../_clean/gcc/testsuite/gfortran.dg/associate_12.f90 gcc/testsuite/gfortran.dg/associate_12.f90
--- ../_clean/gcc/testsuite/gfortran.dg/associate_12.f90	2012-11-05 20:11:06.000000000 +0100
+++ gcc/testsuite/gfortran.dg/associate_12.f90	2014-05-07 15:47:33.000000000 +0200
@@ -25,5 +25,3 @@ program assoc_err
     print *, 1. + b
   end associate
 end program
-
-! { dg-final { cleanup-modules "assoc_err_m" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/c_f_pointer_shape_test.f90 gcc/testsuite/gfortran.dg/c_f_pointer_shape_test.f90
--- ../_clean/gcc/testsuite/gfortran.dg/c_f_pointer_shape_test.f90	2013-03-25 18:07:07.000000000 +0100
+++ gcc/testsuite/gfortran.dg/c_f_pointer_shape_test.f90	2014-05-07 15:47:33.000000000 +0200
@@ -16,5 +16,3 @@ contains
     call c_f_pointer(cPtr, myArrayPtr) ! { dg-error "Expected SHAPE argument to C_F_POINTER with array FPTR" }
   end subroutine test_0
 end module c_f_pointer_shape_test
-
-! { dg-final { cleanup-modules "c_f_pointer_shape_test" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/charlen_15.f90 gcc/testsuite/gfortran.dg/charlen_15.f90
--- ../_clean/gcc/testsuite/gfortran.dg/charlen_15.f90	2016-12-08 22:57:37.000000000 +0100
+++ gcc/testsuite/gfortran.dg/charlen_15.f90	2017-04-16 08:54:16.000000000 +0200
@@ -10,5 +10,3 @@ program foo
   use m
   if (trim(x%c(1)) /= 'ab') call abort
 end program foo
-! { dg-final { cleanup-modules "m" } }
-
diff -up ../_clean/gcc/testsuite/gfortran.dg/class_4a.f03 gcc/testsuite/gfortran.dg/class_4a.f03
--- ../_clean/gcc/testsuite/gfortran.dg/class_4a.f03	2014-09-15 22:36:58.000000000 +0200
+++ gcc/testsuite/gfortran.dg/class_4a.f03	2017-04-16 08:55:27.000000000 +0200
@@ -13,4 +13,3 @@ module m
   type t
   end type t
 end module m
-! { dg-final { cleanup-modules "m m2" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/class_54.f90 gcc/testsuite/gfortran.dg/class_54.f90
--- ../_clean/gcc/testsuite/gfortran.dg/class_54.f90	2012-11-05 20:11:06.000000000 +0100
+++ gcc/testsuite/gfortran.dg/class_54.f90	2014-05-07 15:47:33.000000000 +0200
@@ -18,5 +18,3 @@ subroutine sub2
   use m
   class(t), pointer :: a2
 end subroutine
-
-! { dg-final { cleanup-modules "m" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/class_dummy_4.f03 gcc/testsuite/gfortran.dg/class_dummy_4.f03
--- ../_clean/gcc/testsuite/gfortran.dg/class_dummy_4.f03	2014-12-28 08:10:44.000000000 +0100
+++ gcc/testsuite/gfortran.dg/class_dummy_4.f03	2014-12-21 16:40:33.000000000 +0100
@@ -40,5 +40,3 @@ contains
   type(c_stv), allocatable, intent(out) :: y
  end subroutine
 end
-
-! { dg-final { cleanup-modules "m1 m2" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/class_dummy_5.f90 gcc/testsuite/gfortran.dg/class_dummy_5.f90
--- ../_clean/gcc/testsuite/gfortran.dg/class_dummy_5.f90	2014-12-28 08:10:44.000000000 +0100
+++ gcc/testsuite/gfortran.dg/class_dummy_5.f90	2017-04-16 08:55:43.000000000 +0200
@@ -26,5 +26,3 @@ contains
     class(t), intent(out) :: x
   end subroutine
 end
-
-! { dg-final { cleanup-modules "m" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/constructor_9.f90 gcc/testsuite/gfortran.dg/constructor_9.f90
--- ../_clean/gcc/testsuite/gfortran.dg/constructor_9.f90	2013-11-08 01:16:47.000000000 +0100
+++ gcc/testsuite/gfortran.dg/constructor_9.f90	2014-05-07 15:47:33.000000000 +0200
@@ -18,5 +18,3 @@ contains
     cfd=cfmde()                  ! { dg-error "Can't convert" }
   end subroutine
 end module
-
-! { dg-final { cleanup-modules "cf" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/dec_structure_15.f90 gcc/testsuite/gfortran.dg/dec_structure_15.f90
--- ../_clean/gcc/testsuite/gfortran.dg/dec_structure_15.f90	2016-09-23 18:58:00.000000000 +0200
+++ gcc/testsuite/gfortran.dg/dec_structure_15.f90	2017-04-16 08:56:29.000000000 +0200
@@ -24,4 +24,3 @@ contains
     a2 = 0.0
   end function
 end module
-! { dg-final { cleanup-modules "dec_structure_15" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/do_check_8.f90 gcc/testsuite/gfortran.dg/do_check_8.f90
--- ../_clean/gcc/testsuite/gfortran.dg/do_check_8.f90	2012-12-09 10:51:48.000000000 +0100
+++ gcc/testsuite/gfortran.dg/do_check_8.f90	2014-05-07 15:47:33.000000000 +0200
@@ -56,4 +56,3 @@ program main
      call sub(undeclared)
   end do
 end program main
-! { dg-final { cleanup-modules "foo" } }
Only in gcc/testsuite/gfortran.dg/: do_var_target.f90
diff -up ../_clean/gcc/testsuite/gfortran.dg/dtio_26.f03 gcc/testsuite/gfortran.dg/dtio_26.f03
--- ../_clean/gcc/testsuite/gfortran.dg/dtio_26.f03	2017-03-25 20:42:40.000000000 +0100
+++ gcc/testsuite/gfortran.dg/dtio_26.f03	2017-04-16 08:57:48.000000000 +0200
@@ -65,5 +65,3 @@ program p
   read( unit=s, fmt=*, iostat=istat, iomsg=imsg) foo
   if (imsg.ne."End of record") call abort
 end program p
-
-! { dg-final { cleanup-modules "t_m" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/dynamic_dispatch_12.f90 gcc/testsuite/gfortran.dg/dynamic_dispatch_12.f90
--- ../_clean/gcc/testsuite/gfortran.dg/dynamic_dispatch_12.f90	2014-01-04 15:51:39.000000000 +0100
+++ gcc/testsuite/gfortran.dg/dynamic_dispatch_12.f90	2014-05-07 15:47:33.000000000 +0200
@@ -70,5 +70,3 @@ contains
   end subroutine
 
 end
-
-! { dg-final { cleanup-modules "TestResult_mod BaseTestRunner_mod TestRunner_mod" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/equiv_9.f90 gcc/testsuite/gfortran.dg/equiv_9.f90
--- ../_clean/gcc/testsuite/gfortran.dg/equiv_9.f90	2015-06-06 08:23:06.000000000 +0200
+++ gcc/testsuite/gfortran.dg/equiv_9.f90	2017-04-16 08:57:58.000000000 +0200
@@ -19,4 +19,3 @@ subroutine another()
    implicit none
    if (x2 /= 2) call abort
 end subroutine
-! { dg-final { cleanup-modules "constant" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/extends_15.f90 gcc/testsuite/gfortran.dg/extends_15.f90
--- ../_clean/gcc/testsuite/gfortran.dg/extends_15.f90	2013-10-03 14:48:40.000000000 +0200
+++ gcc/testsuite/gfortran.dg/extends_15.f90	2014-05-07 15:47:33.000000000 +0200
@@ -12,5 +12,3 @@ module ct
   type :: t1
   end type
 end
-
-! { dg-final { cleanup-modules "ct" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/finalize_22.f90 gcc/testsuite/gfortran.dg/finalize_22.f90
--- ../_clean/gcc/testsuite/gfortran.dg/finalize_22.f90	2014-02-08 22:52:03.000000000 +0100
+++ gcc/testsuite/gfortran.dg/finalize_22.f90	2014-05-07 15:47:34.000000000 +0200
@@ -16,5 +16,3 @@ contains
     class(cfml), intent(inout) :: s
   end subroutine mld
 end module cf
-
-! { dg-final { cleanup-modules "cf" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/finalize_23.f90 gcc/testsuite/gfortran.dg/finalize_23.f90
--- ../_clean/gcc/testsuite/gfortran.dg/finalize_23.f90	2014-02-21 12:03:30.000000000 +0100
+++ gcc/testsuite/gfortran.dg/finalize_23.f90	2014-05-07 15:47:34.000000000 +0200
@@ -27,5 +27,3 @@ contains
   end function
 
 end module
-
-! { dg-final { cleanup-modules "ObjectLists" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/generic_26.f90 gcc/testsuite/gfortran.dg/generic_26.f90
--- ../_clean/gcc/testsuite/gfortran.dg/generic_26.f90	2016-10-07 20:28:47.000000000 +0200
+++ gcc/testsuite/gfortran.dg/generic_26.f90	2016-10-07 20:30:02.000000000 +0200
@@ -25,5 +25,3 @@ contains
   end function
   
 end
-
-! { dg-final { cleanup-modules "a" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/generic_27.f90 gcc/testsuite/gfortran.dg/generic_27.f90
--- ../_clean/gcc/testsuite/gfortran.dg/generic_27.f90	2012-10-06 15:18:29.000000000 +0200
+++ gcc/testsuite/gfortran.dg/generic_27.f90	2014-05-07 15:47:34.000000000 +0200
@@ -30,5 +30,3 @@ program test
   if (testIF(cos)/=1.0) call abort()
 
 end program
-
-! { dg-final { cleanup-modules "m" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/namelist_76.f90 gcc/testsuite/gfortran.dg/namelist_76.f90
--- ../_clean/gcc/testsuite/gfortran.dg/namelist_76.f90	2012-11-21 23:32:39.000000000 +0100
+++ gcc/testsuite/gfortran.dg/namelist_76.f90	2014-05-07 15:47:34.000000000 +0200
@@ -24,5 +24,3 @@ subroutine write_data()
   write(10, nml=write_data_list)
   close(10)
 end subroutine write_data
-
-! { dg-final { cleanup-modules "data" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/pointer_init_8.f90 gcc/testsuite/gfortran.dg/pointer_init_8.f90
--- ../_clean/gcc/testsuite/gfortran.dg/pointer_init_8.f90	2013-08-06 12:44:29.000000000 +0200
+++ gcc/testsuite/gfortran.dg/pointer_init_8.f90	2014-05-07 15:47:34.000000000 +0200
@@ -22,5 +22,3 @@ end module m
   if (.not. associated(py, y))   call abort()
   if (.not. same_type_as(py, y)) call abort()
 end 
-
-! { dg-final { cleanup-modules "m" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/pr61318.f90 gcc/testsuite/gfortran.dg/pr61318.f90
--- ../_clean/gcc/testsuite/gfortran.dg/pr61318.f90	2016-08-22 20:21:10.000000000 +0200
+++ gcc/testsuite/gfortran.dg/pr61318.f90	2017-04-16 09:01:57.000000000 +0200
@@ -20,4 +20,3 @@ program test
   use gbl_interfaces
   call gagout(seve%e,'Some string') ! { dg-error "Type mismatch in argument" }
 end program test
-! { dg-final { cleanup-modules "gbl_interfaces gbl_message" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/pr77260_1.f90 gcc/testsuite/gfortran.dg/pr77260_1.f90
--- ../_clean/gcc/testsuite/gfortran.dg/pr77260_1.f90	2016-08-22 20:21:10.000000000 +0200
+++ gcc/testsuite/gfortran.dg/pr77260_1.f90	2017-04-16 09:02:39.000000000 +0200
@@ -22,4 +22,3 @@ program test
    implicit none
    print *,f2()
 end program
-! { dg-final { cleanup-modules "foo" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/pr77260_2.f90 gcc/testsuite/gfortran.dg/pr77260_2.f90
--- ../_clean/gcc/testsuite/gfortran.dg/pr77260_2.f90	2016-08-22 20:21:10.000000000 +0200
+++ gcc/testsuite/gfortran.dg/pr77260_2.f90	2017-04-16 09:02:47.000000000 +0200
@@ -23,4 +23,3 @@ program test
    implicit none
    print *,f2()
 end program
-! { dg-final { cleanup-modules "foo" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/pr77420_3.f90 gcc/testsuite/gfortran.dg/pr77420_3.f90
--- ../_clean/gcc/testsuite/gfortran.dg/pr77420_3.f90	2016-09-26 20:50:46.000000000 +0200
+++ gcc/testsuite/gfortran.dg/pr77420_3.f90	2017-04-16 09:03:20.000000000 +0200
@@ -6,4 +6,3 @@ module h5global
   integer :: h5p_default_f, h5p_flags
   equivalence(h5p_flags, h5p_default_f)
 end module h5global
-! { dg-final { cleanup-modules "h5global" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/proc_ptr_39.f90 gcc/testsuite/gfortran.dg/proc_ptr_39.f90
--- ../_clean/gcc/testsuite/gfortran.dg/proc_ptr_39.f90	2015-11-02 11:23:13.000000000 +0100
+++ gcc/testsuite/gfortran.dg/proc_ptr_39.f90	2015-11-02 11:23:34.000000000 +0100
@@ -17,5 +17,3 @@ program Test
   use Module1
   use Module2
 end program
-
-! { dg-final { cleanup-modules "Module1 Module2" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/proc_ptr_41.f90 gcc/testsuite/gfortran.dg/proc_ptr_41.f90
--- ../_clean/gcc/testsuite/gfortran.dg/proc_ptr_41.f90	2013-04-16 21:48:16.000000000 +0200
+++ gcc/testsuite/gfortran.dg/proc_ptr_41.f90	2014-05-07 15:47:34.000000000 +0200
@@ -33,5 +33,3 @@ program crash_test
     ptr => generic_name_get_proc_ptr()
 
 end program
-
-! { dg-final { cleanup-modules "test" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/proc_ptr_42.f90 gcc/testsuite/gfortran.dg/proc_ptr_42.f90
--- ../_clean/gcc/testsuite/gfortran.dg/proc_ptr_42.f90	2013-04-17 19:10:18.000000000 +0200
+++ gcc/testsuite/gfortran.dg/proc_ptr_42.f90	2014-05-07 15:47:34.000000000 +0200
@@ -32,5 +32,3 @@ program p
  use m2
   call ns_dirdata(f)
 end
-
-! { dg-final { cleanup-modules "m1 m2" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/proc_ptr_comp_43.f90 gcc/testsuite/gfortran.dg/proc_ptr_comp_43.f90
--- ../_clean/gcc/testsuite/gfortran.dg/proc_ptr_comp_43.f90	2015-01-15 19:39:27.000000000 +0100
+++ gcc/testsuite/gfortran.dg/proc_ptr_comp_43.f90	2017-04-16 09:04:05.000000000 +0200
@@ -28,5 +28,3 @@ contains
   end subroutine go
 
 end module m
-
-! { dg-final { cleanup-modules "m" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/submodule_1.f08 gcc/testsuite/gfortran.dg/submodule_1.f08
--- ../_clean/gcc/testsuite/gfortran.dg/submodule_1.f08	2015-08-05 14:08:26.000000000 +0200
+++ gcc/testsuite/gfortran.dg/submodule_1.f08	2017-04-16 00:40:30.000000000 +0200
@@ -170,6 +170,3 @@
      message2 = ""
    end subroutine
  end program
-! { dg-final { cleanup-submodules "foo_interface@foo_interface_son" } }
-! { dg-final { cleanup-submodules "foo_interface@foo_interface_grandson" } }
-! { dg-final { cleanup-submodules "foo_interface@foo_interface_daughter" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/submodule_10.f08 gcc/testsuite/gfortran.dg/submodule_10.f08
--- ../_clean/gcc/testsuite/gfortran.dg/submodule_10.f08	2015-09-13 22:04:11.000000000 +0200
+++ gcc/testsuite/gfortran.dg/submodule_10.f08	2017-04-16 00:42:36.000000000 +0200
@@ -167,5 +167,3 @@ program testlk
 
   stop
 end program testlk
-! { dg-final { cleanup-submodules "error_mod@error_impl_mod" } }
-
diff -up ../_clean/gcc/testsuite/gfortran.dg/submodule_14.f08 gcc/testsuite/gfortran.dg/submodule_14.f08
--- ../_clean/gcc/testsuite/gfortran.dg/submodule_14.f08	2016-06-01 16:32:52.000000000 +0200
+++ gcc/testsuite/gfortran.dg/submodule_14.f08	2017-04-16 00:42:54.000000000 +0200
@@ -46,4 +46,3 @@ end submodule testson
   x = 10
   if (fcn1 (x) .ne. 0) call abort
 end
-! { dg-final { cleanup-submodules "test@testson" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/submodule_15.f08 gcc/testsuite/gfortran.dg/submodule_15.f08
--- ../_clean/gcc/testsuite/gfortran.dg/submodule_15.f08	2016-04-22 15:49:02.000000000 +0200
+++ gcc/testsuite/gfortran.dg/submodule_15.f08	2017-04-16 00:43:07.000000000 +0200
@@ -56,4 +56,3 @@ end submodule
   incr = 1
   if (a3(i) .ne. 11) call abort
 end
-! { dg-final { cleanup-submodules "a@a_son" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/submodule_2.f08 gcc/testsuite/gfortran.dg/submodule_2.f08
--- ../_clean/gcc/testsuite/gfortran.dg/submodule_2.f08	2015-07-17 20:24:29.000000000 +0200
+++ gcc/testsuite/gfortran.dg/submodule_2.f08	2017-04-16 00:43:43.000000000 +0200
@@ -98,5 +98,3 @@
    if (any (arg%greeting .ne. ["adieu, people!", "adieu, people!"])) call abort
  contains
  end program
-! { dg-final { cleanup-submodules "foo_interface@foo_interface_son" } }
-! { dg-final { cleanup-submodules "foo_interface@foo_interface_daughter" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/submodule_5.f08 gcc/testsuite/gfortran.dg/submodule_5.f08
--- ../_clean/gcc/testsuite/gfortran.dg/submodule_5.f08	2015-09-17 12:14:00.000000000 +0200
+++ gcc/testsuite/gfortran.dg/submodule_5.f08	2017-04-16 00:44:57.000000000 +0200
@@ -57,4 +57,3 @@ contains
 end SUBMODULE foo_interface_daughter
 
 end
-! { dg-final { cleanup-submodules "foo_interface@foo_interface_daughter" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/submodule_6.f08 gcc/testsuite/gfortran.dg/submodule_6.f08
--- ../_clean/gcc/testsuite/gfortran.dg/submodule_6.f08	2015-11-21 20:59:57.000000000 +0100
+++ gcc/testsuite/gfortran.dg/submodule_6.f08	2017-04-16 00:45:07.000000000 +0200
@@ -92,6 +92,3 @@ program p
   call p_a(a, create_b([3,4,5]))
   call print(a)
 end program p
-! { dg-final { cleanup-submodules "mod_a@imp_p_a" } }
-! { dg-final { cleanup-submodules "mod_b@imp_create" } }
-
diff -up ../_clean/gcc/testsuite/gfortran.dg/submodule_7.f08 gcc/testsuite/gfortran.dg/submodule_7.f08
--- ../_clean/gcc/testsuite/gfortran.dg/submodule_7.f08	2015-07-17 20:24:29.000000000 +0200
+++ gcc/testsuite/gfortran.dg/submodule_7.f08	2017-04-16 00:45:15.000000000 +0200
@@ -145,5 +145,3 @@ program main
   call verify_cleanup (c_1, c_2)
 !...
 end program main
-! { dg-final { cleanup-submodules "color_points@color_points_a" } }
-! { dg-final { cleanup-submodules "color_points@color_points_b" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/submodule_8.f08 gcc/testsuite/gfortran.dg/submodule_8.f08
--- ../_clean/gcc/testsuite/gfortran.dg/submodule_8.f08	2015-07-17 20:24:29.000000000 +0200
+++ gcc/testsuite/gfortran.dg/submodule_8.f08	2017-04-16 00:45:22.000000000 +0200
@@ -41,4 +41,3 @@ program a_s
     call abort
   end if
 end program
-! { dg-final { cleanup-submodules "mod_a@mod_s" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/submodule_9.f08 gcc/testsuite/gfortran.dg/submodule_9.f08
--- ../_clean/gcc/testsuite/gfortran.dg/submodule_9.f08	2015-08-05 14:08:26.000000000 +0200
+++ gcc/testsuite/gfortran.dg/submodule_9.f08	2017-04-16 00:45:33.000000000 +0200
@@ -38,4 +38,3 @@ program a_s
   implicit none
   call p()
 end program
-! { dg-final { cleanup-submodules "mod_a@b" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/transfer_class_2.f90 gcc/testsuite/gfortran.dg/transfer_class_2.f90
--- ../_clean/gcc/testsuite/gfortran.dg/transfer_class_2.f90	2012-11-06 13:52:41.000000000 +0100
+++ gcc/testsuite/gfortran.dg/transfer_class_2.f90	2014-05-07 15:47:34.000000000 +0200
@@ -41,5 +41,3 @@ program p
   if (c%i /= 4) call abort()
 
 end
-
-! { dg-final { cleanup-modules "m" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/typebound_assignment_7.f90 gcc/testsuite/gfortran.dg/typebound_assignment_7.f90
--- ../_clean/gcc/testsuite/gfortran.dg/typebound_assignment_7.f90	2013-08-28 14:01:43.000000000 +0200
+++ gcc/testsuite/gfortran.dg/typebound_assignment_7.f90	2014-05-07 15:47:34.000000000 +0200
@@ -62,5 +62,3 @@ program test_assign
   end select
 
 end
-
-! { dg-final { cleanup-modules "mod1 mod2" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/typebound_call_24.f03 gcc/testsuite/gfortran.dg/typebound_call_24.f03
--- ../_clean/gcc/testsuite/gfortran.dg/typebound_call_24.f03	2012-08-16 13:51:58.000000000 +0200
+++ gcc/testsuite/gfortran.dg/typebound_call_24.f03	2014-05-07 15:47:34.000000000 +0200
@@ -20,5 +20,3 @@ program bug2
   class(aqq_t) :: aqq  ! { dg-error "must be dummy, allocatable or pointer" }
   call aqq%aqq_init
 end program
-
-! { dg-final { cleanup-modules "aqq_m" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/typebound_call_25.f90 gcc/testsuite/gfortran.dg/typebound_call_25.f90
--- ../_clean/gcc/testsuite/gfortran.dg/typebound_call_25.f90	2013-07-26 14:28:50.000000000 +0200
+++ gcc/testsuite/gfortran.dg/typebound_call_25.f90	2014-05-07 15:47:34.000000000 +0200
@@ -34,5 +34,3 @@ CONTAINS
   END SUBROUTINE
 
 END MODULE
-
-! { dg-final { cleanup-modules "my_mod" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/typebound_deferred_1.f90 gcc/testsuite/gfortran.dg/typebound_deferred_1.f90
--- ../_clean/gcc/testsuite/gfortran.dg/typebound_deferred_1.f90	2013-02-12 13:20:44.000000000 +0100
+++ gcc/testsuite/gfortran.dg/typebound_deferred_1.f90	2014-05-07 15:47:34.000000000 +0200
@@ -19,5 +19,3 @@ contains
   end subroutine inter
 
 end module m 
-
-! { dg-final { cleanup-modules "m" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/typebound_generic_12.f03 gcc/testsuite/gfortran.dg/typebound_generic_12.f03
--- ../_clean/gcc/testsuite/gfortran.dg/typebound_generic_12.f03	2012-06-22 23:42:21.000000000 +0200
+++ gcc/testsuite/gfortran.dg/typebound_generic_12.f03	2014-05-07 15:47:34.000000000 +0200
@@ -22,5 +22,3 @@ contains
     class(t) :: this
   end subroutine sub2
 end module m 
-
-! { dg-final { cleanup-modules "m" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/typebound_generic_13.f03 gcc/testsuite/gfortran.dg/typebound_generic_13.f03
--- ../_clean/gcc/testsuite/gfortran.dg/typebound_generic_13.f03	2012-06-22 23:42:21.000000000 +0200
+++ gcc/testsuite/gfortran.dg/typebound_generic_13.f03	2014-05-07 15:47:34.000000000 +0200
@@ -24,5 +24,3 @@ contains
   end subroutine
 
 end module
-
-! { dg-final { cleanup-modules "m" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/typebound_generic_14.f03 gcc/testsuite/gfortran.dg/typebound_generic_14.f03
--- ../_clean/gcc/testsuite/gfortran.dg/typebound_generic_14.f03	2012-09-16 22:53:24.000000000 +0200
+++ gcc/testsuite/gfortran.dg/typebound_generic_14.f03	2014-05-07 15:47:34.000000000 +0200
@@ -23,5 +23,3 @@ contains
   end subroutine
 
 end module
-
-! { dg-final { cleanup-modules "a_mod" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/typebound_generic_15.f90 gcc/testsuite/gfortran.dg/typebound_generic_15.f90
--- ../_clean/gcc/testsuite/gfortran.dg/typebound_generic_15.f90	2014-02-18 08:51:17.000000000 +0100
+++ gcc/testsuite/gfortran.dg/typebound_generic_15.f90	2014-05-07 15:47:34.000000000 +0200
@@ -14,5 +14,3 @@ module Objects
   end Type
 
 end module
-
-! { dg-final { cleanup-modules "Objects" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/typebound_operator_16.f03 gcc/testsuite/gfortran.dg/typebound_operator_16.f03
--- ../_clean/gcc/testsuite/gfortran.dg/typebound_operator_16.f03	2012-06-27 19:48:13.000000000 +0200
+++ gcc/testsuite/gfortran.dg/typebound_operator_16.f03	2014-05-07 15:47:34.000000000 +0200
@@ -45,5 +45,3 @@ contains
     myadd = a%x + b
   end function MyAdd
 end module
-
-! { dg-final { cleanup-modules "M1 M2" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/typebound_operator_18.f90 gcc/testsuite/gfortran.dg/typebound_operator_18.f90
--- ../_clean/gcc/testsuite/gfortran.dg/typebound_operator_18.f90	2012-11-16 18:08:42.000000000 +0100
+++ gcc/testsuite/gfortran.dg/typebound_operator_18.f90	2014-05-07 15:47:34.000000000 +0200
@@ -21,5 +21,3 @@ contains
     class(athlete) ,intent(in) :: this
   end function
 end module 
-
-! { dg-final { cleanup-modules "athlete_module" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/typebound_operator_20.f90 gcc/testsuite/gfortran.dg/typebound_operator_20.f90
--- ../_clean/gcc/testsuite/gfortran.dg/typebound_operator_20.f90	2015-01-11 23:51:43.000000000 +0100
+++ gcc/testsuite/gfortran.dg/typebound_operator_20.f90	2017-04-16 08:49:12.000000000 +0200
@@ -49,5 +49,3 @@ program drive
   if (h1%sum(h2) /= 1) call abort()
 
 end
-
-! { dg-final { cleanup-modules "overwrite" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/typebound_override_3.f90 gcc/testsuite/gfortran.dg/typebound_override_3.f90
--- ../_clean/gcc/testsuite/gfortran.dg/typebound_override_3.f90	2012-07-31 17:42:27.000000000 +0200
+++ gcc/testsuite/gfortran.dg/typebound_override_3.f90	2014-05-07 15:47:34.000000000 +0200
@@ -30,5 +30,3 @@ contains
     name = "name_B"
   end function
 end module
-
-! { dg-final { cleanup-modules "dtAs dtBs" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/typebound_override_4.f90 gcc/testsuite/gfortran.dg/typebound_override_4.f90
--- ../_clean/gcc/testsuite/gfortran.dg/typebound_override_4.f90	2013-05-31 10:53:49.000000000 +0200
+++ gcc/testsuite/gfortran.dg/typebound_override_4.f90	2014-05-07 15:47:34.000000000 +0200
@@ -30,5 +30,3 @@ contains
     class(r_type) :: mapout
   end subroutine
 end module
-
-! { dg-final { cleanup-modules "base_mod r_mod" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/typebound_override_5.f90 gcc/testsuite/gfortran.dg/typebound_override_5.f90
--- ../_clean/gcc/testsuite/gfortran.dg/typebound_override_5.f90	2013-05-31 10:53:49.000000000 +0200
+++ gcc/testsuite/gfortran.dg/typebound_override_5.f90	2014-05-07 15:47:34.000000000 +0200
@@ -1,40 +1,38 @@
-! { dg-do compile }
-!
-! PR 54190: TYPE(*)/assumed-rank: Type/rank check too relaxed for dummy procedure
-! PR 57217: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check
-!
-! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
-
-module base_mod
-  implicit none
-  type base_type
-    integer :: kind
-  contains
-    procedure, pass(map)  :: clone    => base_clone
-  end type
-contains
-  subroutine  base_clone(map,mapout,info)
-    class(base_type), intent(inout) :: map
-    class(base_type), intent(inout) :: mapout
-    integer     :: info
-  end subroutine
-end module
-
-module r_mod
-  use base_mod
-  implicit none
-  type, extends(base_type) :: r_type
-    real  :: dat
-  contains
-    procedure, pass(map)  :: clone    => r_clone   ! { dg-error "Type mismatch in argument" }
-  end type
-contains
-  subroutine  r_clone(map,mapout,info)
-    class(r_type), intent(inout) :: map
-!gcc$ attributes no_arg_check :: mapout
-    integer, intent(inout) :: mapout
-    integer     :: info
-  end subroutine
-end module
-
-! { dg-final { cleanup-modules "base_mod r_mod" } }
+! { dg-do compile }
+!
+! PR 54190: TYPE(*)/assumed-rank: Type/rank check too relaxed for dummy procedure
+! PR 57217: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check
+!
+! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
+
+module base_mod
+  implicit none
+  type base_type
+    integer :: kind
+  contains
+    procedure, pass(map)  :: clone    => base_clone
+  end type
+contains
+  subroutine  base_clone(map,mapout,info)
+    class(base_type), intent(inout) :: map
+    class(base_type), intent(inout) :: mapout
+    integer     :: info
+  end subroutine
+end module
+
+module r_mod
+  use base_mod
+  implicit none
+  type, extends(base_type) :: r_type
+    real  :: dat
+  contains
+    procedure, pass(map)  :: clone    => r_clone   ! { dg-error "Type mismatch in argument" }
+  end type
+contains
+  subroutine  r_clone(map,mapout,info)
+    class(r_type), intent(inout) :: map
+!gcc$ attributes no_arg_check :: mapout
+    integer, intent(inout) :: mapout
+    integer     :: info
+  end subroutine
+end module
diff -up ../_clean/gcc/testsuite/gfortran.dg/typebound_override_6.f90 gcc/testsuite/gfortran.dg/typebound_override_6.f90
--- ../_clean/gcc/testsuite/gfortran.dg/typebound_override_6.f90	2013-05-31 10:53:49.000000000 +0200
+++ gcc/testsuite/gfortran.dg/typebound_override_6.f90	2014-05-07 15:47:34.000000000 +0200
@@ -1,39 +1,37 @@
-! { dg-do compile }
-!
-! PR 54190: TYPE(*)/assumed-rank: Type/rank check too relaxed for dummy procedure
-! PR 57217: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check
-!
-! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
-
-module base_mod
-  implicit none
-  type base_type
-    integer :: kind
-  contains
-    procedure, pass(map)  :: clone    => base_clone
-  end type
-contains
-  subroutine  base_clone(map,mapout,info)
-    class(base_type), intent(inout) :: map
-    class(base_type), intent(inout) :: mapout
-    integer     :: info
-  end subroutine
-end module
-
-module r_mod
-  use base_mod
-  implicit none
-  type, extends(base_type) :: r_type
-    real  :: dat
-  contains
-    procedure, pass(map)  :: clone    => r_clone   ! { dg-error "Rank mismatch in argument" }
-  end type
-contains
-  subroutine  r_clone(map,mapout,info)
-    class(r_type), intent(inout) :: map
-    class(base_type), intent(inout) :: mapout(..)
-    integer     :: info
-  end subroutine
-end module
-
-! { dg-final { cleanup-modules "base_mod r_mod" } }
+! { dg-do compile }
+!
+! PR 54190: TYPE(*)/assumed-rank: Type/rank check too relaxed for dummy procedure
+! PR 57217: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check
+!
+! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
+
+module base_mod
+  implicit none
+  type base_type
+    integer :: kind
+  contains
+    procedure, pass(map)  :: clone    => base_clone
+  end type
+contains
+  subroutine  base_clone(map,mapout,info)
+    class(base_type), intent(inout) :: map
+    class(base_type), intent(inout) :: mapout
+    integer     :: info
+  end subroutine
+end module
+
+module r_mod
+  use base_mod
+  implicit none
+  type, extends(base_type) :: r_type
+    real  :: dat
+  contains
+    procedure, pass(map)  :: clone    => r_clone   ! { dg-error "Rank mismatch in argument" }
+  end type
+contains
+  subroutine  r_clone(map,mapout,info)
+    class(r_type), intent(inout) :: map
+    class(base_type), intent(inout) :: mapout(..)
+    integer     :: info
+  end subroutine
+end module
diff -up ../_clean/gcc/testsuite/gfortran.dg/typebound_override_7.f90 gcc/testsuite/gfortran.dg/typebound_override_7.f90
--- ../_clean/gcc/testsuite/gfortran.dg/typebound_override_7.f90	2013-05-31 10:53:49.000000000 +0200
+++ gcc/testsuite/gfortran.dg/typebound_override_7.f90	2014-05-07 15:47:34.000000000 +0200
@@ -1,39 +1,37 @@
-! { dg-do compile }
-!
-! PR 54190: TYPE(*)/assumed-rank: Type/rank check too relaxed for dummy procedure
-! PR 57217: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check
-!
-! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
-
-module base_mod
-  implicit none
-  type base_type
-    integer :: kind
-  contains
-    procedure, pass(map)  :: clone    => base_clone
-  end type
-contains
-  subroutine  base_clone(map,mapout,info)
-    class(base_type), intent(inout) :: map
-    class(base_type), intent(inout) :: mapout
-    integer     :: info
-  end subroutine
-end module
-
-module r_mod
-  use base_mod
-  implicit none
-  type, extends(base_type) :: r_type
-    real  :: dat
-  contains
-    procedure, pass(map)  :: clone    => r_clone   ! { dg-error "Type mismatch in argument" }
-  end type
-contains
-  subroutine  r_clone(map,mapout,info)
-    class(r_type), intent(inout) :: map
-    type(*), intent(inout) :: mapout
-    integer     :: info
-  end subroutine
-end module
-
-! { dg-final { cleanup-modules "base_mod r_mod" } }
+! { dg-do compile }
+!
+! PR 54190: TYPE(*)/assumed-rank: Type/rank check too relaxed for dummy procedure
+! PR 57217: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check
+!
+! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
+
+module base_mod
+  implicit none
+  type base_type
+    integer :: kind
+  contains
+    procedure, pass(map)  :: clone    => base_clone
+  end type
+contains
+  subroutine  base_clone(map,mapout,info)
+    class(base_type), intent(inout) :: map
+    class(base_type), intent(inout) :: mapout
+    integer     :: info
+  end subroutine
+end module
+
+module r_mod
+  use base_mod
+  implicit none
+  type, extends(base_type) :: r_type
+    real  :: dat
+  contains
+    procedure, pass(map)  :: clone    => r_clone   ! { dg-error "Type mismatch in argument" }
+  end type
+contains
+  subroutine  r_clone(map,mapout,info)
+    class(r_type), intent(inout) :: map
+    type(*), intent(inout) :: mapout
+    integer     :: info
+  end subroutine
+end module
diff -up ../_clean/gcc/testsuite/gfortran.dg/typebound_proc_28.f03 gcc/testsuite/gfortran.dg/typebound_proc_28.f03
--- ../_clean/gcc/testsuite/gfortran.dg/typebound_proc_28.f03	2013-04-13 10:43:36.000000000 +0200
+++ gcc/testsuite/gfortran.dg/typebound_proc_28.f03	2014-05-07 15:47:34.000000000 +0200
@@ -26,5 +26,3 @@ contains
   end function
 
 end module
-
-! { dg-final { cleanup-modules "t" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/typebound_proc_29.f90 gcc/testsuite/gfortran.dg/typebound_proc_29.f90
--- ../_clean/gcc/testsuite/gfortran.dg/typebound_proc_29.f90	2013-04-13 15:35:28.000000000 +0200
+++ gcc/testsuite/gfortran.dg/typebound_proc_29.f90	2014-05-07 15:47:34.000000000 +0200
@@ -22,5 +22,3 @@ program abstract
   type(pdf) pp
   print pp%getx()  ! { dg-error "must be of type default-kind CHARACTER or of INTEGER" }
 end program
-
-! { dg-final { cleanup-modules "pdfs" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/typebound_proc_30.f90 gcc/testsuite/gfortran.dg/typebound_proc_30.f90
--- ../_clean/gcc/testsuite/gfortran.dg/typebound_proc_30.f90	2013-11-25 11:02:18.000000000 +0100
+++ gcc/testsuite/gfortran.dg/typebound_proc_30.f90	2014-05-07 15:47:34.000000000 +0200
@@ -34,5 +34,3 @@ contains
   end function
 
 end module
-
-! { dg-final { cleanup-modules "phs_single" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/typebound_proc_31.f90 gcc/testsuite/gfortran.dg/typebound_proc_31.f90
--- ../_clean/gcc/testsuite/gfortran.dg/typebound_proc_31.f90	2013-12-14 12:12:22.000000000 +0100
+++ gcc/testsuite/gfortran.dg/typebound_proc_31.f90	2014-05-07 15:47:34.000000000 +0200
@@ -24,5 +24,3 @@ contains
   end function
 
 end module
-
-! { dg-final { cleanup-modules "classes" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/typebound_proc_32.f90 gcc/testsuite/gfortran.dg/typebound_proc_32.f90
--- ../_clean/gcc/testsuite/gfortran.dg/typebound_proc_32.f90	2014-01-04 15:51:39.000000000 +0100
+++ gcc/testsuite/gfortran.dg/typebound_proc_32.f90	2014-05-07 15:47:34.000000000 +0200
@@ -31,5 +31,3 @@ contains
   end function
 
 end module
-
-! { dg-final { cleanup-modules "classes" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/typebound_proc_33.f90 gcc/testsuite/gfortran.dg/typebound_proc_33.f90
--- ../_clean/gcc/testsuite/gfortran.dg/typebound_proc_33.f90	2014-02-19 15:21:38.000000000 +0100
+++ gcc/testsuite/gfortran.dg/typebound_proc_33.f90	2014-05-07 15:47:34.000000000 +0200
@@ -35,5 +35,3 @@ contains
   end subroutine
 
 end
-
-! { dg-final { cleanup-modules "ObjectLists" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/unlimited_polymorphic_16.f90 gcc/testsuite/gfortran.dg/unlimited_polymorphic_16.f90
--- ../_clean/gcc/testsuite/gfortran.dg/unlimited_polymorphic_16.f90	2014-03-01 11:07:10.000000000 +0100
+++ gcc/testsuite/gfortran.dg/unlimited_polymorphic_16.f90	2014-05-07 15:47:34.000000000 +0200
@@ -20,5 +20,3 @@ contains
   end subroutine
 
 end module
-
-! { dg-final { cleanup-modules "IO" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/unlimited_polymorphic_19.f90 gcc/testsuite/gfortran.dg/unlimited_polymorphic_19.f90
--- ../_clean/gcc/testsuite/gfortran.dg/unlimited_polymorphic_19.f90	2014-12-28 08:10:44.000000000 +0100
+++ gcc/testsuite/gfortran.dg/unlimited_polymorphic_19.f90	2017-04-16 08:49:46.000000000 +0200
@@ -49,5 +49,3 @@ CONTAINS
     END SELECT; END SELECT
   END SUBROUTINE copy_int 
 END PROGRAM main
-
-! { dg-final { cleanup-modules "m" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/unlimited_polymorphic_24.f03 gcc/testsuite/gfortran.dg/unlimited_polymorphic_24.f03
--- ../_clean/gcc/testsuite/gfortran.dg/unlimited_polymorphic_24.f03	2015-03-28 11:59:43.000000000 +0100
+++ gcc/testsuite/gfortran.dg/unlimited_polymorphic_24.f03	2017-04-16 08:50:23.000000000 +0200
@@ -214,5 +214,3 @@ program main
     end select
   end do
 end program main
-
-! { dg-final { cleanup-modules "list_mod link_mod" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/use_only_3.f90 gcc/testsuite/gfortran.dg/use_only_3.f90
--- ../_clean/gcc/testsuite/gfortran.dg/use_only_3.f90	2014-01-11 22:43:59.000000000 +0100
+++ gcc/testsuite/gfortran.dg/use_only_3.f90	2014-05-07 15:47:34.000000000 +0200
@@ -32,4 +32,3 @@ subroutine dforceb(c0, i, betae, ipol, b
        &   dq2,  gmes
 
  end subroutine dforceb
-! { dg-final { cleanup-modules "cell_base constants control_flags cvan electrons_base electrons_nose gvecs gvecw ions_base kinds parameters" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/use_without_only_1.f90 gcc/testsuite/gfortran.dg/use_without_only_1.f90
--- ../_clean/gcc/testsuite/gfortran.dg/use_without_only_1.f90	2014-11-12 05:09:54.000000000 +0100
+++ gcc/testsuite/gfortran.dg/use_without_only_1.f90	2017-04-16 08:50:51.000000000 +0200
@@ -19,4 +19,3 @@ CONTAINS
      USE ISO_C_BINDING ! { dg-warning "9:has no ONLY qualifier" }
   END SUBROUTINE S3
 END MODULE
-! { dg-final { cleanup-modules "foo testmod" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/warn_unused_function.f90 gcc/testsuite/gfortran.dg/warn_unused_function.f90
--- ../_clean/gcc/testsuite/gfortran.dg/warn_unused_function.f90	2012-10-19 22:23:21.000000000 +0200
+++ gcc/testsuite/gfortran.dg/warn_unused_function.f90	2014-05-07 15:47:34.000000000 +0200
@@ -17,5 +17,3 @@ contains
         print *, "Hello ", a, "!"
     end subroutine
 end module
-
-! { dg-final { cleanup-modules "mod_say_hello" } }
Only in gcc/testsuite/gfortran.dg/: warn_unused_function_1.f90
diff -up ../_clean/gcc/testsuite/gfortran.dg/warn_unused_function_2.f90 gcc/testsuite/gfortran.dg/warn_unused_function_2.f90
--- ../_clean/gcc/testsuite/gfortran.dg/warn_unused_function_2.f90	2015-11-06 22:49:37.000000000 +0100
+++ gcc/testsuite/gfortran.dg/warn_unused_function_2.f90	2017-04-16 08:51:18.000000000 +0200
@@ -39,5 +39,3 @@ contains
   subroutine s5            ! { dg-warning "defined but not used" }
   end subroutine
 end
-
-! { dg-final { cleanup-modules "m" } }
diff -up ../_clean/gcc/testsuite/gfortran.dg/ieee/ieee_8.f90 gcc/testsuite/gfortran.dg/ieee/ieee_8.f90
--- ../_clean/gcc/testsuite/gfortran.dg/ieee/ieee_8.f90	2016-11-22 11:28:28.000000000 +0100
+++ gcc/testsuite/gfortran.dg/ieee/ieee_8.f90	2017-04-16 08:58:37.000000000 +0200
@@ -111,5 +111,3 @@ subroutine gee(n, rounding, flag)
   if (len(s8) /= x8) call abort
 
 end subroutine
-
-! { dg-final { cleanup-modules "foo bar" } }

[-- Attachment #7: Type: text/plain, Size: 4 bytes --]

> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH, gfortran] Cleanup the submodule tests
       [not found]               ` <256853B4-70F5-43BD-A256-42942B1B4AA7@lps.ens.fr>
  2017-06-04 12:54                 ` Fwd: " Dominique d'Humières
@ 2017-06-04 18:26                 ` Segher Boessenkool
  1 sibling, 0 replies; 11+ messages in thread
From: Segher Boessenkool @ 2017-06-04 18:26 UTC (permalink / raw)
  To: Dominique d'Humières
  Cc: Janus Weil, Paul Richard Thomas, gfortran, gcc-patches

On Sun, Jun 04, 2017 at 02:52:36PM +0200, Dominique d'Humières wrote:
> >> -           regexp "(\[0-9\]+)\[ \t\]+(?:(?:#)?\[ \t\]*include\[ \t\]+)\[\"\](\[^\"\]*)\[\"\]" $i dummy lineno include_file
> >> +           regexp -nocase "(\[0-9\]+)\\s+(?:(?:#)?\\s*include\\s+)\[\"\'\](\[^\"\'\]*)\[\"\'\]" $i dummy lineno include_file
> > 
> > My regex sorcery may be a bit rusty, but why does \\s need a double
> > escape while \t appears with single escape?
> 
> I have used the Segher’s tips.

Nah, that wasn't a tip.  A tip is: don't use double quotes unless you
actually want double quotes.  You can write this as:

  regexp -nocase {([0-9]+)\s+(?:(?:#)?\s*include\s+)["']([^"']*)["']} $i dummy lineno include_file

or even

  regexp -nocase {([0-9]+)\s+#?\s*include\s+["']([^"']*)["']} $i dummy lineno include_file

(where I removed the useless (?:) groups as well).

You want double quotes if you want command substitution ("bla[stuff]bla"),
variable substitution ("$something"), or backslash substitution (like "\t"
becomes a tab char).  In a regexp you do not usually have any use for this,
and it hurts so much.


Segher

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-06-04 18:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-15 11:01 [PATCH, gfortran] Cleanup the submodule tests Dominique d'Humières
2017-04-15 13:57 ` Janus Weil
2017-04-15 14:46   ` Dominique d'Humières
2017-04-15 15:17     ` Janus Weil
2017-04-15 16:50       ` Dominique d'Humières
2017-04-15 18:18         ` Janus Weil
2017-04-16  8:37           ` Dominique d'Humières
2017-04-17  9:08             ` Janus Weil
2017-04-17 15:57               ` Segher Boessenkool
     [not found]               ` <256853B4-70F5-43BD-A256-42942B1B4AA7@lps.ens.fr>
2017-06-04 12:54                 ` Fwd: " Dominique d'Humières
2017-06-04 18:26                 ` Segher Boessenkool

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).