decl.c (gfc_match_entry): Function entries don't need an argument list if there's...
authorTobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
Wed, 2 Nov 2005 00:04:28 +0000 (01:04 +0100)
committerTobias Schlüter <tobi@gcc.gnu.org>
Wed, 2 Nov 2005 00:04:28 +0000 (01:04 +0100)
fortran/
* decl.c (gfc_match_entry): Function entries don't need an argument
list if there's no RESULT clause.
testsuite/
* gfortran.fortran-torture/execute/entry_9.f90: Revert previous
change (r106358).

From-SVN: r106361

gcc/fortran/ChangeLog
gcc/fortran/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.fortran-torture/execute/entry_9.f90

index 4309d215574b9ff8b68b60f0c5fc9e9ea1707e1e..de6fed333206a4bf490d52272b4296c9e90bccb0 100644 (file)
@@ -1,3 +1,8 @@
+2005-11-02  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>
+
+       * decl.c (gfc_match_entry): Function entries don't need an argument
+       list if there's no RESULT clause.
+
 2005-11-01  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>
 
        PR fortran/24008
index 74aa6841d7a3f159a2472111e1c572569fbb478b..f7734e1b6c71c7bc1d3175d81f3cf8d5d76d230a 100644 (file)
@@ -2603,6 +2603,7 @@ gfc_match_entry (void)
   gfc_compile_state state;
   match m;
   gfc_entry_list *el;
+  locus old_loc;
 
   m = gfc_match_name (name);
   if (m != MATCH_YES)
@@ -2690,8 +2691,26 @@ gfc_match_entry (void)
     }
   else
     {
-      /* An entry in a function.  */
-      m = gfc_match_formal_arglist (entry, 0, 0);
+      /* An entry in a function.
+         We need to take special care because writing
+            ENTRY f()
+         as
+            ENTRY f
+         is allowed, whereas
+            ENTRY f() RESULT (r)
+         can't be written as
+            ENTRY f RESULT (r).  */
+      old_loc = gfc_current_locus;
+      if (gfc_match_eos () == MATCH_YES)
+       {
+         gfc_current_locus = old_loc;
+         /* Match the empty argument list, and add the interface to
+            the symbol.  */
+         m = gfc_match_formal_arglist (entry, 0, 1);
+       }
+      else
+       m = gfc_match_formal_arglist (entry, 0, 0);
+
       if (m != MATCH_YES)
        return MATCH_ERROR;
 
index 370954da240949241f5a0cc7a7d6f301d07e219d..faa7ff51382dd6a7ef97efa0281117514aef60dc 100644 (file)
@@ -1,3 +1,8 @@
+2005-11-02  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>
+
+       * gfortran.fortran-torture/execute/entry_9.f90: Revert previous
+       change (r106358).
+
 2005-11-01  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>
 
        PR fortran/24008
index a269fdf60ab888344a773d05cf3bfecf019d147f..d29f4b8344c041ffd82bf44b35252d1b59df7b0b 100644 (file)
@@ -5,12 +5,12 @@
        integer a, f1, e1
        f1 = 15 + a
        return
-       entry e1()
+       entry e1
        e1 = 42
        end function
        function f2 ()
        real f2, e2
-       entry e2()
+       entry e2
        e2 = 45
        end function