Commit 2a7b8e18 by Arnaud Charlet

[multiple changes]

2012-10-02  Bob Duff  <duff@adacore.com>

	* checks.adb (Apply_Predicate_Check): Disable check in -gnatc mode.

2012-10-02  Vincent Pucci  <pucci@adacore.com>

	* sem_ch6.adb (Analyze_Function_Call): Dimension propagation
	for function calls moved to Analyze_Dimension_Call.
	* sem_dim.adb (Analyze_Dimension_Call): Properly propagate the
	dimensions from the returned type for function calls.

2012-10-02  Vincent Celier  <celier@adacore.com>

	* gnatcmd.adb: Take into account any configuration pragma file
	in the project files for gnat pretty/stub/metric.

2012-10-02  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch13.adb (Check_Indexing_Functions): Refine several tests
	on the legality of indexing aspects: Constant_Indexing functions
	do not have to return a reference type, and given an indexing
	aspect Func, not all overloadings of Func in the current scope
	need to be indexing functions.

2012-10-02  Vasiliy Fofanov  <fofanov@adacore.com>

	* gnat_ugn.texi: Adjust docs for overflow checks to be VMS-friendly.

2012-10-02  Vincent Celier  <celier@adacore.com>

	* switch-m.adb (Normalize_Compiler_Switches): Recognize switches
	-gnatox and -gnatoxx when x=0/1/2/3.

From-SVN: r191960
parent 5f49133f
2012-10-02 Bob Duff <duff@adacore.com>
* checks.adb (Apply_Predicate_Check): Disable check in -gnatc mode.
2012-10-02 Vincent Pucci <pucci@adacore.com>
* sem_ch6.adb (Analyze_Function_Call): Dimension propagation
for function calls moved to Analyze_Dimension_Call.
* sem_dim.adb (Analyze_Dimension_Call): Properly propagate the
dimensions from the returned type for function calls.
2012-10-02 Vincent Celier <celier@adacore.com>
* gnatcmd.adb: Take into account any configuration pragma file
in the project files for gnat pretty/stub/metric.
2012-10-02 Ed Schonberg <schonberg@adacore.com>
* sem_ch13.adb (Check_Indexing_Functions): Refine several tests
on the legality of indexing aspects: Constant_Indexing functions
do not have to return a reference type, and given an indexing
aspect Func, not all overloadings of Func in the current scope
need to be indexing functions.
2012-10-02 Vasiliy Fofanov <fofanov@adacore.com>
* gnat_ugn.texi: Adjust docs for overflow checks to be VMS-friendly.
2012-10-02 Vincent Celier <celier@adacore.com>
* switch-m.adb (Normalize_Compiler_Switches): Recognize switches
-gnatox and -gnatoxx when x=0/1/2/3.
2012-10-02 Vincent Pucci <pucci@adacore.com> 2012-10-02 Vincent Pucci <pucci@adacore.com>
* sem_ch4.adb (Analyze_Indexed_Component_Form): Dimension * sem_ch4.adb (Analyze_Indexed_Component_Form): Dimension
......
...@@ -2459,11 +2459,15 @@ package body Checks is ...@@ -2459,11 +2459,15 @@ package body Checks is
else else
-- If the predicate is a static predicate and the operand is -- If the predicate is a static predicate and the operand is
-- static, the predicate must be evaluated statically. If the -- static, the predicate must be evaluated statically. If the
-- evaluation fails this is a static constraint error. -- evaluation fails this is a static constraint error. This check
-- is disabled in -gnatc mode, because the compiler is incapable
-- of evaluating static expressions in that case.
if Is_OK_Static_Expression (N) then if Is_OK_Static_Expression (N) then
if Present (Static_Predicate (Typ)) then if Present (Static_Predicate (Typ)) then
if Eval_Static_Predicate_Check (N, Typ) then if Operating_Mode < Generate_Code or else
Eval_Static_Predicate_Check (N, Typ)
then
return; return;
else else
Error_Msg_NE Error_Msg_NE
......
...@@ -4346,7 +4346,7 @@ an assertion. ...@@ -4346,7 +4346,7 @@ an assertion.
Enable numeric overflow checking (which is not normally enabled by Enable numeric overflow checking (which is not normally enabled by
default). Note that division by zero is a separate check that is not default). Note that division by zero is a separate check that is not
controlled by this switch (division by zero checking is on by default). controlled by this switch (division by zero checking is on by default).
The checking mode is set to CHECKED (equivalent to @option{-gnato11}). The checking mode is set to CHECKED (equivalent to @option{^-gnato11^/OVERFLOW_CHECKS=11^}).
@item -gnatp @item -gnatp
@cindex @option{-gnatp} (@command{gcc}) @cindex @option{-gnatp} (@command{gcc})
...@@ -2311,10 +2311,15 @@ begin ...@@ -2311,10 +2311,15 @@ begin
(new String'("-gnatem=" & Get_Name_String (M_File))); (new String'("-gnatem=" & Get_Name_String (M_File)));
end if; end if;
-- For gnatcheck, also indicate a global configuration pragmas -- For gnatcheck, gnatpp, gnatstub and gnatmetric, also
-- file and, if -U is not used, a local one. -- indicate a global configuration pragmas file and, if -U
-- is not used, a local one.
if The_Command = Check then
if The_Command = Check or else
The_Command = Pretty or else
The_Command = Stub or else
The_Command = Metric
then
declare declare
Pkg : constant Prj.Package_Id := Pkg : constant Prj.Package_Id :=
Prj.Util.Value_Of Prj.Util.Value_Of
......
...@@ -1919,7 +1919,7 @@ package body Sem_Ch13 is ...@@ -1919,7 +1919,7 @@ package body Sem_Ch13 is
procedure Check_Indexing_Functions; procedure Check_Indexing_Functions;
-- Check that the function in Constant_Indexing or Variable_Indexing -- Check that the function in Constant_Indexing or Variable_Indexing
-- attribute has the proper type structure. If the name is overloaded, -- attribute has the proper type structure. If the name is overloaded,
-- check that all interpretations are legal. -- check that some interpretation is legal.
procedure Check_Iterator_Functions; procedure Check_Iterator_Functions;
-- Check that there is a single function in Default_Iterator attribute -- Check that there is a single function in Default_Iterator attribute
...@@ -2070,6 +2070,7 @@ package body Sem_Ch13 is ...@@ -2070,6 +2070,7 @@ package body Sem_Ch13 is
------------------------------ ------------------------------
procedure Check_Indexing_Functions is procedure Check_Indexing_Functions is
Indexing_Found : Boolean;
procedure Check_One_Function (Subp : Entity_Id); procedure Check_One_Function (Subp : Entity_Id);
-- Check one possible interpretation -- Check one possible interpretation
...@@ -2085,29 +2086,38 @@ package body Sem_Ch13 is ...@@ -2085,29 +2086,38 @@ package body Sem_Ch13 is
Aspect_Iterator_Element); Aspect_Iterator_Element);
begin begin
if not Check_Primitive_Function (Subp) then if not Check_Primitive_Function (Subp)
and then not Is_Overloaded (Expr)
then
Error_Msg_NE Error_Msg_NE
("aspect Indexing requires a function that applies to type&", ("aspect Indexing requires a function that applies to type&",
Subp, Ent); Subp, Ent);
end if; end if;
-- An indexing function must return either the default element of -- An indexing function must return either the default element of
-- the container, or a reference type. -- the container, or a reference type. For variable indexing it
-- must be latter.
if Present (Default_Element) then if Present (Default_Element) then
Analyze (Default_Element); Analyze (Default_Element);
if Is_Entity_Name (Default_Element) if Is_Entity_Name (Default_Element)
and then Covers (Entity (Default_Element), Etype (Subp)) and then Covers (Entity (Default_Element), Etype (Subp))
then then
Indexing_Found := True;
return; return;
end if; end if;
end if; end if;
-- Otherwise the return type must be a reference type. -- For variable_indexing the return type must be a reference type.
if not Has_Implicit_Dereference (Etype (Subp)) then if Attr = Name_Variable_Indexing
and then not Has_Implicit_Dereference (Etype (Subp))
then
Error_Msg_N Error_Msg_N
("function for indexing must return a reference type", Subp); ("function for indexing must return a reference type", Subp);
else
Indexing_Found := True;
end if; end if;
end Check_One_Function; end Check_One_Function;
...@@ -2129,6 +2139,7 @@ package body Sem_Ch13 is ...@@ -2129,6 +2139,7 @@ package body Sem_Ch13 is
It : Interp; It : Interp;
begin begin
Indexing_Found := False;
Get_First_Interp (Expr, I, It); Get_First_Interp (Expr, I, It);
while Present (It.Nam) loop while Present (It.Nam) loop
...@@ -2142,6 +2153,11 @@ package body Sem_Ch13 is ...@@ -2142,6 +2153,11 @@ package body Sem_Ch13 is
Get_Next_Interp (I, It); Get_Next_Interp (I, It);
end loop; end loop;
if not Indexing_Found then
Error_Msg_NE (
"aspect Indexing requires a function that applies to type&",
Expr, Ent);
end if;
end; end;
end if; end if;
end Check_Indexing_Functions; end Check_Indexing_Functions;
......
...@@ -500,10 +500,6 @@ package body Sem_Ch6 is ...@@ -500,10 +500,6 @@ package body Sem_Ch6 is
end if; end if;
Analyze_Call (N); Analyze_Call (N);
-- Propagate the dimensions from the returned type, if necessary
Analyze_Dimension (N);
end Analyze_Function_Call; end Analyze_Function_Call;
----------------------------- -----------------------------
......
...@@ -236,9 +236,9 @@ package body Switch.M is ...@@ -236,9 +236,9 @@ package body Switch.M is
-- One-letter switches -- One-letter switches
when 'a' | 'A' | 'b' | 'B' | 'c' | 'C' | 'E' | 'f' | when 'a' | 'A' | 'b' | 'B' | 'c' | 'C' | 'E' | 'f' |
'F' | 'g' | 'h' | 'H' | 'I' | 'L' | 'N' | 'o' | 'F' | 'g' | 'h' | 'H' | 'I' | 'L' | 'N' | 'p' |
'p' | 'P' | 'q' | 'Q' | 'r' | 's' | 'S' | 't' | 'P' | 'q' | 'Q' | 'r' | 's' | 'S' | 't' | 'u' |
'u' | 'U' | 'v' | 'x' | 'X' | 'Z' => 'U' | 'v' | 'x' | 'X' | 'Z' =>
Storing (First_Stored) := C; Storing (First_Stored) := C;
Add_Switch_Component Add_Switch_Component
(Storing (Storing'First .. First_Stored)); (Storing (Storing'First .. First_Stored));
...@@ -441,6 +441,32 @@ package body Switch.M is ...@@ -441,6 +441,32 @@ package body Switch.M is
Add_Switch_Component Add_Switch_Component
(Storing (Storing'First .. Last_Stored)); (Storing (Storing'First .. Last_Stored));
-- -gnato may be -gnatox or -gnatoxx, with x=0/1/2/3
when 'o' =>
Last_Stored := First_Stored;
Storing (Last_Stored) := 'o';
Ptr := Ptr + 1;
if Ptr <= Max
and then Switch_Chars (Ptr) in '0' .. '3'
then
Last_Stored := Last_Stored + 1;
Storing (Last_Stored) := Switch_Chars (Ptr);
Ptr := Ptr + 1;
if Ptr <= Max
and then Switch_Chars (Ptr) in '0' .. '3'
then
Last_Stored := Last_Stored + 1;
Storing (Last_Stored) := Switch_Chars (Ptr);
Ptr := Ptr + 1;
end if;
end if;
Add_Switch_Component
(Storing (Storing'First .. Last_Stored));
-- -gnatR may be followed by '0', '1', '2' or '3', -- -gnatR may be followed by '0', '1', '2' or '3',
-- then by 's' -- then by 's'
......
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