http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56408



--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-02-20 
15:29:07 UTC ---

(In reply to comment #4)

> So can the modules be just moved into their own separate files and #included

> (or INCLUDEd)?



No. Those tests require that there is more than one translation unit. With

"include" one has effectively one one TU.





> Or add something like dg-additional-sources for module compilations, where

> dg.exp would compile those files ahead of compiling the particular testcase,

> and the testcase would contain dg-final cleanup lines for all those modules 

> (so every test would be self-contained).



Well, that's essentially what is currently (with the patch), except that one

runs into the "-o" issue.



I think it should be also solvable with the current dg-additional-sources -

either relying on having the ".s" in the current working directory (i.e.

getting rid of the "-o".) -- Or by compiling separately for the

dg-additional-sources (for "dg-do compile"). Probably, the former is not an

option.





Currently, it is handled as:



proc gfortran_target_compile { source dest type options } {

...

    set options [dg-additional-files-options $options $source]

    return [target_compile $source $dest $type $options]

}



The "dg-additional-files-options" adds the additional sources to $options.



Maybe, an option would be to do



  if { $type == "compile" } {

    set result [target_compile $source $dest $type $options]

    foreach srcfile $additional_sources {

      lappend result [target_compile $srcfile $dest $type $options]

    }

    return $result

  }



Or something like that. (It probably needs some refinement as

"dg-additional-files-options" also supports downloading etc. I am also not sure

whether "foreach" properly splits the files in '{ dg-additional-sources

"class_4b.f03 class_4c.f03" }', though it might do so.)

Reply via email to