Commit 549cc9c2 by Arnaud Charlet

[multiple changes]

2015-11-12  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch8.adb (Find_Selected_Component): In a synchronized
	body, a reference to an operation of an object of the same
	synchronized type was always interpreted as a reference to the
	current instance. This is not always the case, as the prefix of
	the reference may designate an object of the same type declared
	in the enclosing context prior to the body.

2015-11-12  Arnaud Charlet  <charlet@adacore.com>

	* impunit.ads, impunit.adb (Get_Kind_Of_File): New. Cleaned up
	implementation from previous Get_Kind_Of_Unit.
	(Get_Kind_Of_Unit): Reimplemented using Get_Kind_Of_File.
	* debug.adb: Remove d.4 switch, no longer used.
	* opt.ads: Update doc on Debugger_Level.
	* gnat1drv.adb: Code clean ups.
	* sinput.ads: minor fix in comment

2015-11-12  Bob Duff  <duff@adacore.com>

	* sinfo.adb, sinfo.ads, sem_ch6.adb, atree.ads: Add
	Was_Expression_Function flag, which is set in sem_ch6.adb when
	converting an Expression_Function into a Subprogram_Body.

2015-11-12  Pascal Obry  <obry@adacore.com>

	* usage.adb: Update overflow checking documentation.

From-SVN: r230243
parent b3083540
2015-11-12 Ed Schonberg <schonberg@adacore.com>
* sem_ch8.adb (Find_Selected_Component): In a synchronized
body, a reference to an operation of an object of the same
synchronized type was always interpreted as a reference to the
current instance. This is not always the case, as the prefix of
the reference may designate an object of the same type declared
in the enclosing context prior to the body.
2015-11-12 Arnaud Charlet <charlet@adacore.com>
* impunit.ads, impunit.adb (Get_Kind_Of_File): New. Cleaned up
implementation from previous Get_Kind_Of_Unit.
(Get_Kind_Of_Unit): Reimplemented using Get_Kind_Of_File.
* debug.adb: Remove d.4 switch, no longer used.
* opt.ads: Update doc on Debugger_Level.
* gnat1drv.adb: Code clean ups.
* sinput.ads: minor fix in comment
2015-11-12 Bob Duff <duff@adacore.com>
* sinfo.adb, sinfo.ads, sem_ch6.adb, atree.ads: Add
Was_Expression_Function flag, which is set in sem_ch6.adb when
converting an Expression_Function into a Subprogram_Body.
2015-11-12 Pascal Obry <obry@adacore.com>
* usage.adb: Update overflow checking documentation.
2015-11-12 Tristan Gingold <gingold@adacore.com> 2015-11-12 Tristan Gingold <gingold@adacore.com>
* snames.ads-tmpl: Name_Gnat_Extended_Ravenscar: New identifier. * snames.ads-tmpl: Name_Gnat_Extended_Ravenscar: New identifier.
......
...@@ -181,7 +181,7 @@ package Atree is ...@@ -181,7 +181,7 @@ package Atree is
-- Flag10 -- Flag10
-- Flag11 Note that Flag0-3 are stored separately in the Flags -- Flag11 Note that Flag0-3 are stored separately in the Flags
-- Flag12 table, but that's a detail of the implementation which -- Flag12 table, but that's a detail of the implementation which
-- Flag13 is entirely hidden by the funcitonal interface. -- Flag13 is entirely hidden by the functional interface.
-- Flag14 -- Flag14
-- Flag15 -- Flag15
-- Flag16 -- Flag16
......
...@@ -148,12 +148,16 @@ procedure Gnat1drv is ...@@ -148,12 +148,16 @@ procedure Gnat1drv is
Generate_C_Code := True; Generate_C_Code := True;
Modify_Tree_For_C := True; Modify_Tree_For_C := True;
Unnest_Subprogram_Mode := True; Unnest_Subprogram_Mode := True;
Back_Annotate_Rep_Info := True;
-- Set operating mode to Generate_Code to benefit from full front-end -- Set operating mode to Generate_Code to benefit from full front-end
-- expansion (e.g. generics). -- expansion (e.g. generics).
Operating_Mode := Generate_Code; Operating_Mode := Generate_Code;
-- Suppress alignment checks since we do not have access to alignment
-- info on the target
Suppress_Options.Suppress (Alignment_Check) := False;
end if; end if;
-- -gnatd.E sets Error_To_Warning mode, causing selected error messages -- -gnatd.E sets Error_To_Warning mode, causing selected error messages
...@@ -1346,8 +1350,8 @@ begin ...@@ -1346,8 +1350,8 @@ begin
Back_End.Call_Back_End (Back_End_Mode); Back_End.Call_Back_End (Back_End_Mode);
-- Once the backend is complete, we unlock the names table. This call -- Once the backend is complete, we unlock the names table. This call
-- allows a few extra entries, needed for example for the file name for -- allows a few extra entries, needed for example for the file name
-- the library file output. -- for the library file output.
Namet.Unlock; Namet.Unlock;
......
...@@ -635,23 +635,22 @@ package body Impunit is ...@@ -635,23 +635,22 @@ package body Impunit is
("utf_32", Sutf_32'Access)); ("utf_32", Sutf_32'Access));
---------------------- ----------------------
-- Get_Kind_Of_Unit -- -- Get_Kind_Of_File --
---------------------- ----------------------
function Get_Kind_Of_Unit (U : Unit_Number_Type) return Kind_Of_Unit is function Get_Kind_Of_File (File : String) return Kind_Of_Unit is
Fname : constant File_Name_Type := Unit_File_Name (U); pragma Assert (File'First = 1);
Buffer : String (1 .. 8);
begin begin
Error_Msg_Strlen := 0; Error_Msg_Strlen := 0;
Get_Name_String (Fname);
-- Ada/System/Interfaces are all Ada 95 units -- Ada/System/Interfaces are all Ada 95 units
if (Name_Len = 7 and then Name_Buffer (1 .. 7) = "ada.ads") if File = "ada.ads"
or else or else File = "system.ads"
(Name_Len = 10 and then Name_Buffer (1 .. 10) = "system.ads") or else File = "interfac.ads"
or else
(Name_Len = 12 and then Name_Buffer (1 .. 12) = "interfac.ads")
then then
return Ada_95_Unit; return Ada_95_Unit;
end if; end if;
...@@ -659,21 +658,19 @@ package body Impunit is ...@@ -659,21 +658,19 @@ package body Impunit is
-- If length of file name is greater than 12, not predefined. The value -- If length of file name is greater than 12, not predefined. The value
-- 12 here is an 8 char name with extension .ads. -- 12 here is an 8 char name with extension .ads.
if Name_Len > 12 then if File'Length > 12 then
return Not_Predefined_Unit; return Not_Predefined_Unit;
end if; end if;
-- Not predefined if file name does not start with a- g- s- i- -- Not predefined if file name does not start with a- g- s- i-
if Name_Len < 3 if File'Length < 3
or else Name_Buffer (2) /= '-' or else File (2) /= '-'
or else (Name_Buffer (1) /= 'a' or else
and then (File (1) /= 'a'
Name_Buffer (1) /= 'g' and then File (1) /= 'g'
and then and then File (1) /= 'i'
Name_Buffer (1) /= 'i' and then File (1) /= 's')
and then
Name_Buffer (1) /= 's')
then then
return Not_Predefined_Unit; return Not_Predefined_Unit;
end if; end if;
...@@ -687,25 +684,25 @@ package body Impunit is ...@@ -687,25 +684,25 @@ package body Impunit is
-- this routine to detect when a construct comes from an instance of -- this routine to detect when a construct comes from an instance of
-- a generic defined in a predefined unit. -- a generic defined in a predefined unit.
if Name_Buffer (Name_Len - 3 .. Name_Len) /= ".ads" if File (File'Last - 3 .. File'Last) /= ".ads"
and then and then
Name_Buffer (Name_Len - 3 .. Name_Len) /= ".adb" File (File'Last - 3 .. File'Last) /= ".adb"
then then
return Not_Predefined_Unit; return Not_Predefined_Unit;
end if; end if;
-- Otherwise normalize file name to 8 characters -- Otherwise normalize file name to 8 characters
Name_Len := Name_Len - 4; Buffer (1 .. File'Length - 4) := File (1 .. File'Length - 4);
while Name_Len < 8 loop
Name_Len := Name_Len + 1; for J in File'Length - 3 .. 8 loop
Name_Buffer (Name_Len) := ' '; Buffer (J) := ' ';
end loop; end loop;
-- See if name is in 95 list -- See if name is in 95 list
for J in Non_Imp_File_Names_95'Range loop for J in Non_Imp_File_Names_95'Range loop
if Name_Buffer (1 .. 8) = Non_Imp_File_Names_95 (J).Fname then if Buffer = Non_Imp_File_Names_95 (J).Fname then
return Ada_95_Unit; return Ada_95_Unit;
end if; end if;
end loop; end loop;
...@@ -713,7 +710,7 @@ package body Impunit is ...@@ -713,7 +710,7 @@ package body Impunit is
-- See if name is in 2005 list -- See if name is in 2005 list
for J in Non_Imp_File_Names_05'Range loop for J in Non_Imp_File_Names_05'Range loop
if Name_Buffer (1 .. 8) = Non_Imp_File_Names_05 (J).Fname then if Buffer = Non_Imp_File_Names_05 (J).Fname then
return Ada_2005_Unit; return Ada_2005_Unit;
end if; end if;
end loop; end loop;
...@@ -721,7 +718,7 @@ package body Impunit is ...@@ -721,7 +718,7 @@ package body Impunit is
-- See if name is in 2012 list -- See if name is in 2012 list
for J in Non_Imp_File_Names_12'Range loop for J in Non_Imp_File_Names_12'Range loop
if Name_Buffer (1 .. 8) = Non_Imp_File_Names_12 (J).Fname then if Buffer = Non_Imp_File_Names_12 (J).Fname then
return Ada_2012_Unit; return Ada_2012_Unit;
end if; end if;
end loop; end loop;
...@@ -729,22 +726,9 @@ package body Impunit is ...@@ -729,22 +726,9 @@ package body Impunit is
-- Only remaining special possibilities are children of System.RPC and -- Only remaining special possibilities are children of System.RPC and
-- System.Garlic and special files of the form System.Aux... -- System.Garlic and special files of the form System.Aux...
Get_Name_String (Unit_Name (U)); if File (1 .. 5) = "s-rpc"
or else File (1 .. 5) = "s-gar"
if Name_Len > 12 or else File (1 .. 5) = "s-aux"
and then Name_Buffer (1 .. 11) = "system.rpc."
then
return Ada_95_Unit;
end if;
if Name_Len > 15
and then Name_Buffer (1 .. 14) = "system.garlic."
then
return Ada_95_Unit;
end if;
if Name_Len > 11
and then Name_Buffer (1 .. 10) = "system.aux"
then then
return Ada_95_Unit; return Ada_95_Unit;
end if; end if;
...@@ -752,18 +736,16 @@ package body Impunit is ...@@ -752,18 +736,16 @@ package body Impunit is
-- All tests failed, this is definitely an implementation unit. See if -- All tests failed, this is definitely an implementation unit. See if
-- we have an alternative name. -- we have an alternative name.
Get_Name_String (Fname); if File'Length in 11 .. 12
and then File (1 .. 2) = "s-"
if Name_Len in 11 .. 12 and then File (File'Last - 3 .. File'Last) = ".ads"
and then Name_Buffer (1 .. 2) = "s-"
and then Name_Buffer (Name_Len - 3 .. Name_Len) = ".ads"
then then
for J in Map_Array'Range loop for J in Map_Array'Range loop
if (Name_Len = 12 and then if (File'Length = 12 and then
Name_Buffer (3 .. 8) = Map_Array (J).Fname) File (3 .. 8) = Map_Array (J).Fname)
or else or else
(Name_Len = 11 and then (File'Length = 11 and then
Name_Buffer (3 .. 7) = Map_Array (J).Fname (1 .. 5)) File (3 .. 7) = Map_Array (J).Fname (1 .. 5))
then then
Error_Msg_Strlen := Map_Array (J).Aname'Length; Error_Msg_Strlen := Map_Array (J).Aname'Length;
Error_Msg_String (1 .. Error_Msg_Strlen) := Error_Msg_String (1 .. Error_Msg_Strlen) :=
...@@ -773,6 +755,16 @@ package body Impunit is ...@@ -773,6 +755,16 @@ package body Impunit is
end if; end if;
return Implementation_Unit; return Implementation_Unit;
end Get_Kind_Of_File;
----------------------
-- Get_Kind_Of_Unit --
----------------------
function Get_Kind_Of_Unit (U : Unit_Number_Type) return Kind_Of_Unit is
begin
Get_Name_String (Unit_File_Name (U));
return Get_Kind_Of_File (Name_Buffer (1 .. Name_Len));
end Get_Kind_Of_Unit; end Get_Kind_Of_Unit;
------------------- -------------------
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 2000-2011, Free Software Foundation, Inc. -- -- Copyright (C) 2000-2015, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -62,11 +62,14 @@ package Impunit is ...@@ -62,11 +62,14 @@ package Impunit is
function Get_Kind_Of_Unit (U : Unit_Number_Type) return Kind_Of_Unit; function Get_Kind_Of_Unit (U : Unit_Number_Type) return Kind_Of_Unit;
-- Given the unit number of a unit, this function determines the type -- Given the unit number of a unit, this function determines the type
-- of the unit, as defined above. If the result is Implementation_Unit, -- of the unit, as defined above. If the result is Implementation_Unit,
-- then the name of a possible atlernative equivalent unit is placed in -- then the name of a possible alternative equivalent unit is placed in
-- Error_Msg_String/Slen on return. If there is no alternative name, or if -- Error_Msg_String/Slen on return. If there is no alternative name, or if
-- the result is not Implementation_Unit, then Error_Msg_Slen is zero on -- the result is not Implementation_Unit, then Error_Msg_Slen is zero on
-- return, indicating that no alternative name was found. -- return, indicating that no alternative name was found.
function Get_Kind_Of_File (File : String) return Kind_Of_Unit;
-- Same as Get_Kind_Of_Unit, for a given filename
function Is_Known_Unit (Nam : Node_Id) return Boolean; function Is_Known_Unit (Nam : Node_Id) return Boolean;
-- Nam is the possible name of a child unit, represented as a selected -- Nam is the possible name of a child unit, represented as a selected
-- component node. This function determines whether the name matches one of -- component node. This function determines whether the name matches one of
......
...@@ -422,8 +422,9 @@ package Opt is ...@@ -422,8 +422,9 @@ package Opt is
subtype Debug_Level_Value is Nat range 0 .. 3; subtype Debug_Level_Value is Nat range 0 .. 3;
Debugger_Level : Debug_Level_Value := 0; Debugger_Level : Debug_Level_Value := 0;
-- The value given to the -g parameter. The default value for -g with -- The value given to the -g parameter. The default value for -g with
-- no value is 2. This is not currently used but is retained for possible -- no value is 2. If no -g is specified, defaults to 0.
-- future use. -- Note that the generated code should never depend on this variable,
-- since we want debug info to be non intrusive on the generate code.
Default_Exit_Status : Int := 0; Default_Exit_Status : Int := 0;
-- GNATBIND -- GNATBIND
......
...@@ -334,6 +334,7 @@ package body Sem_Ch6 is ...@@ -334,6 +334,7 @@ package body Sem_Ch6 is
Handled_Statement_Sequence => Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (LocX, Make_Handled_Sequence_Of_Statements (LocX,
Statements => New_List (Ret))); Statements => New_List (Ret)));
Set_Was_Expression_Function (New_Body);
-- If the expression completes a generic subprogram, we must create a -- If the expression completes a generic subprogram, we must create a
-- separate node for the body, because at instantiation the original -- separate node for the body, because at instantiation the original
......
...@@ -6774,7 +6774,26 @@ package body Sem_Ch8 is ...@@ -6774,7 +6774,26 @@ package body Sem_Ch8 is
-- Prefix denotes an enclosing loop, block, or task, i.e. an -- Prefix denotes an enclosing loop, block, or task, i.e. an
-- enclosing construct that is not a subprogram or accept. -- enclosing construct that is not a subprogram or accept.
Find_Expanded_Name (N); -- A special case: a protected body may call an operation
-- on an external object of the same type, in which case it
-- is not an expanded name. If the prefix is the type itself,
-- or the context is a single synchronized object it can only
-- be interpreted as an expanded name.
if Is_Concurrent_Type (Etype (P_Name)) then
if Is_Type (P_Name)
or else Present (Anonymous_Object (Etype (P_Name)))
then
Find_Expanded_Name (N);
else
Analyze_Selected_Component (N);
return;
end if;
else
Find_Expanded_Name (N);
end if;
elsif Ekind (P_Name) = E_Package then elsif Ekind (P_Name) = E_Package then
Find_Expanded_Name (N); Find_Expanded_Name (N);
......
...@@ -3286,6 +3286,14 @@ package body Sinfo is ...@@ -3286,6 +3286,14 @@ package body Sinfo is
return Elist5 (N); return Elist5 (N);
end Used_Operations; end Used_Operations;
function Was_Expression_Function
(N : Node_Id) return Boolean is
begin
pragma Assert (False
or else NT (N).Nkind = N_Subprogram_Body);
return Flag18 (N);
end Was_Expression_Function;
function Was_Originally_Stub function Was_Originally_Stub
(N : Node_Id) return Boolean is (N : Node_Id) return Boolean is
begin begin
...@@ -6525,6 +6533,14 @@ package body Sinfo is ...@@ -6525,6 +6533,14 @@ package body Sinfo is
Set_Elist5 (N, Val); Set_Elist5 (N, Val);
end Set_Used_Operations; end Set_Used_Operations;
procedure Set_Was_Expression_Function
(N : Node_Id; Val : Boolean := True) is
begin
pragma Assert (False
or else NT (N).Nkind = N_Subprogram_Body);
Set_Flag18 (N, Val);
end Set_Was_Expression_Function;
procedure Set_Was_Originally_Stub procedure Set_Was_Originally_Stub
(N : Node_Id; Val : Boolean := True) is (N : Node_Id; Val : Boolean := True) is
begin begin
......
...@@ -2220,6 +2220,14 @@ package Sinfo is ...@@ -2220,6 +2220,14 @@ package Sinfo is
-- on exit from the scope of the use_type_clause, in particular in the -- on exit from the scope of the use_type_clause, in particular in the
-- case of Use_All_Type, when those operations several scopes. -- case of Use_All_Type, when those operations several scopes.
-- Was_Expression_Function (Flag18-Sem)
-- Present in N_Subprogram_Body. True if the original source had an
-- N_Expression_Function, which was converted to the N_Subprogram_Body
-- by Analyze_Expression_Function. This is needed by ASIS to correctly
-- recreate the expression function (for the instance body) when the
-- completion of a generic function declaration is an expression
-- function.
-- Was_Originally_Stub (Flag13-Sem) -- Was_Originally_Stub (Flag13-Sem)
-- This flag is set in the node for a proper body that replaces stub. -- This flag is set in the node for a proper body that replaces stub.
-- During the analysis procedure, stubs in some situations get rewritten -- During the analysis procedure, stubs in some situations get rewritten
...@@ -5212,6 +5220,7 @@ package Sinfo is ...@@ -5212,6 +5220,7 @@ package Sinfo is
-- Is_Task_Master (Flag5-Sem) -- Is_Task_Master (Flag5-Sem)
-- Was_Originally_Stub (Flag13-Sem) -- Was_Originally_Stub (Flag13-Sem)
-- Has_Relative_Deadline_Pragma (Flag9-Sem) -- Has_Relative_Deadline_Pragma (Flag9-Sem)
-- Was_Expression_Function (Flag18-Sem)
------------------------- -------------------------
-- Expression Function -- -- Expression Function --
...@@ -9795,6 +9804,9 @@ package Sinfo is ...@@ -9795,6 +9804,9 @@ package Sinfo is
function Used_Operations function Used_Operations
(N : Node_Id) return Elist_Id; -- Elist5 (N : Node_Id) return Elist_Id; -- Elist5
function Was_Expression_Function
(N : Node_Id) return Boolean; -- Flag18
function Was_Originally_Stub function Was_Originally_Stub
(N : Node_Id) return Boolean; -- Flag13 (N : Node_Id) return Boolean; -- Flag13
...@@ -10830,6 +10842,9 @@ package Sinfo is ...@@ -10830,6 +10842,9 @@ package Sinfo is
procedure Set_Used_Operations procedure Set_Used_Operations
(N : Node_Id; Val : Elist_Id); -- Elist5 (N : Node_Id; Val : Elist_Id); -- Elist5
procedure Set_Was_Expression_Function
(N : Node_Id; Val : Boolean := True); -- Flag18
procedure Set_Was_Originally_Stub procedure Set_Was_Originally_Stub
(N : Node_Id; Val : Boolean := True); -- Flag13 (N : Node_Id; Val : Boolean := True); -- Flag13
...@@ -12938,6 +12953,7 @@ package Sinfo is ...@@ -12938,6 +12953,7 @@ package Sinfo is
pragma Inline (Variants); pragma Inline (Variants);
pragma Inline (Visible_Declarations); pragma Inline (Visible_Declarations);
pragma Inline (Used_Operations); pragma Inline (Used_Operations);
pragma Inline (Was_Expression_Function);
pragma Inline (Was_Originally_Stub); pragma Inline (Was_Originally_Stub);
pragma Inline (Withed_Body); pragma Inline (Withed_Body);
...@@ -13277,6 +13293,7 @@ package Sinfo is ...@@ -13277,6 +13293,7 @@ package Sinfo is
pragma Inline (Set_Variant_Part); pragma Inline (Set_Variant_Part);
pragma Inline (Set_Variants); pragma Inline (Set_Variants);
pragma Inline (Set_Visible_Declarations); pragma Inline (Set_Visible_Declarations);
pragma Inline (Set_Was_Expression_Function);
pragma Inline (Set_Was_Originally_Stub); pragma Inline (Set_Was_Originally_Stub);
pragma Inline (Set_Withed_Body); pragma Inline (Set_Withed_Body);
......
...@@ -608,7 +608,7 @@ package Sinput is ...@@ -608,7 +608,7 @@ package Sinput is
function Num_Source_Lines (S : Source_File_Index) return Nat; function Num_Source_Lines (S : Source_File_Index) return Nat;
-- Returns the number of source lines (this is equivalent to reading -- Returns the number of source lines (this is equivalent to reading
-- the value of Last_Source_Line, but returns Nat rather than a -- the value of Last_Source_Line, but returns Nat rather than a
-- physical line number. -- physical line number).
procedure Register_Source_Ref_Pragma procedure Register_Source_Ref_Pragma
(File_Name : File_Name_Type; (File_Name : File_Name_Type;
......
...@@ -360,8 +360,11 @@ begin ...@@ -360,8 +360,11 @@ begin
-- Line for -gnato switch -- Line for -gnato switch
Write_Switch_Char ("o0");
Write_Line ("Disable overflow checking (on by default)");
Write_Switch_Char ("o"); Write_Switch_Char ("o");
Write_Line ("Enable overflow checking mode to CHECKED (off by default)"); Write_Line ("Enable overflow checking in STRICT (-gnato1) mode (default)");
-- Lines for -gnato? switches -- Lines for -gnato? switches
......
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