This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, Fortran] ABSTRACT INTERFACE
- From: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
- To: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
- Cc: Janus Weil <jaydub66 at googlemail dot com>, gcc-patches at gcc dot gnu dot org, "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>
- Date: Sat, 18 Aug 2007 18:37:59 +0200
- Subject: Re: [PATCH, Fortran] ABSTRACT INTERFACE
- References: <854832d40708180729p583cd306p1bef676f5553cadd@mail.gmail.com> <46C71FB3.4010909@physik.uni-muenchen.de>
Sigh, Tobias' approval somehow only arrived after I had sent the
previous mail. Unless someone beats me to it, I'll take care of these
issues myself tomorrow.
Cheers,
- Tobi
Tobias Schlüter wrote:
Janus Weil wrote:
Index: gcc/fortran/module.c
===================================================================
--- gcc/fortran/module.c (revision 127586)
+++ gcc/fortran/module.c (working copy)
@@ -599,6 +599,7 @@ gfc_match_use (void)
switch (type)
{
case INTERFACE_NAMELESS:
+ case INTERFACE_ABSTRACT:
gfc_error ("Missing generic specification in USE statement at
%C");
goto cleanup;
Please add a test for this error. In general all error messages should
be tested.
Index: gcc/fortran/parse.c
===================================================================
--- gcc/fortran/parse.c (revision 127586)
+++ gcc/fortran/parse.c (working copy)
@@ -172,6 +172,7 @@ decode_statement (void)
switch (c)
{
case 'a':
+ match ("abstract interface", gfc_match_abstract_interface,
ST_INTERFACE);
match ("allocate", gfc_match_allocate, ST_ALLOCATE);
match ("allocatable", gfc_match_allocatable, ST_ATTR_DECL);
match ("assign", gfc_match_assign, ST_LABEL_ASSIGNMENT);
This should probably be "abstract% interface" (i.e. with an obligatory
blank).
@@ -1795,6 +1796,18 @@ loop:
}
}
+ if (current_interface.type == INTERFACE_ABSTRACT)
+ {
+ gfc_new_block->attr.abstract = 1;
+ if (!strcmp(gfc_new_block->name,"integer")
+ || !strcmp(gfc_new_block->name,"real")
+ || !strcmp(gfc_new_block->name,"complex")
+ || !strcmp(gfc_new_block->name,"character")
+ || !strcmp(gfc_new_block->name,"logical"))
+ gfc_error ("Name of ABSTRACT INTERFACE at %C cannot be the same as "
+ "an intrinsic type: %s",gfc_new_block->name);
+ }
+
You're missing some intrinsic types there. Please merge this with the
code from decl.c:5468 (and perhaps similar code in other places, but I
didn't find any), putting this into a single function, something like
gfc_is_intrinsic_typename (const char *name, const char *error_message).
This function should go into symbol.c.
Apart from that the patch looks fine. I take it that there is no way of
using this feature by itself? In that case I would be a bit reluctant
to add this by itself, instead of waiting for procedure pointers, but I
don't think this is worth being overly rigid, especially since the other
patch seems to be coming along quite well.
Thanks,
- Tobi