Commit 265ca04a by Arnaud Charlet

[multiple changes]

2015-10-23  Ed Schonberg  <schonberg@adacore.com>

	* sem_dim.adb (Analyze_Dimension_Extension_Or_Record_Aggregate):
	Handle properly a box-initialized aggregate component.

2015-10-23  Yannick Moy  <moy@adacore.com>

	* sem_prag.adb (Analyze_Pragma): Reject Volatile_Function not placed
	on a function.

2015-10-23  Yannick Moy  <moy@adacore.com>

	* a-extiin.ads, a-reatim.ads, a-interr.ads, a-exetim-mingw.ads,
	a-exetim-default.ads, a-exetim.ads, a-taside.ads: Add "Global => null"
	contract on subprograms.
	* lib-xref-spark_specific.adb: collect scopes for stubs of
	protected objects

2015-10-23  Arnaud Charlet  <charlet@adacore.com>

	* gnat1drv.adb (Adjust_Global_Switches): Enable
	Back_Annotate_Rep_Info to get size information from gigi.
	(Gnat1drv): Code clean ups.
	* frontend.adb (Frontend): Ditto.

From-SVN: r229231
parent 45969c97
2015-10-23 Ed Schonberg <schonberg@adacore.com>
* sem_dim.adb (Analyze_Dimension_Extension_Or_Record_Aggregate):
Handle properly a box-initialized aggregate component.
2015-10-23 Yannick Moy <moy@adacore.com>
* sem_prag.adb (Analyze_Pragma): Reject Volatile_Function not placed
on a function.
2015-10-23 Yannick Moy <moy@adacore.com>
* a-extiin.ads, a-reatim.ads, a-interr.ads, a-exetim-mingw.ads,
a-exetim-default.ads, a-exetim.ads, a-taside.ads: Add "Global => null"
contract on subprograms.
* lib-xref-spark_specific.adb: collect scopes for stubs of
protected objects
2015-10-23 Arnaud Charlet <charlet@adacore.com>
* gnat1drv.adb (Adjust_Global_Switches): Enable
Back_Annotate_Rep_Info to get size information from gigi.
(Gnat1drv): Code clean ups.
* frontend.adb (Frontend): Ditto.
2015-10-23 Arnaud Charlet <charlet@adacore.com> 2015-10-23 Arnaud Charlet <charlet@adacore.com>
* gnat1drv.adb (Adjust_Global_Switches): Adjust settings. * gnat1drv.adb (Adjust_Global_Switches): Adjust settings.
......
...@@ -57,34 +57,50 @@ is ...@@ -57,34 +57,50 @@ is
function "+" function "+"
(Left : CPU_Time; (Left : CPU_Time;
Right : Ada.Real_Time.Time_Span) return CPU_Time; Right : Ada.Real_Time.Time_Span) return CPU_Time
with
Global => null;
function "+" function "+"
(Left : Ada.Real_Time.Time_Span; (Left : Ada.Real_Time.Time_Span;
Right : CPU_Time) return CPU_Time; Right : CPU_Time) return CPU_Time
with
Global => null;
function "-" function "-"
(Left : CPU_Time; (Left : CPU_Time;
Right : Ada.Real_Time.Time_Span) return CPU_Time; Right : Ada.Real_Time.Time_Span) return CPU_Time
with
Global => null;
function "-" function "-"
(Left : CPU_Time; (Left : CPU_Time;
Right : CPU_Time) return Ada.Real_Time.Time_Span; Right : CPU_Time) return Ada.Real_Time.Time_Span
with
Global => null;
function "<" (Left, Right : CPU_Time) return Boolean; function "<" (Left, Right : CPU_Time) return Boolean with
function "<=" (Left, Right : CPU_Time) return Boolean; Global => null;
function ">" (Left, Right : CPU_Time) return Boolean; function "<=" (Left, Right : CPU_Time) return Boolean with
function ">=" (Left, Right : CPU_Time) return Boolean; Global => null;
function ">" (Left, Right : CPU_Time) return Boolean with
Global => null;
function ">=" (Left, Right : CPU_Time) return Boolean with
Global => null;
procedure Split procedure Split
(T : CPU_Time; (T : CPU_Time;
SC : out Ada.Real_Time.Seconds_Count; SC : out Ada.Real_Time.Seconds_Count;
TS : out Ada.Real_Time.Time_Span); TS : out Ada.Real_Time.Time_Span)
with
Global => null;
function Time_Of function Time_Of
(SC : Ada.Real_Time.Seconds_Count; (SC : Ada.Real_Time.Seconds_Count;
TS : Ada.Real_Time.Time_Span := Ada.Real_Time.Time_Span_Zero) TS : Ada.Real_Time.Time_Span := Ada.Real_Time.Time_Span_Zero)
return CPU_Time; return CPU_Time
with
Global => null;
Interrupt_Clocks_Supported : constant Boolean := False; Interrupt_Clocks_Supported : constant Boolean := False;
Separate_Interrupt_Clocks_Supported : constant Boolean := False; Separate_Interrupt_Clocks_Supported : constant Boolean := False;
......
...@@ -59,34 +59,48 @@ is ...@@ -59,34 +59,48 @@ is
function "+" function "+"
(Left : CPU_Time; (Left : CPU_Time;
Right : Ada.Real_Time.Time_Span) return CPU_Time; Right : Ada.Real_Time.Time_Span) return CPU_Time
with
Global => null;
function "+" function "+"
(Left : Ada.Real_Time.Time_Span; (Left : Ada.Real_Time.Time_Span;
Right : CPU_Time) return CPU_Time; Right : CPU_Time) return CPU_Time
with
Global => null;
function "-" function "-"
(Left : CPU_Time; (Left : CPU_Time;
Right : Ada.Real_Time.Time_Span) return CPU_Time; Right : Ada.Real_Time.Time_Span) return CPU_Time
with
Global => null;
function "-" function "-"
(Left : CPU_Time; (Left : CPU_Time;
Right : CPU_Time) return Ada.Real_Time.Time_Span; Right : CPU_Time) return Ada.Real_Time.Time_Span;
function "<" (Left, Right : CPU_Time) return Boolean; function "<" (Left, Right : CPU_Time) return Boolean with
function "<=" (Left, Right : CPU_Time) return Boolean; Global => null;
function ">" (Left, Right : CPU_Time) return Boolean; function "<=" (Left, Right : CPU_Time) return Boolean with
function ">=" (Left, Right : CPU_Time) return Boolean; Global => null;
function ">" (Left, Right : CPU_Time) return Boolean with
Global => null;
function ">=" (Left, Right : CPU_Time) return Boolean with
Global => null;
procedure Split procedure Split
(T : CPU_Time; (T : CPU_Time;
SC : out Ada.Real_Time.Seconds_Count; SC : out Ada.Real_Time.Seconds_Count;
TS : out Ada.Real_Time.Time_Span); TS : out Ada.Real_Time.Time_Span)
with
Global => null;
function Time_Of function Time_Of
(SC : Ada.Real_Time.Seconds_Count; (SC : Ada.Real_Time.Seconds_Count;
TS : Ada.Real_Time.Time_Span := Ada.Real_Time.Time_Span_Zero) TS : Ada.Real_Time.Time_Span := Ada.Real_Time.Time_Span_Zero)
return CPU_Time; return CPU_Time
with
Global => null;
Interrupt_Clocks_Supported : constant Boolean := False; Interrupt_Clocks_Supported : constant Boolean := False;
Separate_Interrupt_Clocks_Supported : constant Boolean := False; Separate_Interrupt_Clocks_Supported : constant Boolean := False;
......
...@@ -48,34 +48,50 @@ is ...@@ -48,34 +48,50 @@ is
function "+" function "+"
(Left : CPU_Time; (Left : CPU_Time;
Right : Ada.Real_Time.Time_Span) return CPU_Time; Right : Ada.Real_Time.Time_Span) return CPU_Time
with
Global => null;
function "+" function "+"
(Left : Ada.Real_Time.Time_Span; (Left : Ada.Real_Time.Time_Span;
Right : CPU_Time) return CPU_Time; Right : CPU_Time) return CPU_Time
with
Global => null;
function "-" function "-"
(Left : CPU_Time; (Left : CPU_Time;
Right : Ada.Real_Time.Time_Span) return CPU_Time; Right : Ada.Real_Time.Time_Span) return CPU_Time
with
Global => null;
function "-" function "-"
(Left : CPU_Time; (Left : CPU_Time;
Right : CPU_Time) return Ada.Real_Time.Time_Span; Right : CPU_Time) return Ada.Real_Time.Time_Span
with
Global => null;
function "<" (Left, Right : CPU_Time) return Boolean; function "<" (Left, Right : CPU_Time) return Boolean with
function "<=" (Left, Right : CPU_Time) return Boolean; Global => null;
function ">" (Left, Right : CPU_Time) return Boolean; function "<=" (Left, Right : CPU_Time) return Boolean with
function ">=" (Left, Right : CPU_Time) return Boolean; Global => null;
function ">" (Left, Right : CPU_Time) return Boolean with
Global => null;
function ">=" (Left, Right : CPU_Time) return Boolean with
Global => null;
procedure Split procedure Split
(T : CPU_Time; (T : CPU_Time;
SC : out Ada.Real_Time.Seconds_Count; SC : out Ada.Real_Time.Seconds_Count;
TS : out Ada.Real_Time.Time_Span); TS : out Ada.Real_Time.Time_Span)
with
Global => null;
function Time_Of function Time_Of
(SC : Ada.Real_Time.Seconds_Count; (SC : Ada.Real_Time.Seconds_Count;
TS : Ada.Real_Time.Time_Span := Ada.Real_Time.Time_Span_Zero) TS : Ada.Real_Time.Time_Span := Ada.Real_Time.Time_Span_Zero)
return CPU_Time; return CPU_Time
with
Global => null;
Interrupt_Clocks_Supported : constant Boolean := False; Interrupt_Clocks_Supported : constant Boolean := False;
Separate_Interrupt_Clocks_Supported : constant Boolean := False; Separate_Interrupt_Clocks_Supported : constant Boolean := False;
......
...@@ -27,6 +27,8 @@ is ...@@ -27,6 +27,8 @@ is
Volatile_Function, Volatile_Function,
Global => Ada.Real_Time.Clock_Time; Global => Ada.Real_Time.Clock_Time;
function Supported (Interrupt : Ada.Interrupts.Interrupt_ID) return Boolean; function Supported (Interrupt : Ada.Interrupts.Interrupt_ID) return Boolean
with
Global => null;
end Ada.Execution_Time.Interrupts; end Ada.Execution_Time.Interrupts;
...@@ -55,27 +55,31 @@ package Ada.Interrupts is ...@@ -55,27 +55,31 @@ package Ada.Interrupts is
function Current_Handler function Current_Handler
(Interrupt : Interrupt_ID) return Parameterless_Handler (Interrupt : Interrupt_ID) return Parameterless_Handler
with with
SPARK_Mode => Off; SPARK_Mode => Off,
Global => null;
procedure Attach_Handler procedure Attach_Handler
(New_Handler : Parameterless_Handler; (New_Handler : Parameterless_Handler;
Interrupt : Interrupt_ID) Interrupt : Interrupt_ID)
with with
SPARK_Mode => Off; SPARK_Mode => Off,
Global => null;
procedure Exchange_Handler procedure Exchange_Handler
(Old_Handler : out Parameterless_Handler; (Old_Handler : out Parameterless_Handler;
New_Handler : Parameterless_Handler; New_Handler : Parameterless_Handler;
Interrupt : Interrupt_ID) Interrupt : Interrupt_ID)
with with
SPARK_Mode => Off; SPARK_Mode => Off,
Global => null;
procedure Detach_Handler (Interrupt : Interrupt_ID) with procedure Detach_Handler (Interrupt : Interrupt_ID) with
SPARK_Mode, SPARK_Mode,
Global => (In_Out => Ada.Task_Identification.Tasking_State); Global => (In_Out => Ada.Task_Identification.Tasking_State);
function Reference (Interrupt : Interrupt_ID) return System.Address with function Reference (Interrupt : Interrupt_ID) return System.Address with
SPARK_Mode => Off; SPARK_Mode => Off,
Global => null;
private private
pragma Inline (Is_Reserved); pragma Inline (Is_Reserved);
......
...@@ -62,42 +62,69 @@ is ...@@ -62,42 +62,69 @@ is
Volatile_Function, Volatile_Function,
Global => Clock_Time; Global => Clock_Time;
function "+" (Left : Time; Right : Time_Span) return Time; function "+" (Left : Time; Right : Time_Span) return Time with
function "+" (Left : Time_Span; Right : Time) return Time; Global => null;
function "-" (Left : Time; Right : Time_Span) return Time; function "+" (Left : Time_Span; Right : Time) return Time with
function "-" (Left : Time; Right : Time) return Time_Span; Global => null;
function "-" (Left : Time; Right : Time_Span) return Time with
function "<" (Left, Right : Time) return Boolean; Global => null;
function "<=" (Left, Right : Time) return Boolean; function "-" (Left : Time; Right : Time) return Time_Span with
function ">" (Left, Right : Time) return Boolean; Global => null;
function ">=" (Left, Right : Time) return Boolean;
function "<" (Left, Right : Time) return Boolean with
function "+" (Left, Right : Time_Span) return Time_Span; Global => null;
function "-" (Left, Right : Time_Span) return Time_Span; function "<=" (Left, Right : Time) return Boolean with
function "-" (Right : Time_Span) return Time_Span; Global => null;
function "*" (Left : Time_Span; Right : Integer) return Time_Span; function ">" (Left, Right : Time) return Boolean with
function "*" (Left : Integer; Right : Time_Span) return Time_Span; Global => null;
function "/" (Left, Right : Time_Span) return Integer; function ">=" (Left, Right : Time) return Boolean with
function "/" (Left : Time_Span; Right : Integer) return Time_Span; Global => null;
function "abs" (Right : Time_Span) return Time_Span; function "+" (Left, Right : Time_Span) return Time_Span with
Global => null;
function "<" (Left, Right : Time_Span) return Boolean; function "-" (Left, Right : Time_Span) return Time_Span with
function "<=" (Left, Right : Time_Span) return Boolean; Global => null;
function ">" (Left, Right : Time_Span) return Boolean; function "-" (Right : Time_Span) return Time_Span with
function ">=" (Left, Right : Time_Span) return Boolean; Global => null;
function "*" (Left : Time_Span; Right : Integer) return Time_Span with
function To_Duration (TS : Time_Span) return Duration; Global => null;
function To_Time_Span (D : Duration) return Time_Span; function "*" (Left : Integer; Right : Time_Span) return Time_Span with
Global => null;
function Nanoseconds (NS : Integer) return Time_Span; function "/" (Left, Right : Time_Span) return Integer with
function Microseconds (US : Integer) return Time_Span; Global => null;
function Milliseconds (MS : Integer) return Time_Span; function "/" (Left : Time_Span; Right : Integer) return Time_Span with
Global => null;
function Seconds (S : Integer) return Time_Span;
function "abs" (Right : Time_Span) return Time_Span with
Global => null;
function "<" (Left, Right : Time_Span) return Boolean with
Global => null;
function "<=" (Left, Right : Time_Span) return Boolean with
Global => null;
function ">" (Left, Right : Time_Span) return Boolean with
Global => null;
function ">=" (Left, Right : Time_Span) return Boolean with
Global => null;
function To_Duration (TS : Time_Span) return Duration with
Global => null;
function To_Time_Span (D : Duration) return Time_Span with
Global => null;
function Nanoseconds (NS : Integer) return Time_Span with
Global => null;
function Microseconds (US : Integer) return Time_Span with
Global => null;
function Milliseconds (MS : Integer) return Time_Span with
Global => null;
function Seconds (S : Integer) return Time_Span with
Global => null;
pragma Ada_05 (Seconds); pragma Ada_05 (Seconds);
function Minutes (M : Integer) return Time_Span; function Minutes (M : Integer) return Time_Span with
Global => null;
pragma Ada_05 (Minutes); pragma Ada_05 (Minutes);
type Seconds_Count is new Long_Long_Integer; type Seconds_Count is new Long_Long_Integer;
...@@ -109,8 +136,12 @@ is ...@@ -109,8 +136,12 @@ is
-- in the case of CodePeer with a target configuration file with a maximum -- in the case of CodePeer with a target configuration file with a maximum
-- integer size of 32, it allows analysis of this unit. -- integer size of 32, it allows analysis of this unit.
procedure Split (T : Time; SC : out Seconds_Count; TS : out Time_Span); procedure Split (T : Time; SC : out Seconds_Count; TS : out Time_Span)
function Time_Of (SC : Seconds_Count; TS : Time_Span) return Time; with
Global => null;
function Time_Of (SC : Seconds_Count; TS : Time_Span) return Time
with
Global => null;
private private
pragma SPARK_Mode (Off); pragma SPARK_Mode (Off);
......
...@@ -49,10 +49,12 @@ is ...@@ -49,10 +49,12 @@ is
Null_Task_Id : constant Task_Id; Null_Task_Id : constant Task_Id;
function "=" (Left, Right : Task_Id) return Boolean; function "=" (Left, Right : Task_Id) return Boolean with
Global => null;
pragma Inline ("="); pragma Inline ("=");
function Image (T : Task_Id) return String; function Image (T : Task_Id) return String with
Global => null;
function Current_Task return Task_Id with function Current_Task return Task_Id with
Volatile_Function, Volatile_Function,
...@@ -60,10 +62,12 @@ is ...@@ -60,10 +62,12 @@ is
pragma Inline (Current_Task); pragma Inline (Current_Task);
function Environment_Task return Task_Id with function Environment_Task return Task_Id with
SPARK_Mode => Off; SPARK_Mode => Off,
Global => null;
pragma Inline (Environment_Task); pragma Inline (Environment_Task);
procedure Abort_Task (T : Task_Id); procedure Abort_Task (T : Task_Id) with
Global => null;
pragma Inline (Abort_Task); pragma Inline (Abort_Task);
-- Note: parameter is mode IN, not IN OUT, per AI-00101 -- Note: parameter is mode IN, not IN OUT, per AI-00101
......
...@@ -27,6 +27,7 @@ with Atree; use Atree; ...@@ -27,6 +27,7 @@ with Atree; use Atree;
with Back_End; use Back_End; with Back_End; use Back_End;
with Checks; with Checks;
with Comperr; with Comperr;
with Cprint;
with Csets; use Csets; with Csets; use Csets;
with Debug; use Debug; with Debug; use Debug;
with Elists; with Elists;
...@@ -148,6 +149,7 @@ procedure Gnat1drv is ...@@ -148,6 +149,7 @@ 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;
-- Enable some restrictions systematically to simplify the generated -- Enable some restrictions systematically to simplify the generated
-- code. Note that restriction checks are also disabled in C mode, -- code. Note that restriction checks are also disabled in C mode,
...@@ -1356,6 +1358,13 @@ begin ...@@ -1356,6 +1358,13 @@ begin
Namet.Unlock; Namet.Unlock;
-- Finally generate C source code if needed. Note that this needs to
-- happen after calling gigi to take advantage of the back annotation.
if Generate_C_Code then
Cprint.Source_Dump;
end if;
-- Generate the call-graph output of dispatching calls -- Generate the call-graph output of dispatching calls
Exp_CG.Generate_CG_Output; Exp_CG.Generate_CG_Output;
......
...@@ -112,6 +112,10 @@ package body SPARK_Specific is ...@@ -112,6 +112,10 @@ package body SPARK_Specific is
(N : Node_Id; (N : Node_Id;
Process : Node_Processing; Process : Node_Processing;
Inside_Stubs : Boolean); Inside_Stubs : Boolean);
procedure Traverse_Protected_Body
(N : Node_Id;
Process : Node_Processing;
Inside_Stubs : Boolean);
procedure Traverse_Package_Body procedure Traverse_Package_Body
(N : Node_Id; (N : Node_Id;
Process : Node_Processing; Process : Node_Processing;
...@@ -1201,6 +1205,9 @@ package body SPARK_Specific is ...@@ -1201,6 +1205,9 @@ package body SPARK_Specific is
elsif Nkind (Lu) = N_Package_Body then elsif Nkind (Lu) = N_Package_Body then
Traverse_Package_Body (Lu, Process, Inside_Stubs); Traverse_Package_Body (Lu, Process, Inside_Stubs);
elsif Nkind (Lu) = N_Protected_Body then
Traverse_Protected_Body (Lu, Process, Inside_Stubs);
-- All other cases of compilation units (e.g. renamings), are not -- All other cases of compilation units (e.g. renamings), are not
-- declarations, or else generic declarations which are ignored. -- declarations, or else generic declarations which are ignored.
...@@ -1298,8 +1305,7 @@ package body SPARK_Specific is ...@@ -1298,8 +1305,7 @@ package body SPARK_Specific is
(Private_Declarations (N), Process, Inside_Stubs); (Private_Declarations (N), Process, Inside_Stubs);
when N_Protected_Body => when N_Protected_Body =>
Traverse_Declarations_Or_Statements Traverse_Protected_Body (N, Process, Inside_Stubs);
(Declarations (N), Process, Inside_Stubs);
when N_Protected_Body_Stub => when N_Protected_Body_Stub =>
if Present (Library_Unit (N)) then if Present (Library_Unit (N)) then
...@@ -1475,6 +1481,19 @@ package body SPARK_Specific is ...@@ -1475,6 +1481,19 @@ package body SPARK_Specific is
(Private_Declarations (Spec), Process, Inside_Stubs); (Private_Declarations (Spec), Process, Inside_Stubs);
end Traverse_Package_Declaration; end Traverse_Package_Declaration;
-----------------------------
-- Traverse_Protected_Body --
-----------------------------
procedure Traverse_Protected_Body
(N : Node_Id;
Process : Node_Processing;
Inside_Stubs : Boolean) is
begin
Traverse_Declarations_Or_Statements
(Declarations (N), Process, Inside_Stubs);
end Traverse_Protected_Body;
------------------------------ ------------------------------
-- Traverse_Subprogram_Body -- -- Traverse_Subprogram_Body --
------------------------------ ------------------------------
......
...@@ -1817,10 +1817,15 @@ package body Sem_Dim is ...@@ -1817,10 +1817,15 @@ package body Sem_Dim is
if Has_Dimension_System (Base_Type (Comp_Typ)) then if Has_Dimension_System (Base_Type (Comp_Typ)) then
Expr := Expression (Comp); Expr := Expression (Comp);
-- A box-initialized component needs no checking.
if No (Expr) and then Box_Present (Comp) then
null;
-- Issue an error if the dimensions of the component type and the -- Issue an error if the dimensions of the component type and the
-- dimensions of the component mismatch. -- dimensions of the component mismatch.
if Dimensions_Of (Expr) /= Dimensions_Of (Comp_Typ) then elsif Dimensions_Of (Expr) /= Dimensions_Of (Comp_Typ) then
-- Check if an error has already been encountered so far -- Check if an error has already been encountered so far
......
...@@ -21580,6 +21580,11 @@ package body Sem_Prag is ...@@ -21580,6 +21580,11 @@ package body Sem_Prag is
Spec_Id := Corresponding_Spec_Of (Subp_Decl); Spec_Id := Corresponding_Spec_Of (Subp_Decl);
Over_Id := Overridden_Operation (Spec_Id); Over_Id := Overridden_Operation (Spec_Id);
if not Ekind_In (Spec_Id, E_Function, E_Generic_Function) then
Pragma_Misplaced;
return;
end if;
-- A pragma that applies to a Ghost entity becomes Ghost for the -- A pragma that applies to a Ghost entity becomes Ghost for the
-- purposes of legality checks and removal of ignored Ghost code. -- purposes of legality checks and removal of ignored Ghost code.
......
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