+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
{
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";
-- 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
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);
"Larequired_switches#" &
"Lapic_option#" &
"Sapath_syntax#" &
+ "Saobject_file_suffix#" &
-- Configuration - Mapping files
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);
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>)
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;
-----------------
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;
----------------------
-- 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,
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,
-- 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
("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);
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;
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);
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 + $;