Commit 0a3ec628 by Arnaud Charlet

[multiple changes]

2017-01-20  Thomas Quinot  <quinot@adacore.com>

	* sem_warn.adb (Warn_On_Useless_Assignment): Adjust wording of warning
	message.

2017-01-20  Nicolas Roche  <roche@adacore.com>

	* terminals.c: Ignore failures on setpgid and tcsetpgrp commands.

2017-01-20  Bob Duff  <duff@adacore.com>

	* sem_eval.adb (Compile_Time_Compare): Disable the expr+literal
	(etc) optimizations when the type is modular.

2017-01-20  Yannick Moy  <moy@adacore.com>

	* sem_ch6.adb (Move_Pragmas): move some pragmas,
	but copy the SPARK_Mode pragma instead of moving it.
	(Build_Subprogram_Declaration): Ensure that the generated spec
	and original body share the same SPARK_Pragma aspect/pragma.
	* sem_util.adb, sem_util.ads (Copy_SPARK_Mode_Aspect): New
	procedure to copy SPARK_Mode aspect.

2017-01-20  Bob Duff  <duff@adacore.com>

	* sem_ch3.adb (Analyze_Declarations): Disable Resolve_Aspects
	even in ASIS mode.
	* sem_ch13.adb (Resolve_Name): Enable setting the entity to
	Empty even in ASIS mode.

From-SVN: r244720
parent a395b2e5
2017-01-20 Thomas Quinot <quinot@adacore.com>
* sem_warn.adb (Warn_On_Useless_Assignment): Adjust wording of warning
message.
2017-01-20 Nicolas Roche <roche@adacore.com>
* terminals.c: Ignore failures on setpgid and tcsetpgrp commands.
2017-01-20 Bob Duff <duff@adacore.com>
* sem_eval.adb (Compile_Time_Compare): Disable the expr+literal
(etc) optimizations when the type is modular.
2017-01-20 Yannick Moy <moy@adacore.com>
* sem_ch6.adb (Move_Pragmas): move some pragmas,
but copy the SPARK_Mode pragma instead of moving it.
(Build_Subprogram_Declaration): Ensure that the generated spec
and original body share the same SPARK_Pragma aspect/pragma.
* sem_util.adb, sem_util.ads (Copy_SPARK_Mode_Aspect): New
procedure to copy SPARK_Mode aspect.
2017-01-20 Bob Duff <duff@adacore.com>
* sem_ch3.adb (Analyze_Declarations): Disable Resolve_Aspects
even in ASIS mode.
* sem_ch13.adb (Resolve_Name): Enable setting the entity to
Empty even in ASIS mode.
2017-01-20 Hristian Kirtchev <kirtchev@adacore.com> 2017-01-20 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch9.adb: minor style fixes in comments. * exp_ch9.adb: minor style fixes in comments.
......
...@@ -12731,7 +12731,7 @@ package body Sem_Ch13 is ...@@ -12731,7 +12731,7 @@ package body Sem_Ch13 is
elsif Nkind (N) = N_Identifier and then Chars (N) /= Chars (E) then elsif Nkind (N) = N_Identifier and then Chars (N) /= Chars (E) then
Find_Direct_Name (N); Find_Direct_Name (N);
if not ASIS_Mode then if True or else not ASIS_Mode then -- ????
Set_Entity (N, Empty); Set_Entity (N, Empty);
end if; end if;
......
...@@ -2570,7 +2570,7 @@ package body Sem_Ch3 is ...@@ -2570,7 +2570,7 @@ package body Sem_Ch3 is
-- rejected. Pending notification we restrict this call to -- rejected. Pending notification we restrict this call to
-- ASIS mode. -- ASIS mode.
if ASIS_Mode then if False and then ASIS_Mode then -- ????
Resolve_Aspects; Resolve_Aspects;
end if; end if;
......
...@@ -2399,8 +2399,10 @@ package body Sem_Ch6 is ...@@ -2399,8 +2399,10 @@ package body Sem_Ch6 is
-- of subprogram body From and insert them after node To. The pragmas -- of subprogram body From and insert them after node To. The pragmas
-- in question are: -- in question are:
-- Ghost -- Ghost
-- SPARK_Mode
-- Volatile_Function -- Volatile_Function
-- Also copy pragma SPARK_Mode if present in the declarative list
-- of subprogram body From and insert it after node To. This pragma
-- should not be moved, as it applies to the body too.
------------------ ------------------
-- Move_Pragmas -- -- Move_Pragmas --
...@@ -2425,15 +2427,18 @@ package body Sem_Ch6 is ...@@ -2425,15 +2427,18 @@ package body Sem_Ch6 is
while Present (Decl) loop while Present (Decl) loop
Next_Decl := Next (Decl); Next_Decl := Next (Decl);
if Nkind (Decl) = N_Pragma if Nkind (Decl) = N_Pragma then
and then Nam_In (Pragma_Name_Unmapped (Decl), if Pragma_Name_Unmapped (Decl) = Name_SPARK_Mode then
Insert_After (To, New_Copy_Tree (Decl));
elsif Nam_In (Pragma_Name_Unmapped (Decl),
Name_Ghost, Name_Ghost,
Name_SPARK_Mode,
Name_Volatile_Function) Name_Volatile_Function)
then then
Remove (Decl); Remove (Decl);
Insert_After (To, Decl); Insert_After (To, Decl);
end if; end if;
end if;
Decl := Next_Decl; Decl := Next_Decl;
end loop; end loop;
...@@ -2463,6 +2468,13 @@ package body Sem_Ch6 is ...@@ -2463,6 +2468,13 @@ package body Sem_Ch6 is
Move_Aspects (N, To => Subp_Decl); Move_Aspects (N, To => Subp_Decl);
Move_Pragmas (N, To => Subp_Decl); Move_Pragmas (N, To => Subp_Decl);
-- Ensure that the generated corresponding spec and original body
-- share the same SPARK_Mode pragma or aspect. As a result, both have
-- the same SPARK_Mode attributes, and the global SPARK_Mode value is
-- correctly set for local subprograms.
Copy_SPARK_Mode_Aspect (Subp_Decl, To => N);
Analyze (Subp_Decl); Analyze (Subp_Decl);
-- Propagate the attributes Rewritten_For_C and Corresponding_Proc to -- Propagate the attributes Rewritten_For_C and Corresponding_Proc to
...@@ -2515,13 +2527,6 @@ package body Sem_Ch6 is ...@@ -2515,13 +2527,6 @@ package body Sem_Ch6 is
Body_Spec := Copy_Subprogram_Spec (Body_Spec); Body_Spec := Copy_Subprogram_Spec (Body_Spec);
Set_Specification (N, Body_Spec); Set_Specification (N, Body_Spec);
Body_Id := Analyze_Subprogram_Specification (Body_Spec); Body_Id := Analyze_Subprogram_Specification (Body_Spec);
-- Ensure that the generated corresponding spec and original body
-- share the same SPARK_Mode attributes.
Set_SPARK_Pragma (Body_Id, SPARK_Pragma (Spec_Id));
Set_SPARK_Pragma_Inherited
(Body_Id, SPARK_Pragma_Inherited (Spec_Id));
end Build_Subprogram_Declaration; end Build_Subprogram_Declaration;
---------------------------- ----------------------------
......
...@@ -1142,7 +1142,7 @@ package body Sem_Eval is ...@@ -1142,7 +1142,7 @@ package body Sem_Eval is
return Unknown; return Unknown;
end if; end if;
-- We do not attempt comparisons for packed arrays arrays represented as -- We do not attempt comparisons for packed arrays represented as
-- modular types, where the semantics of comparison is quite different. -- modular types, where the semantics of comparison is quite different.
if Is_Packed_Array_Impl_Type (Ltyp) if Is_Packed_Array_Impl_Type (Ltyp)
...@@ -1329,6 +1329,12 @@ package body Sem_Eval is ...@@ -1329,6 +1329,12 @@ package body Sem_Eval is
-- J .. J + 1. This code can conclude LT with a difference of 1, -- J .. J + 1. This code can conclude LT with a difference of 1,
-- even if the range of J is not known. -- even if the range of J is not known.
-- This would be wrong for modular types (e.g. X < X + 1 is False if
-- X is the largest number).
if not Is_Modular_Integer_Type (Ltyp)
and then not Is_Modular_Integer_Type (Rtyp)
then
declare declare
Lnode : Node_Id; Lnode : Node_Id;
Loffs : Uint; Loffs : Uint;
...@@ -1351,6 +1357,7 @@ package body Sem_Eval is ...@@ -1351,6 +1357,7 @@ package body Sem_Eval is
end if; end if;
end if; end if;
end; end;
end if;
-- Next, try range analysis and see if operand ranges are disjoint -- Next, try range analysis and see if operand ranges are disjoint
......
...@@ -4999,6 +4999,24 @@ package body Sem_Util is ...@@ -4999,6 +4999,24 @@ package body Sem_Util is
return Plist; return Plist;
end Copy_Parameter_List; end Copy_Parameter_List;
----------------------------
-- Copy_SPARK_Mode_Aspect --
----------------------------
procedure Copy_SPARK_Mode_Aspect (From : Node_Id; To : Node_Id) is
pragma Assert (not Has_Aspects (To));
Asp : Node_Id;
begin
if Has_Aspects (From) then
Asp := Find_Aspect (Defining_Entity (From), Aspect_SPARK_Mode);
if Present (Asp) then
Set_Aspect_Specifications (To, New_List (New_Copy_Tree (Asp)));
Set_Has_Aspects (To, True);
end if;
end if;
end Copy_SPARK_Mode_Aspect;
-------------------------- --------------------------
-- Copy_Subprogram_Spec -- -- Copy_Subprogram_Spec --
-------------------------- --------------------------
......
...@@ -424,6 +424,12 @@ package Sem_Util is ...@@ -424,6 +424,12 @@ package Sem_Util is
-- of inlining, and for private protected ops. Also used to create bodies -- of inlining, and for private protected ops. Also used to create bodies
-- for stubbed subprograms. -- for stubbed subprograms.
procedure Copy_SPARK_Mode_Aspect (From : Node_Id; To : Node_Id);
-- Copy the SPARK_Mode aspect if present in the aspect specifications
-- of node From to node To. On entry it is assumed that To does not have
-- aspect specifications. If From has no aspects, the routine has no
-- effect.
function Copy_Subprogram_Spec (Spec : Node_Id) return Node_Id; function Copy_Subprogram_Spec (Spec : Node_Id) return Node_Id;
-- Replicate a function or a procedure specification denoted by Spec. The -- Replicate a function or a procedure specification denoted by Spec. The
-- resulting tree is an exact duplicate of the original tree. New entities -- resulting tree is an exact duplicate of the original tree. New entities
......
...@@ -4323,7 +4323,12 @@ package body Sem_Warn is ...@@ -4323,7 +4323,12 @@ package body Sem_Warn is
begin begin
-- Don't give this for OUT and IN OUT formals, since -- Don't give this for OUT and IN OUT formals, since
-- clearly caller may reference the assigned value. Also -- clearly caller may reference the assigned value. Also
-- never give such warnings for internal variables. -- never give such warnings for internal variables. In
-- either case, word the warning in a conditional way,
-- because in the case of a component of a controlled
-- type, the assigned value might be referenced in the
-- Finalize operation, so we can't make a definitive
-- statement that it's never referenced.
if Ekind (Ent) = E_Variable if Ekind (Ent) = E_Variable
and then not Is_Internal_Name (Chars (Ent)) and then not Is_Internal_Name (Chars (Ent))
...@@ -4335,13 +4340,13 @@ package body Sem_Warn is ...@@ -4335,13 +4340,13 @@ package body Sem_Warn is
N_Parameter_Association) N_Parameter_Association)
then then
Error_Msg_NE Error_Msg_NE
("?m?& modified by call, but value never " ("?m?& modified by call, but value might not "
& "referenced", LA, Ent); & "be referenced", LA, Ent);
else else
Error_Msg_NE -- CODEFIX Error_Msg_NE -- CODEFIX
("?m?useless assignment to&, value never " ("?m?possibly useless assignment to&, value "
& "referenced!", LA, Ent); & "might not be referenced!", LA, Ent);
end if; end if;
end if; end if;
end; end;
......
...@@ -1425,10 +1425,10 @@ __gnat_setup_child_communication ...@@ -1425,10 +1425,10 @@ __gnat_setup_child_communication
if (desc->slave_fd > 2) close (desc->slave_fd); if (desc->slave_fd > 2) close (desc->slave_fd);
/* adjust process group settings */ /* adjust process group settings */
if ((status = setpgid (pid, pid)) == -1) /* ignore failures of the following two commands as the context might not
return -1; * allow making those changes. */
if ((status = tcsetpgrp (0, pid)) == -1) setpgid (pid, pid);
return -1; tcsetpgrp (0, pid);
/* launch the program */ /* launch the program */
execvp (new_argv[0], new_argv); execvp (new_argv[0], new_argv);
......
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