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>
* gnat_rm.texi: Add documentation about No_Streams restriction
......@@ -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";
......
......@@ -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
......
......@@ -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);
......
......@@ -173,6 +173,7 @@ package body Prj.Attr is
"Larequired_switches#" &
"Lapic_option#" &
"Sapath_syntax#" &
"Saobject_file_suffix#" &
-- Configuration - Mapping files
......
......@@ -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;
......
......@@ -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;
----------------------
......
......@@ -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
......
......@@ -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);
......
......@@ -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 + $;
......
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