aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2009-04-17 11:30:39 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2009-04-17 11:30:39 +0200
commit618fb570b9d2a668d6d217ad486379ad0e1370b6 (patch)
treedc9767c938b339ff6ffccf318357c7538dcffd5f
parent93bcda233f11648dbf583a9f0e50af387594d78a (diff)
downloadgcc-618fb570b9d2a668d6d217ad486379ad0e1370b6.zip
gcc-618fb570b9d2a668d6d217ad486379ad0e1370b6.tar.gz
gcc-618fb570b9d2a668d6d217ad486379ad0e1370b6.tar.bz2
[multiple changes]
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
-rw-r--r--gcc/ada/ChangeLog38
-rw-r--r--gcc/ada/init.c2
-rw-r--r--gcc/ada/par-ch6.adb9
-rw-r--r--gcc/ada/par-ch9.adb7
-rw-r--r--gcc/ada/prj-attr.adb1
-rw-r--r--gcc/ada/prj-nmsc.adb20
-rw-r--r--gcc/ada/prj.adb11
-rw-r--r--gcc/ada/prj.ads6
-rw-r--r--gcc/ada/sem_ch6.adb29
-rw-r--r--gcc/ada/snames.ads-tmpl1
10 files changed, 105 insertions, 19 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 6e3db14..eaa602b 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -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
diff --git a/gcc/ada/init.c b/gcc/ada/init.c
index 7ac5a26..59aabf2 100644
--- a/gcc/ada/init.c
+++ b/gcc/ada/init.c
@@ -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";
diff --git a/gcc/ada/par-ch6.adb b/gcc/ada/par-ch6.adb
index 188893a..263efe1 100644
--- a/gcc/ada/par-ch6.adb
+++ b/gcc/ada/par-ch6.adb
@@ -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
diff --git a/gcc/ada/par-ch9.adb b/gcc/ada/par-ch9.adb
index fcf2d3c..d5c3549 100644
--- a/gcc/ada/par-ch9.adb
+++ b/gcc/ada/par-ch9.adb
@@ -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);
diff --git a/gcc/ada/prj-attr.adb b/gcc/ada/prj-attr.adb
index 6818737..4aaecaa 100644
--- a/gcc/ada/prj-attr.adb
+++ b/gcc/ada/prj-attr.adb
@@ -173,6 +173,7 @@ package body Prj.Attr is
"Larequired_switches#" &
"Lapic_option#" &
"Sapath_syntax#" &
+ "Saobject_file_suffix#" &
-- Configuration - Mapping files
diff --git a/gcc/ada/prj-nmsc.adb b/gcc/ada/prj-nmsc.adb
index ce5eccf..9b173bc 100644
--- a/gcc/ada/prj-nmsc.adb
+++ b/gcc/ada/prj-nmsc.adb
@@ -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;
diff --git a/gcc/ada/prj.adb b/gcc/ada/prj.adb
index e97f1af..73e1f40 100644
--- a/gcc/ada/prj.adb
+++ b/gcc/ada/prj.adb
@@ -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;
----------------------
diff --git a/gcc/ada/prj.ads b/gcc/ada/prj.ads
index ca09a9d8..db348b7 100644
--- a/gcc/ada/prj.ads
+++ b/gcc/ada/prj.ads
@@ -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
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 2606940..17e3d25 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -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);
diff --git a/gcc/ada/snames.ads-tmpl b/gcc/ada/snames.ads-tmpl
index 285f92e..2f4c6cc 100644
--- a/gcc/ada/snames.ads-tmpl
+++ b/gcc/ada/snames.ads-tmpl
@@ -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 + $;