From: Paul Thomas Date: Fri, 17 Jul 2015 17:24:49 +0000 (+0000) Subject: re PR fortran/52846 ([F2008] Support submodules) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3d91b817dedc0b81fdf4bea70498515d92eea19c;p=gcc.git re PR fortran/52846 ([F2008] Support submodules) 2015-07-17 Paul Thomas PR fortran/52846 * decl.c (gfc_match_end): Pick out declared submodule name from the composite identifier. * gfortran.h : Add 'submodule_name' to gfc_use_list structure. * module.c (gfc_match_submodule): Define submodule_name and add static 'submodule_name'. (gfc_match_submodule): Build up submodule filenames, using '@' as a delimiter. Store the output filename in 'submodule_name'. Similarly, the submodule identifier is built using '.' as an identifier. (gfc_dump_module): If current state is COMP_SUBMODULE, write to file 'submodule_name', using SUBMODULE_EXTENSION. (gfc_use_module): Similarly, use the 'submodule_name' field in the gfc_use_list structure and SUBMODULE_EXTENSION to read the implicitly used submodule files. 2015-07-17 Paul Thomas PR fortran/52846 * lib/fortran-modules.exp (proc cleanup-submodules): New procedure. * gfortran.dg/submodule_1.f08: Change extension and clean up the submodule files. * gfortran.dg/submodule_2.f08: ditto * gfortran.dg/submodule_6.f08: ditto * gfortran.dg/submodule_7.f08: ditto * gfortran.dg/submodule_8.f08: New test * gfortran.dg/submodule_9.f08: New test From-SVN: r225947 --- diff --git a/gcc/testsuite/gfortran.dg/submodule_3.f08 b/gcc/testsuite/gfortran.dg/submodule_3.f08 new file mode 100644 index 00000000000..9d6c8d28e3a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/submodule_3.f08 @@ -0,0 +1,37 @@ +! { dg-do compile } +! { dg-options "-std=f2003" } +! +! Check enforcement of F2008 standard for MODULE PROCEDURES and SUBMODULES +! This is rather bare-bones to reduce the number of error messages too the +! essential minimum. +! +! Contributed by Paul Thomas +! + module foo_interface + implicit none + + interface + module function array1(this) result (that) ! { dg-error "MODULE prefix" } + end function ! { dg-error "Expecting END INTERFACE" } + character(16) module function array2(this, that) ! { dg-error "MODULE prefix" } + end function ! { dg-error "Expecting END INTERFACE" } + end interface + end module + +! + SUBMODULE (foo_interface) foo_interface_son ! { dg-error "SUBMODULE declaration" } +! + contains + + module function array1 (this) result(that) ! { dg-error "MODULE prefix" } + end function ! { dg-error "Expecting END PROGRAM" } + +! Test array characteristics for dummy and result are OK for +! abbreviated module procedure declaration. + module procedure array2 ! { dg-error "must be in a generic module interface" } + end PROCEDURE ! { dg-error "Expecting END PROGRAM" } + + end SUBMODULE foo_interface_son ! { dg-error "Expecting END PROGRAM" } + +end ! { dg-error "CONTAINS statement without FUNCTION or SUBROUTINE" } + diff --git a/gcc/testsuite/gfortran.dg/submodule_3.f90 b/gcc/testsuite/gfortran.dg/submodule_3.f90 deleted file mode 100644 index 9d6c8d28e3a..00000000000 --- a/gcc/testsuite/gfortran.dg/submodule_3.f90 +++ /dev/null @@ -1,37 +0,0 @@ -! { dg-do compile } -! { dg-options "-std=f2003" } -! -! Check enforcement of F2008 standard for MODULE PROCEDURES and SUBMODULES -! This is rather bare-bones to reduce the number of error messages too the -! essential minimum. -! -! Contributed by Paul Thomas -! - module foo_interface - implicit none - - interface - module function array1(this) result (that) ! { dg-error "MODULE prefix" } - end function ! { dg-error "Expecting END INTERFACE" } - character(16) module function array2(this, that) ! { dg-error "MODULE prefix" } - end function ! { dg-error "Expecting END INTERFACE" } - end interface - end module - -! - SUBMODULE (foo_interface) foo_interface_son ! { dg-error "SUBMODULE declaration" } -! - contains - - module function array1 (this) result(that) ! { dg-error "MODULE prefix" } - end function ! { dg-error "Expecting END PROGRAM" } - -! Test array characteristics for dummy and result are OK for -! abbreviated module procedure declaration. - module procedure array2 ! { dg-error "must be in a generic module interface" } - end PROCEDURE ! { dg-error "Expecting END PROGRAM" } - - end SUBMODULE foo_interface_son ! { dg-error "Expecting END PROGRAM" } - -end ! { dg-error "CONTAINS statement without FUNCTION or SUBROUTINE" } -