This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Bug fortran/52846] [F2008] Support submodules - part 3/3


Dear All,

On 24 July 2015 at 10:08, Damian Rouson <damian@sourceryinstitute.org> wrote:
> I love this idea and had similar thoughts as well.
>
> :D
>
> Sent from my iPhone
>
>> On Jul 24, 2015, at 1:06 AM, Paul Richard Thomas <paul.richard.thomas@gmail.com> wrote:
>>
>> Dear Mikael,
>>
>> It had crossed my mind also that a .mod and a .smod file could be
>> written. Normally, the .smod files are produced by the submodules
>> themselves, so that their descendants can pick up the symbols that
>> they generate. There is no reason at all why this could not be
>> implemented; early on in the development I did just this, although I
>> think that it would now be easier to modify this patch.
>>
>> One huge advantage of proceeding in this way is that any resulting
>> library can be distributed with the .mod file alone so that the
>> private entities are never exposed. The penalty is that a second file
>> is output.
>>
>> With best regards
>>
>> Paul
>>

Please find attached the implementation of this suggestion.

Bootstraps and regtests on FC21/x86_64 - OK for trunk or is the
original preferred?

Cheers

Paul

2015-07-29  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/52846
    * module.c (check_access): Return true if new static flag
    'dump_smod' is true..
    (gfc_dump_module): Rename original 'dump_module' and call from
    new version. Use 'dump_smod' rather than the stack state to
    determine if a submodule is being processed. The new version of
    this procedure sets 'dump_smod' depending on the stack state and
    then writes both the mod and smod files if a module is being
    processed or just the smod for a submodule.
    (gfc_use_module): Eliminate the check for module_name and
    submodule_name being the same.
    * trans-decl.c (gfc_finish_var_decl, gfc_build_qualified_array,
    get_proc_pointer_decl): Set TREE_PUBLIC unconditionally and use
    the conditions to set DECL_VISIBILITY as hidden and to set as
    true DECL_VISIBILITY_SPECIFIED.

2015-07-29  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/52846

    * lib/fortran-modules.exp: Call cleanup-submodules from
    cleanup-modules.
    * gfortran.dg/public_private_module_2.f90: Add two XFAILS to
    cover the cases where private entities are no longer optimized
    away.
    * gfortran.dg/public_private_module_6.f90: Add an XFAIL for the
    same reason.
    * gfortran.dg/submodule_1.f08: Change cleanup module names.
    * gfortran.dg/submodule_5.f08: The same.
    * gfortran.dg/submodule_9.f08: The same.
    * gfortran.dg/submodule_10.f08: New test

Attachment: private-alternative.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]