Commit 618fb570 by Arnaud Charlet

[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
parent 93bcda23
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> 2009-04-17 Robert Dewar <dewar@adacore.com>
* gnat_rm.texi: Add documentation about No_Streams restriction * gnat_rm.texi: Add documentation about No_Streams restriction
...@@ -2144,7 +2144,7 @@ __gnat_error_handler (int sig, siginfo_t * si, void * uc) ...@@ -2144,7 +2144,7 @@ __gnat_error_handler (int sig, siginfo_t * si, void * uc)
{ {
case SIGSEGV: case SIGSEGV:
case SIGBUS: 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; exception = &storage_error;
msg = "stack overflow"; msg = "stack overflow";
......
...@@ -215,9 +215,14 @@ package body Ch6 is ...@@ -215,9 +215,14 @@ package body Ch6 is
-- already been given, so no need to give another message here. -- already been given, so no need to give another message here.
-- An overriding indicator is allowed for subprogram declarations, -- 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!"); Error_Msg_SC ("overriding indicator not allowed here!");
elsif Token /= Tok_Function elsif Token /= Tok_Function
......
...@@ -736,9 +736,16 @@ package body Ch9 is ...@@ -736,9 +736,16 @@ package body Ch9 is
if Token = Tok_Entry or else Bad_Spelling_Of (Tok_Entry) then if Token = Tok_Entry or else Bad_Spelling_Of (Tok_Entry) then
Append (P_Entry_Body, Item_List); 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) elsif Token = Tok_Function or else Bad_Spelling_Of (Tok_Function)
or else or else
Token = Tok_Procedure or else Bad_Spelling_Of (Tok_Procedure) 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 then
Append (P_Subprogram (Pf_Decl_Pbod), Item_List); Append (P_Subprogram (Pf_Decl_Pbod), Item_List);
......
...@@ -173,6 +173,7 @@ package body Prj.Attr is ...@@ -173,6 +173,7 @@ package body Prj.Attr is
"Larequired_switches#" & "Larequired_switches#" &
"Lapic_option#" & "Lapic_option#" &
"Sapath_syntax#" & "Sapath_syntax#" &
"Saobject_file_suffix#" &
-- Configuration - Mapping files -- Configuration - Mapping files
......
...@@ -646,7 +646,8 @@ package body Prj.Nmsc is ...@@ -646,7 +646,8 @@ package body Prj.Nmsc is
Src_Data.Naming_Exception := Naming_Exception; Src_Data.Naming_Exception := Naming_Exception;
if Src_Data.Compiled and then Src_Data.Object_Exists then 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 := Src_Data.Dep_Name :=
Dependency_Name (File_Name, Src_Data.Dependency); Dependency_Name (File_Name, Src_Data.Dependency);
Src_Data.Switches := Switches_Name (File_Name); Src_Data.Switches := Switches_Name (File_Name);
...@@ -1541,6 +1542,19 @@ package body Prj.Nmsc is ...@@ -1541,6 +1542,19 @@ package body Prj.Nmsc is
Element.Value.Location); Element.Value.Location);
end; 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 => when Name_Pic_Option =>
-- Attribute Compiler_Pic_Option (<language>) -- Attribute Compiler_Pic_Option (<language>)
...@@ -5796,12 +5810,12 @@ package body Prj.Nmsc is ...@@ -5796,12 +5810,12 @@ package body Prj.Nmsc is
Util.Value_Of Util.Value_Of
(Name_Source_Files, Data.Decl.Attributes, In_Tree); (Name_Source_Files, Data.Decl.Attributes, In_Tree);
Last_Source_Dir : String_List_Id := Nil_String;
Languages : constant Variable_Value := Languages : constant Variable_Value :=
Prj.Util.Value_Of Prj.Util.Value_Of
(Name_Languages, Data.Decl.Attributes, In_Tree); (Name_Languages, Data.Decl.Attributes, In_Tree);
Last_Source_Dir : String_List_Id := Nil_String;
procedure Find_Source_Dirs procedure Find_Source_Dirs
(From : File_Name_Type; (From : File_Name_Type;
Location : Source_Ptr; Location : Source_Ptr;
......
...@@ -709,11 +709,18 @@ package body Prj is ...@@ -709,11 +709,18 @@ package body Prj is
----------------- -----------------
function Object_Name 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 return File_Name_Type
is is
begin 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; end Object_Name;
---------------------- ----------------------
......
...@@ -441,6 +441,8 @@ package Prj is ...@@ -441,6 +441,8 @@ package Prj is
-- Value may be Canonical (Unix style) or Host (host syntax, for example -- Value may be Canonical (Unix style) or Host (host syntax, for example
-- on VMS for DEC C). -- on VMS for DEC C).
Object_File_Suffix : Name_Id := No_Name;
Compilation_PIC_Option : Name_List_Index := No_Name_List; Compilation_PIC_Option : Name_List_Index := No_Name_List;
-- The option(s) to compile a source in Position Independent Code for -- The option(s) to compile a source in Position Independent Code for
-- shared libraries. Specified in the configuration. When not specified, -- shared libraries. Specified in the configuration. When not specified,
...@@ -557,6 +559,7 @@ package Prj is ...@@ -557,6 +559,7 @@ package Prj is
Compiler_Driver_Path => null, Compiler_Driver_Path => null,
Compiler_Required_Switches => No_Name_List, Compiler_Required_Switches => No_Name_List,
Path_Syntax => Canonical, Path_Syntax => Canonical,
Object_File_Suffix => No_Name,
Compilation_PIC_Option => No_Name_List, Compilation_PIC_Option => No_Name_List,
Object_Generated => True, Object_Generated => True,
Objects_Linked => True, Objects_Linked => True,
...@@ -1564,7 +1567,8 @@ package Prj is ...@@ -1564,7 +1567,8 @@ package Prj is
-- Replace the extension of File with With_Suffix -- Replace the extension of File with With_Suffix
function Object_Name 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 -- Returns the object file name corresponding to a source file name
function Dependency_Name function Dependency_Name
......
...@@ -1766,10 +1766,12 @@ package body Sem_Ch6 is ...@@ -1766,10 +1766,12 @@ package body Sem_Ch6 is
("subprogram & overrides predefined operator ", ("subprogram & overrides predefined operator ",
Body_Spec, Spec_Id); Body_Spec, Spec_Id);
-- If this is not a primitive operation the overriding indicator -- If this is not a primitive operation or protected subprogram,
-- is altogether illegal. -- 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 " & Error_Msg_N ("overriding indicator only allowed " &
"if subprogram is primitive", "if subprogram is primitive",
Body_Spec); Body_Spec);
...@@ -4281,14 +4283,15 @@ package body Sem_Ch6 is ...@@ -4281,14 +4283,15 @@ package body Sem_Ch6 is
Set_Is_Overriding_Operation (Subp); Set_Is_Overriding_Operation (Subp);
end if; end if;
-- If primitive flag is set, operation is overriding at the -- If primitive flag is set or this is a protected operation, then
-- point of its declaration, so warn if necessary. Otherwise -- the operation is overriding at the point of its declaration, so
-- it may have been declared before the operation it overrides -- warn if necessary. Otherwise it may have been declared before the
-- and no check is required. -- operation it overrides and no check is required.
if Style_Check if Style_Check
and then not Must_Override (Spec) and then not Must_Override (Spec)
and then Is_Primitive and then (Is_Primitive
or else Ekind (Scope (Subp)) = E_Protected_Type)
then then
Style.Missing_Overriding (Decl, Subp); Style.Missing_Overriding (Decl, Subp);
end if; end if;
...@@ -4306,7 +4309,13 @@ package body Sem_Ch6 is ...@@ -4306,7 +4309,13 @@ package body Sem_Ch6 is
elsif Nkind (Subp) = N_Defining_Operator_Symbol then elsif Nkind (Subp) = N_Defining_Operator_Symbol then
if Must_Not_Override (Spec) 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 Error_Msg_N
("overriding indicator only allowed " ("overriding indicator only allowed "
& "if subprogram is primitive", Subp); & "if subprogram is primitive", Subp);
......
...@@ -1097,6 +1097,7 @@ package Snames is ...@@ -1097,6 +1097,7 @@ package Snames is
Name_Metrics : constant Name_Id := N + $; Name_Metrics : constant Name_Id := N + $;
Name_Naming : constant Name_Id := N + $; Name_Naming : constant Name_Id := N + $;
Name_None : 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_Generated : constant Name_Id := N + $;
Name_Object_List : constant Name_Id := N + $; Name_Object_List : constant Name_Id := N + $;
Name_Objects_Linked : constant Name_Id := N + $; Name_Objects_Linked : constant Name_Id := N + $;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment