]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2015-10-26 Ed Schonberg <schonberg@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 26 Oct 2015 10:49:55 +0000 (10:49 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 26 Oct 2015 10:49:55 +0000 (10:49 +0000)
* sem_ch6.adb (Find_Corresponding_Spec): Reject a subprogram
body whose signature is type conformant with a previous expression
function.

2015-10-26  Bob Duff  <duff@adacore.com>

* treepr.adb: Code clean up.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229326 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/sem_ch6.adb
gcc/ada/treepr.adb

index 5dff6de4fca189f390914f8a90cd61352f707e10..442dafe0853e8d6c3f1f7c9b3b58359e2fb89ef4 100644 (file)
@@ -1,3 +1,13 @@
+2015-10-26  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch6.adb (Find_Corresponding_Spec): Reject a subprogram
+       body whose signature is type conformant with a previous expression
+       function.
+
+2015-10-26  Bob Duff  <duff@adacore.com>
+
+       * treepr.adb: Code clean up.
+
 2015-10-26  Eric Botcazou  <ebotcazou@adacore.com>
 
        * freeze.adb (Check_Component_Storage_Order): Skip a record
index 0f2615861f8f3559577e2686225f274b75d0ac4b..495df3d653e8d558d151d57a9ed7c2dc986826df 100644 (file)
@@ -7310,6 +7310,19 @@ package body Sem_Ch6 is
                then
                   return E;
 
+               --  Expression functions can be completions, but cannot be
+               --  completed by an explicit body.
+
+               elsif Comes_From_Source (E)
+                 and then Comes_From_Source (N)
+                 and then Nkind (N) = N_Subprogram_Body
+                 and then Nkind (Original_Node (Unit_Declaration_Node (E))) =
+                            N_Expression_Function
+               then
+                  Error_Msg_Sloc := Sloc (E);
+                  Error_Msg_N ("body conflicts with expression function#", N);
+                  return Empty;
+
                elsif not Has_Completion (E) then
                   if Nkind (N) /= N_Subprogram_Body_Stub then
                      Set_Corresponding_Spec (N, E);
index d11a12bbe9c6e18d321910809e62093bf0022f95..a032416587bb311dd71ad8ff7a745fc4fa3ff1d1 100644 (file)
@@ -1565,13 +1565,9 @@ package body Treepr is
       Print_Elist_Ref (E);
       Print_Eol;
 
-      M := First_Elmt (E);
-
-      if No (M) then
-         Print_Str ("<empty element list>");
-         Print_Eol;
+      if Present (E) and then not Is_Empty_Elmt_List (E) then
+         M := First_Elmt (E);
 
-      else
          loop
             Print_Char ('|');
             Print_Eol;