[gfortran] Support for [...] style array constructors
Erik Edelmann
eedelman@acclab.helsinki.fi
Tue Apr 19 20:53:00 GMT 2005
Den 19.04 kl 00:13:05 skrev tobias.schlueter@physik.uni-muenchen.de:
> Welcome aboard!
Thanks!
> The patch is probably small enough to be admissible without the assignment,
> but in its current form it is unfortuantely not acceptable because you have to
> make sure that the user didn't request strict adherence to a Fortran standard
> pre-F2003 (see gfc_notify_std() and its uses), and with those tests it will
> probably become to large to be accepted without a copyright assignment.
>
> We also require testsuite coverage for new language features.
Copyright assignment is being handled. In the meantime I will
try to meet the technical requirements.
I added a call to gfc_notify_std () (see updated patch below);
feel free to suggest something better if you find the wording of
the warning message ill-chosen.
I'll look into writing test cases to the testsuite soon. However,
I will be a bit busy the next few days -- don't expect much to
happen before the weekend.
Erik
2005-04-19 Erik Edelmann <erik.edelmann@iki.fi>
* array.c (gfc_match_array_constructor): Support [ ... ]
style array constructors.
Index: gcc/fortran/array.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/fortran/array.c,v
retrieving revision 1.14
diff -u -p -r1.14 array.c
--- gcc/fortran/array.c 5 Apr 2005 08:54:30 -0000 1.14
+++ gcc/fortran/array.c 19 Apr 2005 20:16:26 -0000
@@ -866,14 +866,27 @@ gfc_match_array_constructor (gfc_expr **
gfc_expr *expr;
locus where;
match m;
+ const char *end_delim;
if (gfc_match (" (/") == MATCH_NO)
- return MATCH_NO;
+ {
+ if (gfc_match (" [") == MATCH_NO)
+ return MATCH_NO;
+ else
+ {
+ if (gfc_notify_std (GFC_STD_F2003, "New in Fortran 2003: [...] "
+ "style array constructors at %C") == FAILURE)
+ return MATCH_ERROR;
+ end_delim = " ]";
+ }
+ }
+ else
+ end_delim = " /)";
where = gfc_current_locus;
head = tail = NULL;
- if (gfc_match (" /)") == MATCH_YES)
+ if (gfc_match (end_delim) == MATCH_YES)
goto empty; /* Special case */
for (;;)
@@ -895,7 +908,7 @@ gfc_match_array_constructor (gfc_expr **
break;
}
- if (gfc_match (" /)") == MATCH_NO)
+ if (gfc_match (end_delim) == MATCH_NO)
goto syntax;
empty:
More information about the Gcc-patches
mailing list