aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/module.c
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2007-03-08 14:11:54 +0100
committerTobias Burnus <burnus@gcc.gnu.org>2007-03-08 14:11:54 +0100
commit56bedf420fd15955cfa194ead87f2beaedac9509 (patch)
treee00b232da514f8ce7cd1afe09475bd9cd69a6751 /gcc/fortran/module.c
parentac497e6a6e1ea5232c801338a34a41ae30555650 (diff)
downloadgcc-56bedf420fd15955cfa194ead87f2beaedac9509.zip
gcc-56bedf420fd15955cfa194ead87f2beaedac9509.tar.gz
gcc-56bedf420fd15955cfa194ead87f2beaedac9509.tar.bz2
[multiple changes]
2007-07-08 Tobias Burnus <burnus@net-b.de> * module.c (gfc_match_use): Support renaming of operators in USE statements. * gfortran.texi (Fortran 2003 Status): Document support of renaming of operators. 2007-03-08 Tobias Burnus <burnus@net-b.de> * gfortran.dg/use_5.f90: New test. * gfortran.dg/use_6.f90: Ditto. * gfortran.dg/use_7.f90: Ditto. From-SVN: r122699
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r--gcc/fortran/module.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index fcae6bd..5b8bd55 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -488,7 +488,7 @@ gfc_match_use (void)
{
char name[GFC_MAX_SYMBOL_LEN + 1], module_nature[GFC_MAX_SYMBOL_LEN + 1];
gfc_use_rename *tail = NULL, *new;
- interface_type type;
+ interface_type type, type2;
gfc_intrinsic_op operator;
match m;
@@ -588,9 +588,16 @@ gfc_match_use (void)
gfc_error ("Missing generic specification in USE statement at %C");
goto cleanup;
+ case INTERFACE_USER_OP:
case INTERFACE_GENERIC:
m = gfc_match (" =>");
+ if (type == INTERFACE_USER_OP && m == MATCH_YES
+ && (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: Renaming "
+ "operators in USE statements at %C")
+ == FAILURE))
+ goto cleanup;
+
if (only_flag)
{
if (m != MATCH_YES)
@@ -598,8 +605,9 @@ gfc_match_use (void)
else
{
strcpy (new->local_name, name);
-
- m = gfc_match_name (new->use_name);
+ m = gfc_match_generic_spec (&type2, new->use_name, &operator);
+ if (type != type2)
+ goto syntax;
if (m == MATCH_NO)
goto syntax;
if (m == MATCH_ERROR)
@@ -612,7 +620,9 @@ gfc_match_use (void)
goto syntax;
strcpy (new->local_name, name);
- m = gfc_match_name (new->use_name);
+ m = gfc_match_generic_spec (&type2, new->use_name, &operator);
+ if (type != type2)
+ goto syntax;
if (m == MATCH_NO)
goto syntax;
if (m == MATCH_ERROR)
@@ -627,11 +637,10 @@ gfc_match_use (void)
goto cleanup;
}
- break;
+ if (type == INTERFACE_USER_OP)
+ new->operator = operator;
- case INTERFACE_USER_OP:
- strcpy (new->use_name, name);
- /* Fall through */
+ break;
case INTERFACE_INTRINSIC_OP:
new->operator = operator;