diff options
author | Daniel Franke <franke.daniel@gmail.com> | 2011-01-06 11:08:24 -0500 |
---|---|---|
committer | Daniel Franke <dfranke@gcc.gnu.org> | 2011-01-06 11:08:24 -0500 |
commit | 284d58f1dda60adfb42282012ee1baf8b069a1bd (patch) | |
tree | 6107feaeaefcf653db2c2565c6b9daf129b653e1 /gcc/fortran/parse.c | |
parent | 028dbdf4974d803868feb3a44e978d138cd37338 (diff) | |
download | gcc-284d58f1dda60adfb42282012ee1baf8b069a1bd.zip gcc-284d58f1dda60adfb42282012ee1baf8b069a1bd.tar.gz gcc-284d58f1dda60adfb42282012ee1baf8b069a1bd.tar.bz2 |
re PR fortran/33117 (Improve error message for generic interface with subroutines & functions)
gcc/fortran/:
2011-01-06 Daniel Franke <franke.daniel@gmail.com>
PR fortran/33117
PR fortran/46478
* parse.c (parse_interface): Remove check for procedure types.
* interface.c (check_interface0): Verify that procedures are
either all SUBROUTINEs or all FUNCTIONs.
gcc/testsuite/:
2011-01-06 Daniel Franke <franke.daniel@gmail.com>
PR fortran/33117
PR fortran/46478
* gfortran.dg/interface_33.f90: New test.
From-SVN: r168542
Diffstat (limited to 'gcc/fortran/parse.c')
-rw-r--r-- | gcc/fortran/parse.c | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c index ea9667d..58d8b43 100644 --- a/gcc/fortran/parse.c +++ b/gcc/fortran/parse.c @@ -2263,32 +2263,16 @@ loop: } - /* Make sure that a generic interface has only subroutines or - functions and that the generic name has the right attribute. */ - if (current_interface.type == INTERFACE_GENERIC) + /* Make sure that the generic name has the right attribute. */ + if (current_interface.type == INTERFACE_GENERIC + && current_state == COMP_NONE) { - if (current_state == COMP_NONE) - { - if (new_state == COMP_FUNCTION && sym) - gfc_add_function (&sym->attr, sym->name, NULL); - else if (new_state == COMP_SUBROUTINE && sym) - gfc_add_subroutine (&sym->attr, sym->name, NULL); - - current_state = new_state; - } - else - { - if (new_state != current_state) - { - if (new_state == COMP_SUBROUTINE) - gfc_error ("SUBROUTINE at %C does not belong in a " - "generic function interface"); + if (new_state == COMP_FUNCTION && sym) + gfc_add_function (&sym->attr, sym->name, NULL); + else if (new_state == COMP_SUBROUTINE && sym) + gfc_add_subroutine (&sym->attr, sym->name, NULL); - if (new_state == COMP_FUNCTION) - gfc_error ("FUNCTION at %C does not belong in a " - "generic subroutine interface"); - } - } + current_state = new_state; } if (current_interface.type == INTERFACE_ABSTRACT) |