Fwd: [PATCH, gfortran] Cleanup the submodule tests
Dominique d'Humières
dominiq@lps.ens.fr
Sun Jun 4 12:54:00 GMT 2017
> 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
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-cl
Type: application/octet-stream
Size: 3575 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20170604/d5c1eb76/attachment.obj>
-------------- next part --------------
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-exp
Type: application/octet-stream
Size: 4226 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20170604/d5c1eb76/attachment-0001.obj>
-------------- next part --------------
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-tsts
Type: application/octet-stream
Size: 37952 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20170604/d5c1eb76/attachment-0002.obj>
-------------- next part --------------
>
More information about the Fortran
mailing list