]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Fri, 17 Apr 2009 09:30:39 +0000 (11:30 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Fri, 17 Apr 2009 09:30:39 +0000 (11:30 +0200)
2009-04-17  Gary Dismukes  <dismukes@adacore.com>

* par-ch6.adb (P_Subprogram): Overriding indicators should be allowed
on protected subprogram bodies, so exclude the case where Pf_Flags is
Pf_Decl_Pbod from the error check.

* par-ch9.adb (P_Protected_Operation_Items): Permit overriding
indicators on subprograms in protected bodies, and proceed with parsing
the subprogram.

* sem_ch6.adb (Verify_Overriding_Indicator): Exclude protected
subprograms from the check for primitiveness on subprograms with
overriding indicators.
(Check_Overriding_Indicator): Include protected subprograms in the
style check for missing overriding indicators.

2009-04-17  Tristan Gingold  <gingold@adacore.com>

* init.c: Fix stack checking for x86 Darwin.

2009-04-17  Vincent Celier  <celier@adacore.com>

* prj-attr.adb: New project level attribute Object_File_Suffix
(<language>).

* prj-nmsc.adb (Add_Source): Use the object file suffix to get the
object file name
(Process_Compiler): Process attribute Object_File_Suffix

* prj.adb (Object_Name): Use suffix Object_File_Suffix instead of
platform suffix, when specified.

* prj.ads (Language_Config): New component Object_File_Suffix,
defaulted to No_Name.
(Object_Name): New parameter Object_File_Suffix, defaulted to No_Name

* snames.ads-tmpl: New standard name Object_File_Suffix

From-SVN: r146228

gcc/ada/ChangeLog
gcc/ada/init.c
gcc/ada/par-ch6.adb
gcc/ada/par-ch9.adb
gcc/ada/prj-attr.adb
gcc/ada/prj-nmsc.adb
gcc/ada/prj.adb
gcc/ada/prj.ads
gcc/ada/sem_ch6.adb
gcc/ada/snames.ads-tmpl

index 6e3db147b45c61df8ee769507aaec2cf63823c3d..eaa602b0ec1d85755ab4407b55ff56a2e0ad6093 100644 (file)
@@ -1,3 +1,41 @@
+2009-04-17  Gary Dismukes  <dismukes@adacore.com>
+
+       * par-ch6.adb (P_Subprogram): Overriding indicators should be allowed
+       on protected subprogram bodies, so exclude the case where Pf_Flags is
+       Pf_Decl_Pbod from the error check.
+
+       * par-ch9.adb (P_Protected_Operation_Items): Permit overriding
+       indicators on subprograms in protected bodies, and proceed with parsing
+       the subprogram.
+
+       * sem_ch6.adb (Verify_Overriding_Indicator): Exclude protected
+       subprograms from the check for primitiveness on subprograms with
+       overriding indicators.
+       (Check_Overriding_Indicator): Include protected subprograms in the
+       style check for missing overriding indicators.
+
+2009-04-17  Tristan Gingold  <gingold@adacore.com>
+
+       * init.c: Fix stack checking for x86 Darwin.
+
+2009-04-17  Vincent Celier  <celier@adacore.com>
+
+       * prj-attr.adb: New project level attribute Object_File_Suffix
+       (<language>).
+       
+       * prj-nmsc.adb (Add_Source): Use the object file suffix to get the
+       object file name
+       (Process_Compiler): Process attribute Object_File_Suffix
+
+       * prj.adb (Object_Name): Use suffix Object_File_Suffix instead of
+       platform suffix, when specified.
+
+       * prj.ads (Language_Config): New component Object_File_Suffix,
+       defaulted to No_Name.
+       (Object_Name): New parameter Object_File_Suffix, defaulted to No_Name
+
+       * snames.ads-tmpl: New standard name Object_File_Suffix
+
 2009-04-17  Robert Dewar  <dewar@adacore.com>
 
        * gnat_rm.texi: Add documentation about No_Streams restriction
index 7ac5a26ee4575268b65e1acb85c3fa4a9cc4267e..59aabf2466c7c09c0ce4e83fe2ad21ffb1a6ddff 100644 (file)
@@ -2144,7 +2144,7 @@ __gnat_error_handler (int sig, siginfo_t * si, void * uc)
     {
     case SIGSEGV:
     case SIGBUS:
-      if (__gnat_is_stack_guard ((mach_vm_address_t)si->si_addr))
+      if (__gnat_is_stack_guard ((unsigned long)si->si_addr))
        {
          exception = &storage_error;
          msg = "stack overflow";
index 188893a4b28c17d0ed3a434e5b6f2351d61d80f8..263efe1e5a3c6b1e12032762f40b5ea7855f28b0 100644 (file)
@@ -215,9 +215,14 @@ package body Ch6 is
          --  already been given, so no need to give another message here.
 
          --  An overriding indicator is allowed for subprogram declarations,
-         --  bodies, renamings, stubs, and instantiations.
+         --  bodies, renamings, stubs, and instantiations. The test against
+         --  Pf_Decl_Pbod is added to account for the case of subprograms
+         --  declared in a protected type, where only subprogram declarations
+         --  and bodies can occur.
 
-         if Pf_Flags /= Pf_Decl_Gins_Pbod_Rnam_Stub then
+         if Pf_Flags /= Pf_Decl_Gins_Pbod_Rnam_Stub
+           and then Pf_Flags /= Pf_Decl_Pbod
+         then
             Error_Msg_SC ("overriding indicator not allowed here!");
 
          elsif Token /= Tok_Function
index fcf2d3c69b481d0eef0d19adc2baaedf7a91a303..d5c3549f23de5a23c3519cd53f55e86add11c536 100644 (file)
@@ -736,9 +736,16 @@ package body Ch9 is
          if Token = Tok_Entry or else Bad_Spelling_Of (Tok_Entry) then
             Append (P_Entry_Body, Item_List);
 
+         --  If the operation starts with procedure, function, or an overriding
+         --  indicator ("overriding" or "not overriding"), parse a subprogram.
+
          elsif Token = Tok_Function or else Bad_Spelling_Of (Tok_Function)
                  or else
                Token = Tok_Procedure or else Bad_Spelling_Of (Tok_Procedure)
+                 or else
+               Token = Tok_Overriding or else Bad_Spelling_Of (Tok_Overriding)
+                 or else
+               Token = Tok_Not or else Bad_Spelling_Of (Tok_Not)
          then
             Append (P_Subprogram (Pf_Decl_Pbod), Item_List);
 
index 6818737673ecd489a4a64d62e326df18e4075b45..4aaecaa740a8cf4b63a956b7d09e7e43c362489d 100644 (file)
@@ -173,6 +173,7 @@ package body Prj.Attr is
    "Larequired_switches#" &
    "Lapic_option#" &
    "Sapath_syntax#" &
+   "Saobject_file_suffix#" &
 
    --  Configuration - Mapping files
 
index ce5eccf71a3eb82734f8ccfca5118564a9445853..9b173bccc5251d3dd77d0c35a1c670e982d8734b 100644 (file)
@@ -646,7 +646,8 @@ package body Prj.Nmsc is
       Src_Data.Naming_Exception    := Naming_Exception;
 
       if Src_Data.Compiled and then Src_Data.Object_Exists then
-         Src_Data.Object   := Object_Name (File_Name);
+         Src_Data.Object   :=
+           Object_Name (File_Name, Config.Object_File_Suffix);
          Src_Data.Dep_Name :=
            Dependency_Name (File_Name, Src_Data.Dependency);
          Src_Data.Switches := Switches_Name (File_Name);
@@ -1541,6 +1542,19 @@ package body Prj.Nmsc is
                                     Element.Value.Location);
                            end;
 
+                        when Name_Object_File_Suffix =>
+                           if Get_Name_String (Element.Value.Value) = "" then
+                              Error_Msg
+                                (Project, In_Tree,
+                                 "object file suffix cannot be empty",
+                                 Element.Value.Location);
+
+                           else
+                              In_Tree.Languages_Data.Table
+                                (Lang_Index).Config.Object_File_Suffix :=
+                                Element.Value.Value;
+                           end if;
+
                         when Name_Pic_Option =>
 
                            --  Attribute Compiler_Pic_Option (<language>)
@@ -5796,12 +5810,12 @@ package body Prj.Nmsc is
                       Util.Value_Of
                         (Name_Source_Files, Data.Decl.Attributes, In_Tree);
 
+      Last_Source_Dir : String_List_Id  := Nil_String;
+
       Languages : constant Variable_Value :=
                       Prj.Util.Value_Of
                         (Name_Languages, Data.Decl.Attributes, In_Tree);
 
-      Last_Source_Dir : String_List_Id  := Nil_String;
-
       procedure Find_Source_Dirs
         (From     : File_Name_Type;
          Location : Source_Ptr;
index e97f1af15ad377b4dc9f748f88ab8acbd4f61f39..73e1f40109dc9e1fee9347b9cec007b2d731b011 100644 (file)
@@ -709,11 +709,18 @@ package body Prj is
    -----------------
 
    function Object_Name
-     (Source_File_Name : File_Name_Type)
+     (Source_File_Name   : File_Name_Type;
+      Object_File_Suffix : Name_Id := No_Name)
       return File_Name_Type
    is
    begin
-      return Extend_Name (Source_File_Name, Object_Suffix);
+      if Object_File_Suffix = No_Name then
+         return Extend_Name (Source_File_Name, Object_Suffix);
+
+      else
+         return Extend_Name
+           (Source_File_Name, Get_Name_String (Object_File_Suffix));
+      end if;
    end Object_Name;
 
    ----------------------
index ca09a9d8c445c5b0e2a267e7acfb5607aceb991d..db348b7a039106f3fa91cee459098a4336238be9 100644 (file)
@@ -441,6 +441,8 @@ package Prj is
       --  Value may be Canonical (Unix style) or Host (host syntax, for example
       --  on VMS for DEC C).
 
+      Object_File_Suffix : Name_Id := No_Name;
+
       Compilation_PIC_Option : Name_List_Index := No_Name_List;
       --  The option(s) to compile a source in Position Independent Code for
       --  shared libraries. Specified in the configuration. When not specified,
@@ -557,6 +559,7 @@ package Prj is
                            Compiler_Driver_Path         => null,
                            Compiler_Required_Switches   => No_Name_List,
                            Path_Syntax                  => Canonical,
+                           Object_File_Suffix           => No_Name,
                            Compilation_PIC_Option       => No_Name_List,
                            Object_Generated             => True,
                            Objects_Linked               => True,
@@ -1564,7 +1567,8 @@ package Prj is
    --  Replace the extension of File with With_Suffix
 
    function Object_Name
-     (Source_File_Name : File_Name_Type) return File_Name_Type;
+     (Source_File_Name   : File_Name_Type;
+      Object_File_Suffix : Name_Id := No_Name) return File_Name_Type;
    --  Returns the object file name corresponding to a source file name
 
    function Dependency_Name
index 2606940a69e5b3ae40ce8a9cd688fcab65ede54a..17e3d25d6d894caf301f39cabafacaf5f53247a6 100644 (file)
@@ -1766,10 +1766,12 @@ package body Sem_Ch6 is
                  ("subprogram & overrides predefined operator ",
                     Body_Spec, Spec_Id);
 
-            --  If this is not a primitive operation the overriding indicator
-            --  is altogether illegal.
+            --  If this is not a primitive operation or protected subprogram,
+            --  then the overriding indicator is altogether illegal.
 
-            elsif not Is_Primitive (Spec_Id) then
+            elsif not Is_Primitive (Spec_Id)
+              and then Ekind (Scope (Spec_Id)) /= E_Protected_Type
+            then
                Error_Msg_N ("overriding indicator only allowed " &
                 "if subprogram is primitive",
                 Body_Spec);
@@ -4281,14 +4283,15 @@ package body Sem_Ch6 is
             Set_Is_Overriding_Operation (Subp);
          end if;
 
-         --  If primitive flag is set, operation is overriding at the
-         --  point of its declaration, so warn if necessary. Otherwise
-         --  it may have been declared before the operation it overrides
-         --  and no check is required.
+         --  If primitive flag is set or this is a protected operation, then
+         --  the operation is overriding at the point of its declaration, so
+         --  warn if necessary. Otherwise it may have been declared before the
+         --  operation it overrides and no check is required.
 
          if Style_Check
-            and then not Must_Override (Spec)
-            and then Is_Primitive
+           and then not Must_Override (Spec)
+           and then (Is_Primitive
+                      or else Ekind (Scope (Subp)) = E_Protected_Type)
          then
             Style.Missing_Overriding (Decl, Subp);
          end if;
@@ -4306,7 +4309,13 @@ package body Sem_Ch6 is
       elsif Nkind (Subp) = N_Defining_Operator_Symbol then
 
          if Must_Not_Override (Spec) then
-            if not Is_Primitive then
+
+            --  If this is not a primitive operation or protected subprogram,
+            --  then "not overriding" is illegal.
+
+            if not Is_Primitive
+              and then Ekind (Scope (Subp)) /= E_Protected_Type
+            then
                Error_Msg_N
                  ("overriding indicator only allowed "
                     & "if subprogram is primitive", Subp);
index 285f92e105fdcdd3e4e7e4715a6a5be8edab7b72..2f4c6cc3b0889e2567cde4e2af8161f0c16aeb66 100644 (file)
@@ -1097,6 +1097,7 @@ package Snames is
    Name_Metrics                          : constant Name_Id := N + $;
    Name_Naming                           : constant Name_Id := N + $;
    Name_None                             : constant Name_Id := N + $;
+   Name_Object_File_Suffix               : constant Name_Id := N + $;
    Name_Object_Generated                 : constant Name_Id := N + $;
    Name_Object_List                      : constant Name_Id := N + $;
    Name_Objects_Linked                   : constant Name_Id := N + $;