[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Mon, 1 Aug 2011 09:04:40 +0000 (11:04 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Mon, 1 Aug 2011 09:04:40 +0000 (11:04 +0200)
2011-08-01  Ed Schonberg  <schonberg@adacore.com>

* sem_attr.adb (Analyze_Attribute, case 'Access): handle properly named
access to protected subprograms in generic bodies.
* sem_ch6.adb (Analyze_Subprogram_Declaration): If the context is a
protected type, indicate that the convention of the subprogram is
Convention_Protected, because it may be used in subsequent declarations
within the protected declaration.

2011-08-01  Vincent Celier  <celier@adacore.com>

* mlib-prj.adb (Build_Library): Use "ada_" as the prefix for the "init"
and "final" procedures when the name of the library is "ada", to avoid
duplicate symbols "adainit" and "adafinal" in executables.

From-SVN: r177002

gcc/ada/ChangeLog
gcc/ada/mlib-prj.adb
gcc/ada/sem_attr.adb
gcc/ada/sem_ch6.adb

index 46032fdff3bfa4dfdc1e738a7c68b085c48b6024..101b285d6b7d2319b0dd456f3c4d731188ee55b4 100644 (file)
@@ -1,3 +1,18 @@
+2011-08-01  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_attr.adb (Analyze_Attribute, case 'Access): Handle properly named
+       access to protected subprograms in generic bodies.
+       * sem_ch6.adb (Analyze_Subprogram_Declaration): If the context is a
+       protected type, indicate that the convention of the subprogram is
+       Convention_Protected, because it may be used in subsequent declarations
+       within the protected declaration.
+
+2011-08-01  Vincent Celier  <celier@adacore.com>
+
+       * mlib-prj.adb (Build_Library): Use "ada_" as the prefix for the "init"
+       and "final" procedures when the name of the library is "ada", to avoid
+       duplicate symbols "adainit" and "adafinal" in executables.
+
 2011-08-01  Ed Schonberg  <schonberg@adacore.com>
 
        * sem_attr.adb (Analyze_Attribute, case 'Result): Handle properly a
index 8c0d4e1b06f81a2d7ef26a26a0a6d97e009d9101..8feffc019c6354c2cb477e786e00c74d0e01604a 100644 (file)
@@ -862,7 +862,7 @@ package body MLib.Prj is
                Arguments := new String_List (1 .. Initial_Argument_Max);
             end if;
 
-            --  Add "-n -o b~<lib>.adb (b__<lib>.adb on VMS) -L<lib>"
+            --  Add "-n -o b~<lib>.adb (b__<lib>.adb on VMS) -L<lib>_"
 
             Argument_Number := 2;
             Arguments (1) := No_Main;
@@ -875,7 +875,17 @@ package body MLib.Prj is
             Add_Argument
               (B_Start.all
                & Get_Name_String (For_Project.Library_Name) & ".adb");
-            Add_Argument ("-L" & Get_Name_String (For_Project.Library_Name));
+
+            --  Make sure that the init procedure is never "adainit"
+
+            Get_Name_String (For_Project.Library_Name);
+
+            if Name_Buffer (1 .. Name_Len) = "ada" then
+               Add_Argument ("-Lada_");
+            else
+               Add_Argument
+                 ("-L" & Get_Name_String (For_Project.Library_Name));
+            end if;
 
             if For_Project.Lib_Auto_Init and then SALs_Use_Constructors then
                Add_Argument (Auto_Initialize);
@@ -950,16 +960,15 @@ package body MLib.Prj is
                then
                   if Check_Project (Unit.File_Names (Impl).Project) then
                      if Unit.File_Names (Spec) = null then
-                        declare
-                           Src_Ind : Source_File_Index;
-
-                        begin
-                           Src_Ind := Sinput.P.Load_Project_File
-                                        (Get_Name_String
-                                          (Unit.File_Names (Impl).Path.Name));
 
-                           --  Add the ALI file only if it is not a subunit
+                        --  Add the ALI file only if it is not a subunit
 
+                        declare
+                           Src_Ind : constant Source_File_Index :=
+                                       Sinput.P.Load_Project_File
+                                         (Get_Name_String
+                                           (Unit.File_Names (Impl).Path.Name));
+                        begin
                            if not
                              Sinput.P.Source_File_Is_Subunit (Src_Ind)
                            then
index 734c1a723c69a14d2e78c4b1868efd264df9c657..ea00352ec6fcf3d7f08937fa36e4c42c670e27df 100644 (file)
@@ -7837,14 +7837,16 @@ package body Sem_Attr is
 
                if Ekind_In (Btyp, E_Access_Subprogram_Type,
                                   E_Anonymous_Access_Subprogram_Type,
+                                  E_Access_Protected_Subprogram_Type,
                                   E_Anonymous_Access_Protected_Subprogram_Type)
                then
                   --  Deal with convention mismatch
 
-                  if Convention (Btyp) /= Convention (Entity (P)) then
+                  if Convention (Designated_Type (Btyp)) /=
+                     Convention (Entity (P))
+                  then
                      Error_Msg_FE
                        ("subprogram & has wrong convention", P, Entity (P));
-
                      Error_Msg_FE
                        ("\does not match convention of access type &",
                         P, Btyp);
index ab3f26b7a8e0c0862605f1f1f934d6a5de341501..625fc4e43d032cd84ea18898db1d9e63ae5f9f48 100644 (file)
@@ -2929,6 +2929,14 @@ package body Sem_Ch6 is
          Write_Eol;
       end if;
 
+      if Is_Protected_Type (Current_Scope) then
+
+         --  Indicate that this is a protected operation, because it may be
+         --  used in subsequent declarations within the protected type.
+
+         Set_Convention (Designator, Convention_Protected);
+      end if;
+
       List_Inherited_Pre_Post_Aspects (Designator);
       Analyze_Aspect_Specifications (N, Designator, Aspect_Specifications (N));
    end Analyze_Subprogram_Declaration;