fortran-modules.exp (igrep): New procedure, case insensitive vesrion of the dejagnu...
authorDominique d'Humieres <dominiq@lps.ens.fr>
Sun, 4 Jun 2017 18:44:45 +0000 (20:44 +0200)
committerDominique d'Humieres <dominiq@gcc.gnu.org>
Sun, 4 Jun 2017 18:44:45 +0000 (20:44 +0200)
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.

From-SVN: r248861

73 files changed:
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/allocate_class_4.f90
gcc/testsuite/gfortran.dg/altreturn_8.f90
gcc/testsuite/gfortran.dg/associate_12.f90
gcc/testsuite/gfortran.dg/c_f_pointer_shape_test.f90
gcc/testsuite/gfortran.dg/charlen_15.f90
gcc/testsuite/gfortran.dg/class_4a.f03
gcc/testsuite/gfortran.dg/class_54.f90
gcc/testsuite/gfortran.dg/class_dummy_4.f03
gcc/testsuite/gfortran.dg/class_dummy_5.f90
gcc/testsuite/gfortran.dg/constructor_9.f90
gcc/testsuite/gfortran.dg/dec_structure_15.f90
gcc/testsuite/gfortran.dg/do_check_8.f90
gcc/testsuite/gfortran.dg/dtio_26.f03
gcc/testsuite/gfortran.dg/dynamic_dispatch_12.f90
gcc/testsuite/gfortran.dg/equiv_9.f90
gcc/testsuite/gfortran.dg/extends_15.f90
gcc/testsuite/gfortran.dg/finalize_22.f90
gcc/testsuite/gfortran.dg/finalize_23.f90
gcc/testsuite/gfortran.dg/generic_26.f90
gcc/testsuite/gfortran.dg/generic_27.f90
gcc/testsuite/gfortran.dg/ieee/ieee_8.f90
gcc/testsuite/gfortran.dg/namelist_76.f90
gcc/testsuite/gfortran.dg/pointer_init_8.f90
gcc/testsuite/gfortran.dg/pr61318.f90
gcc/testsuite/gfortran.dg/pr77260_1.f90
gcc/testsuite/gfortran.dg/pr77260_2.f90
gcc/testsuite/gfortran.dg/pr77420_3.f90
gcc/testsuite/gfortran.dg/proc_ptr_39.f90
gcc/testsuite/gfortran.dg/proc_ptr_41.f90
gcc/testsuite/gfortran.dg/proc_ptr_42.f90
gcc/testsuite/gfortran.dg/prof/prof.exp
gcc/testsuite/gfortran.dg/submodule_1.f08
gcc/testsuite/gfortran.dg/submodule_10.f08
gcc/testsuite/gfortran.dg/submodule_14.f08
gcc/testsuite/gfortran.dg/submodule_15.f08
gcc/testsuite/gfortran.dg/submodule_2.f08
gcc/testsuite/gfortran.dg/submodule_5.f08
gcc/testsuite/gfortran.dg/submodule_6.f08
gcc/testsuite/gfortran.dg/submodule_7.f08
gcc/testsuite/gfortran.dg/submodule_8.f08
gcc/testsuite/gfortran.dg/submodule_9.f08
gcc/testsuite/gfortran.dg/transfer_class_2.f90
gcc/testsuite/gfortran.dg/typebound_assignment_7.f90
gcc/testsuite/gfortran.dg/typebound_call_24.f03
gcc/testsuite/gfortran.dg/typebound_call_25.f90
gcc/testsuite/gfortran.dg/typebound_deferred_1.f90
gcc/testsuite/gfortran.dg/typebound_generic_12.f03
gcc/testsuite/gfortran.dg/typebound_generic_13.f03
gcc/testsuite/gfortran.dg/typebound_generic_14.f03
gcc/testsuite/gfortran.dg/typebound_generic_15.f90
gcc/testsuite/gfortran.dg/typebound_operator_16.f03
gcc/testsuite/gfortran.dg/typebound_operator_18.f90
gcc/testsuite/gfortran.dg/typebound_operator_20.f90
gcc/testsuite/gfortran.dg/typebound_override_3.f90
gcc/testsuite/gfortran.dg/typebound_override_4.f90
gcc/testsuite/gfortran.dg/typebound_override_5.f90
gcc/testsuite/gfortran.dg/typebound_override_6.f90
gcc/testsuite/gfortran.dg/typebound_override_7.f90
gcc/testsuite/gfortran.dg/typebound_proc_28.f03
gcc/testsuite/gfortran.dg/typebound_proc_29.f90
gcc/testsuite/gfortran.dg/typebound_proc_30.f90
gcc/testsuite/gfortran.dg/typebound_proc_31.f90
gcc/testsuite/gfortran.dg/typebound_proc_32.f90
gcc/testsuite/gfortran.dg/typebound_proc_33.f90
gcc/testsuite/gfortran.dg/unlimited_polymorphic_16.f90
gcc/testsuite/gfortran.dg/unlimited_polymorphic_19.f90
gcc/testsuite/gfortran.dg/unlimited_polymorphic_24.f03
gcc/testsuite/gfortran.dg/use_only_3.f90
gcc/testsuite/gfortran.dg/use_without_only_1.f90
gcc/testsuite/gfortran.dg/warn_unused_function.f90
gcc/testsuite/gfortran.dg/warn_unused_function_2.f90
gcc/testsuite/lib/fortran-modules.exp

index bfadad536014157c4503b34024ca02f326d10bdc..3c6a47e824ebae05c4af28c7b7bb6b973702822e 100644 (file)
@@ -1,3 +1,82 @@
+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.
 2017-06-04  Marek Polacek  <polacek@redhat.com>
 
        PR c/80919
index 23c9d53d171feb61f16e289bac469b24acdee87e..125d99f4d865740746c080afc5245d2c2207d5b5 100644 (file)
@@ -31,6 +31,3 @@ module integrable_model_module
       end subroutine
 
 end module integrable_model_module
-
-! { dg-final { cleanup-modules "integrable_model_module" } }
index ccd58a2b083b41af2158f828b224cb1e4a0e33bb..63a6ef724200f2a8ee621aa13ca5791e7036ae23 100644 (file)
@@ -1,23 +1,21 @@
-! { dg-do compile }\r
-! { dg-options "-std=gnu" }\r
-!\r
-! PR 56284: [OOP] ICE with alternate return in type-bound procedure\r
-!\r
-! Contributed by Arjen Markus <arjen.markus@deltares.nl>\r
-\r
-module try_this\r
-  implicit none\r
-\r
-  type :: table_t\r
-  contains\r
-    procedure, nopass :: getRecord\r
-  end type\r
-\r
-contains\r
-\r
-  subroutine getRecord ( * )\r
-  end subroutine\r
-\r
-end module\r
-\r
-! { dg-final { cleanup-modules "try_this" } }\r
+! { 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
index 1ead1e7112e0ce014aa42bc0fec7531022cdab2f..8d2abb8adb1535f73158e6a02451899d348d6f11 100644 (file)
@@ -25,5 +25,3 @@ program assoc_err
     print *, 1. + b
   end associate
 end program
-
-! { dg-final { cleanup-modules "assoc_err_m" } }
index 9b130ad6e5994d4482868cb4266ea9ba8dfe3bf9..86377123af6b81ee2ccfaf7b7a4f5c54dc04b66b 100644 (file)
@@ -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" } }
index e141f1eb3ac60eec0ebb11625a0faab204821ce4..ed8ff00bec1c2d3b2ee31da049521f9d39e539e2 100644 (file)
@@ -10,5 +10,3 @@ program foo
   use m
   if (trim(x%c(1)) /= 'ab') call abort
 end program foo
-! { dg-final { cleanup-modules "m" } }
-
index 015e53cbb1ba51c2b3d0000beedc27962f3cb436..a6406a898a842d21b3ddd065c5b9a893328f62ea 100644 (file)
@@ -13,4 +13,3 @@ module m
   type t
   end type t
 end module m
-! { dg-final { cleanup-modules "m m2" } }
index 39c306c83d07a478d30bd56f0ba57397a7134540..fdcdebc54c4b797b3ce5b5f9ddcc0fe4b765cec1 100644 (file)
@@ -18,5 +18,3 @@ subroutine sub2
   use m
   class(t), pointer :: a2
 end subroutine
-
-! { dg-final { cleanup-modules "m" } }
index 24841305bf53e7726076454fb1aa2247109ae529..6c2abad546a3e5539d81f274e3257eafb2ebb508 100644 (file)
@@ -40,5 +40,3 @@ contains
   type(c_stv), allocatable, intent(out) :: y
  end subroutine
 end
-
-! { dg-final { cleanup-modules "m1 m2" } }
index 8da19af1ee6574d00c14e600b2949c068609f277..78fc4f8c622507118963b65929341e2249f226f2 100644 (file)
@@ -26,5 +26,3 @@ contains
     class(t), intent(out) :: x
   end subroutine
 end
-
-! { dg-final { cleanup-modules "m" } }
index 5196703031a88b591e9b31c5c27283af71173876..a8e882138fd7bed3f345db88e4b04329871291ff 100644 (file)
@@ -18,5 +18,3 @@ contains
     cfd=cfmde()                  ! { dg-error "Can't convert" }
   end subroutine
 end module
-
-! { dg-final { cleanup-modules "cf" } }
index fd06ff9f10dfc35e376bbe87e2c33415447403f8..33f51266c0f77b27a955b9755d7e688aa7bca121 100644 (file)
@@ -24,4 +24,3 @@ contains
     a2 = 0.0
   end function
 end module
-! { dg-final { cleanup-modules "dec_structure_15" } }
index 458ae40b604678792660ce2168e539d11de1427c..5b9acc3d68f6806496b04072ac94392df2cfce9d 100644 (file)
@@ -56,4 +56,3 @@ program main
      call sub(undeclared)
   end do
 end program main
-! { dg-final { cleanup-modules "foo" } }
index e947545fb49ebfbf0e50810b5ac80d1c862591e8..ad05da0523e27677a9e4085cd9e58838da3f5c5a 100644 (file)
@@ -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" } }
index d37e1f6a9b5aa2a71bcffeb1d689f917d4f7cd4b..53cc957c4d27e8c45da43e21cb991166191e9f07 100644 (file)
@@ -70,5 +70,3 @@ contains
   end subroutine
 
 end
-
-! { dg-final { cleanup-modules "TestResult_mod BaseTestRunner_mod TestRunner_mod" } }
index 28f0bb8bbf1400034e395dab53b466fc8e4ebf02..5a226282161cae2fcc61747a6ea3cdcc33b5ae43 100644 (file)
@@ -19,4 +19,3 @@ subroutine another()
    implicit none
    if (x2 /= 2) call abort
 end subroutine
-! { dg-final { cleanup-modules "constant" } }
index 06c31799a00eceefda3b3ab330150141d59444dd..03f1ff15a18bc7fe5960c9cfed65f2cca2d978ed 100644 (file)
@@ -12,5 +12,3 @@ module ct
   type :: t1
   end type
 end
-
-! { dg-final { cleanup-modules "ct" } }
index 57fa6e78de315b403cb47e02a1fece70141578e7..cad4481579654a4c9e96da06c10eb7a7afe26c96 100644 (file)
@@ -16,5 +16,3 @@ contains
     class(cfml), intent(inout) :: s
   end subroutine mld
 end module cf
-
-! { dg-final { cleanup-modules "cf" } }
index ea3972981dab53bc7756d0202fa357c0cb5b5e11..9dab53e1f1384793c34d6514f5982499f9eaf1eb 100644 (file)
@@ -27,5 +27,3 @@ contains
   end function
 
 end module
-
-! { dg-final { cleanup-modules "ObjectLists" } }
index 22a593b42278e3c330254499ea36fa97feebdd58..81a0604fbcc08a728b6b823f28ae3c64311b7361 100644 (file)
@@ -25,5 +25,3 @@ contains
   end function
   
 end
-
-! { dg-final { cleanup-modules "a" } }
index f4f4f5ab9c30436c65d3d678a9823da81c2faa60..6f603ae4c9147436d4d177ac2dfc1fe861f6ff5f 100644 (file)
@@ -30,5 +30,3 @@ program test
   if (testIF(cos)/=1.0) call abort()
 
 end program
-
-! { dg-final { cleanup-modules "m" } }
index 7d0cdfd0e036031551216d9682281f2232bd6d58..a47f9c16b914071854720eec73377f85ffd4195b 100644 (file)
@@ -111,5 +111,3 @@ subroutine gee(n, rounding, flag)
   if (len(s8) /= x8) call abort
 
 end subroutine
-
-! { dg-final { cleanup-modules "foo bar" } }
index acb3b2f656130e218963514130149ebd57541b02..9c233fb5bcbe0c4329354518a62a76fcd96c853a 100644 (file)
@@ -24,5 +24,3 @@ subroutine write_data()
   write(10, nml=write_data_list)
   close(10)
 end subroutine write_data
-
-! { dg-final { cleanup-modules "data" } }
index aacd9a8e16e2dca9f5dfee0d31061f9c6e18f6e0..8c6bdb2a6a359d9e8b06acd35d74cdfab1a63f07 100644 (file)
@@ -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" } }
index 4e7e862c443f5f23defa062869ec781fcdb56a02..57da52d58905389d455b561f241430c7ae008ea3 100644 (file)
@@ -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" } }
index 0d2ead61ce72d31a4f795ebd953e2ecf70c44f4a..76ef3cffced4282e961497f996d25c408d308e4c 100644 (file)
@@ -22,4 +22,3 @@ program test
    implicit none
    print *,f2()
 end program
-! { dg-final { cleanup-modules "foo" } }
index ea8da4f271c2c6b4070b3faca95647212b20bae6..0c5ebe3a65618c520c5b2aa9d3f3f9eaa9e46af8 100644 (file)
@@ -23,4 +23,3 @@ program test
    implicit none
    print *,f2()
 end program
-! { dg-final { cleanup-modules "foo" } }
index cf95ac05f83d1f2e3feeba0d3e26a9863d3a810d..c53fce7b438b21a248ab54c6f54c06638ed9f009 100644 (file)
@@ -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" } }
index 2be5d651793656dffdb909b46ec7620678d722ec..b3e0eb995ba0d03c6f71bcaa42afe8db62f3e18a 100644 (file)
@@ -17,5 +17,3 @@ program Test
   use Module1
   use Module2
 end program
-
-! { dg-final { cleanup-modules "Module1 Module2" } }
index 7f50abab21a91a6ab416fb162969e8350b4075a4..534ab0fb5a72b48680a5410a377000b399f63676 100644 (file)
@@ -33,5 +33,3 @@ program crash_test
     ptr => generic_name_get_proc_ptr()
 
 end program
-
-! { dg-final { cleanup-modules "test" } }
index 8556fdf0c217b6a074caede384ce740607fff17b..c92e537acbee3fdd624bfb2986a4f38ed644c6ce 100644 (file)
@@ -32,5 +32,3 @@ program p
  use m2
   call ns_dirdata(f)
 end
-
-! { dg-final { cleanup-modules "m1 m2" } }
index 5b0ed55c3c6cd4e28a434a1300e7251e79cf098a..dc9a7ba65bf4db24377ac8c8e295bb6c316e235d 100644 (file)
@@ -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 $srcdir/$subdir/*.f*]] {
     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*]] {
index 578492e54e7cb6438f5a3087625039b1fb058c98..2c5d373206ea13437d4005b7bb464fe7fd1906e3 100644 (file)
      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" } }
index e956b2905c316ba53923a98e5c9c9ad42cf982d0..373b11c9f96965adff58bcd34e70749cb7a8ff04 100644 (file)
@@ -167,5 +167,3 @@ program testlk
 
   stop
 end program testlk
-! { dg-final { cleanup-submodules "error_mod@error_impl_mod" } }
-
index cbfc3d1d4b17aa626c28d7e9f0abee59a20334c1..bc8fd8042a7626b4df2f28b53019b5cf9305434b 100644 (file)
@@ -46,4 +46,3 @@ end submodule testson
   x = 10
   if (fcn1 (x) .ne. 0) call abort
 end
-! { dg-final { cleanup-submodules "test@testson" } }
index a09a7e7e403485e674110e228596786c7479f59c..499bc66d5ac4cc84e90255cdf7ee1a2a297904c2 100644 (file)
@@ -56,4 +56,3 @@ end submodule
   incr = 1
   if (a3(i) .ne. 11) call abort
 end
-! { dg-final { cleanup-submodules "a@a_son" } }
index 60925ec788d90d6dfb54087403a52a32608d3061..43456d5fc4c287b90e39b5a3eca542122af625fc 100644 (file)
@@ -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" } }
index 2698000c46a6461c22c890867691ecdc2c4f06c1..ed5722ed16741d54e2c04d833071e5544f6b80cc 100644 (file)
@@ -57,4 +57,3 @@ contains
 end SUBMODULE foo_interface_daughter
 
 end
-! { dg-final { cleanup-submodules "foo_interface@foo_interface_daughter" } }
index 21b0e0faac53bd93ede495697d3eef67d04e612f..ec9dfa9e725a3c70604a23620a7cbe03b3120f1a 100644 (file)
@@ -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" } }
-
index a183f50e46cd0ab0a31bbab3a975116fde858afb..fd1bee6296c229924292749a243be74e97bb6edf 100644 (file)
@@ -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" } }
index 15a38a58833c313a9f0ef83935e75cf944bc3681..b3c1565bbd8c260294c03644d1808f50a0f90552 100644 (file)
@@ -41,4 +41,3 @@ program a_s
     call abort
   end if
 end program
-! { dg-final { cleanup-submodules "mod_a@mod_s" } }
index 873979d1feb1db3e4669313d5e23693d8d733475..4589ebcd6d288deda2e330203493dec311f00e72 100644 (file)
@@ -38,4 +38,3 @@ program a_s
   implicit none
   call p()
 end program
-! { dg-final { cleanup-submodules "mod_a@b" } }
index d75b640f10f96e1fa047cc56cc8929b6927d64f7..476eaccc709e59351e70cce2a849f09b6ec09a23 100644 (file)
@@ -41,5 +41,3 @@ program p
   if (c%i /= 4) call abort()
 
 end
-
-! { dg-final { cleanup-modules "m" } }
index 2c5b837d67022b36b52ca68d0e2c19ceea5913b8..e297d9f8ddfa72a71bf175853b93079f4e73062e 100644 (file)
@@ -62,5 +62,3 @@ program test_assign
   end select
 
 end
-
-! { dg-final { cleanup-modules "mod1 mod2" } }
index 48d63dc60230b850a77813673aaf8e381d590131..45990aebe41c336436fe90221d0b87f07074105b 100644 (file)
@@ -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" } }
index df81c79e627e9576d08ca5d8c9009d86c69e0c2b..7f5fb07f9aae570c40166dfd2ad6ab41f7bba162 100644 (file)
@@ -34,5 +34,3 @@ CONTAINS
   END SUBROUTINE
 
 END MODULE
-
-! { dg-final { cleanup-modules "my_mod" } }
index 6e6dc52d0fdc318e0cbf6ade47e34984531591a7..a08e5343b7de66e2532cc334d31e3138007d30dc 100644 (file)
@@ -19,5 +19,3 @@ contains
   end subroutine inter
 
 end module m 
-
-! { dg-final { cleanup-modules "m" } }
index 061a41a07f3413b47d22440ed610c2eb2dc718a5..c9d0fe0b5de0c29204ec94ba9976226fa98f9092 100644 (file)
@@ -22,5 +22,3 @@ contains
     class(t) :: this
   end subroutine sub2
 end module m 
-
-! { dg-final { cleanup-modules "m" } }
index c2116e965a8cb392d462d680c38a8633b982d7ea..eff919e9328b5bbeebda02b6c1fa77792de4df07 100644 (file)
@@ -24,5 +24,3 @@ contains
   end subroutine
 
 end module
-
-! { dg-final { cleanup-modules "m" } }
index 8515cf4378f483e33a6b54be6af9038ec8d98543..8fd2a59578ea21a1860c37ff6687124ed85cbe06 100644 (file)
@@ -23,5 +23,3 @@ contains
   end subroutine
 
 end module
-
-! { dg-final { cleanup-modules "a_mod" } }
index f71ffd9e8a7f796ef237e67207589434b1adb048..2cff16d1995029cf73d9a9d04ca67751bad8d6a4 100644 (file)
@@ -14,5 +14,3 @@ module Objects
   end Type
 
 end module
-
-! { dg-final { cleanup-modules "Objects" } }
index eff43ebe53bddeb6f1690420a6091aa6e07e6792..f56301cfd15ffbb504940182ecd13c7558087299 100644 (file)
@@ -45,5 +45,3 @@ contains
     myadd = a%x + b
   end function MyAdd
 end module
-
-! { dg-final { cleanup-modules "M1 M2" } }
index d5ac9e97533ad4f523ee0f8dce82c0b0930732e3..1288ef50d422e4626b6d29d87acda3646ee6d3fb 100644 (file)
@@ -21,5 +21,3 @@ contains
     class(athlete) ,intent(in) :: this
   end function
 end module 
-
-! { dg-final { cleanup-modules "athlete_module" } }
index 26c49a188eb1a5a58ac4486b14981d92dbdbf72c..81fe7744a853f47870b7911ee0d305b44e2d3725 100644 (file)
@@ -49,5 +49,3 @@ program drive
   if (h1%sum(h2) /= 1) call abort()
 
 end
-
-! { dg-final { cleanup-modules "overwrite" } }
index 36d84737e18cb8ea402a757c16f9f23a145028f2..c3ca5e355cf970e52cffd056c18ec2c210d32fa1 100644 (file)
@@ -30,5 +30,3 @@ contains
     name = "name_B"
   end function
 end module
-
-! { dg-final { cleanup-modules "dtAs dtBs" } }
index 95131dea3b81501fb23cb075c8b5c48fe5ed3044..634645263526b2348a08949b92c44761a2a62fe0 100644 (file)
@@ -30,5 +30,3 @@ contains
     class(r_type) :: mapout
   end subroutine
 end module
-
-! { dg-final { cleanup-modules "base_mod r_mod" } }
index 565dd48d4fd0b6cdb4a9d67bb6250e8624a8f452..fc48fccb648f18e83e7eed5dc00b57d7daae3416 100644 (file)
@@ -1,40 +1,38 @@
-! { dg-do compile }\r
-!\r
-! PR 54190: TYPE(*)/assumed-rank: Type/rank check too relaxed for dummy procedure\r
-! PR 57217: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check\r
-!\r
-! Contributed by Tobias Burnus <burnus@gcc.gnu.org>\r
-\r
-module base_mod\r
-  implicit none\r
-  type base_type\r
-    integer :: kind\r
-  contains\r
-    procedure, pass(map)  :: clone    => base_clone\r
-  end type\r
-contains\r
-  subroutine  base_clone(map,mapout,info)\r
-    class(base_type), intent(inout) :: map\r
-    class(base_type), intent(inout) :: mapout\r
-    integer     :: info\r
-  end subroutine\r
-end module\r
-\r
-module r_mod\r
-  use base_mod\r
-  implicit none\r
-  type, extends(base_type) :: r_type\r
-    real  :: dat\r
-  contains\r
-    procedure, pass(map)  :: clone    => r_clone   ! { dg-error "Type mismatch in argument" }\r
-  end type\r
-contains\r
-  subroutine  r_clone(map,mapout,info)\r
-    class(r_type), intent(inout) :: map\r
-!gcc$ attributes no_arg_check :: mapout\r
-    integer, intent(inout) :: mapout\r
-    integer     :: info\r
-  end subroutine\r
-end module\r
-\r
-! { dg-final { cleanup-modules "base_mod r_mod" } }\r
+! { 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
index 45720fd610fc7ca4a606a4f453df561d6e278f77..55d4002ce17ede4e57fdafdc521ccb895ad06e10 100644 (file)
@@ -1,39 +1,37 @@
-! { dg-do compile }\r
-!\r
-! PR 54190: TYPE(*)/assumed-rank: Type/rank check too relaxed for dummy procedure\r
-! PR 57217: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check\r
-!\r
-! Contributed by Tobias Burnus <burnus@gcc.gnu.org>\r
-\r
-module base_mod\r
-  implicit none\r
-  type base_type\r
-    integer :: kind\r
-  contains\r
-    procedure, pass(map)  :: clone    => base_clone\r
-  end type\r
-contains\r
-  subroutine  base_clone(map,mapout,info)\r
-    class(base_type), intent(inout) :: map\r
-    class(base_type), intent(inout) :: mapout\r
-    integer     :: info\r
-  end subroutine\r
-end module\r
-\r
-module r_mod\r
-  use base_mod\r
-  implicit none\r
-  type, extends(base_type) :: r_type\r
-    real  :: dat\r
-  contains\r
-    procedure, pass(map)  :: clone    => r_clone   ! { dg-error "Rank mismatch in argument" }\r
-  end type\r
-contains\r
-  subroutine  r_clone(map,mapout,info)\r
-    class(r_type), intent(inout) :: map\r
-    class(base_type), intent(inout) :: mapout(..)\r
-    integer     :: info\r
-  end subroutine\r
-end module\r
-\r
-! { dg-final { cleanup-modules "base_mod r_mod" } }\r
+! { 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
index 0c7c48ad56686c9e985ac5c7f978b1b2c6f9766a..6f75115df5ba9ff827a487f8c86f3ffe8491f96e 100644 (file)
@@ -1,39 +1,37 @@
-! { dg-do compile }\r
-!\r
-! PR 54190: TYPE(*)/assumed-rank: Type/rank check too relaxed for dummy procedure\r
-! PR 57217: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check\r
-!\r
-! Contributed by Tobias Burnus <burnus@gcc.gnu.org>\r
-\r
-module base_mod\r
-  implicit none\r
-  type base_type\r
-    integer :: kind\r
-  contains\r
-    procedure, pass(map)  :: clone    => base_clone\r
-  end type\r
-contains\r
-  subroutine  base_clone(map,mapout,info)\r
-    class(base_type), intent(inout) :: map\r
-    class(base_type), intent(inout) :: mapout\r
-    integer     :: info\r
-  end subroutine\r
-end module\r
-\r
-module r_mod\r
-  use base_mod\r
-  implicit none\r
-  type, extends(base_type) :: r_type\r
-    real  :: dat\r
-  contains\r
-    procedure, pass(map)  :: clone    => r_clone   ! { dg-error "Type mismatch in argument" }\r
-  end type\r
-contains\r
-  subroutine  r_clone(map,mapout,info)\r
-    class(r_type), intent(inout) :: map\r
-    type(*), intent(inout) :: mapout\r
-    integer     :: info\r
-  end subroutine\r
-end module\r
-\r
-! { dg-final { cleanup-modules "base_mod r_mod" } }\r
+! { 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
index 74199c343faa89ea4721b5a167f41898b04c1405..04d97f80641481966967123fb3044e64b78acab4 100644 (file)
@@ -26,5 +26,3 @@ contains
   end function
 
 end module
-
-! { dg-final { cleanup-modules "t" } }
index 2650d149368bda7da6407be74676fba71b11b08f..3e9a9aab634ae4f73b2684b119d1f7c82794a578 100644 (file)
@@ -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" } }
index 09b072610893fcf5bffeeb965dc074d05f4aa85c..5fa5a0fac00bc7f8b1c49fa6c6ba0850e2cb81c9 100644 (file)
@@ -34,5 +34,3 @@ contains
   end function
 
 end module
-
-! { dg-final { cleanup-modules "phs_single" } }
index d83a9cdb4d0ec601fff9490cbea979657afe7d04..82a67c08417fd505d165fbc2338c7318aaf1bb5d 100644 (file)
@@ -24,5 +24,3 @@ contains
   end function
 
 end module
-
-! { dg-final { cleanup-modules "classes" } }
index 00ae9c7326333f79c6cb4e5628f2f08c09917989..035965be426d39039a6f592ffd7da65307b87a53 100644 (file)
@@ -31,5 +31,3 @@ contains
   end function
 
 end module
-
-! { dg-final { cleanup-modules "classes" } }
index 68ea53fcd115a158f772e3b028aa9726401f1f4c..41aef56cb03d7c9d07a4f4036eb1aa5be54bd31d 100644 (file)
@@ -35,5 +35,3 @@ contains
   end subroutine
 
 end
-
-! { dg-final { cleanup-modules "ObjectLists" } }
index 99e186d5c14937cf6c219033aadda2f98d295e37..2be8848c11f7f55e4344a6648510e43cfabf5546 100644 (file)
@@ -20,5 +20,3 @@ contains
   end subroutine
 
 end module
-
-! { dg-final { cleanup-modules "IO" } }
index 51359d1461c63524f985cb31cb3c73148cdad832..a665a3829ffa98fad93fcf57d4c9aa30b91bd8d2 100644 (file)
@@ -49,5 +49,3 @@ CONTAINS
     END SELECT; END SELECT
   END SUBROUTINE copy_int 
 END PROGRAM main
-
-! { dg-final { cleanup-modules "m" } }
index 2abe99cd5bba9885b563144286c754e79d218cad..399372773233a92869a47fd150b603789a4132ab 100644 (file)
@@ -214,5 +214,3 @@ program main
     end select
   end do
 end program main
-
-! { dg-final { cleanup-modules "list_mod link_mod" } }
index ebb39289fc486e671b1a789da62d58f6188f8506..b264506d4c38e4e1de69ebdd52b1e4c8bc033a75 100644 (file)
@@ -32,4 +32,3 @@ subroutine dforceb(c0, i, betae, ipol, bec0, ctabin, gqq, gqqm, qmat, dq2, df)
        &   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" } }
index 3fea702c2a49302148abac08ebfa6aee9f12e8ed..06af985393341fbfd8dab4c88c31698b49f42776 100644 (file)
@@ -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" } }
index 4d0ed9abc920804d2a0a1c9a6a59f635bef9f892..209cb7f0026a54d0371fa9bc33a45efc3833de03 100644 (file)
@@ -17,5 +17,3 @@ contains
         print *, "Hello ", a, "!"
     end subroutine
 end module
-
-! { dg-final { cleanup-modules "mod_say_hello" } }
index 958cc969253b0949f8d6047adad5a1d2967ad5fa..43b211e57bfe41c2a24f2c3c39454c992f670f00 100644 (file)
@@ -39,5 +39,3 @@ contains
   subroutine s5            ! { dg-warning "defined but not used" }
   end subroutine
 end
-
-! { dg-final { cleanup-modules "m" } }
index 7bfc0025a8aebae1ed3f157bdf2edbf657a859a2..a35f7a7abde9438e0bf12f31952ac1c7b35a75b4 100644 (file)
@@ -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
+}