Commit 305caf42 by Arnaud Charlet

[multiple changes]

2010-06-18  Thomas Quinot  <quinot@adacore.com>

	* sem_eval.adb (Test_In_Range): New subprogram, factoring duplicated
	code between...
	(Is_In_Range, Is_Out_Of_Range): Reimplement in terms of call to
	Test_In_Range.

2010-06-18  Robert Dewar  <dewar@adacore.com>

	* sprint.adb: Minor change in output format for expression wi actions.
	* par-ch3.adb: Minor code reorganization.  Minor reformatting.
	* sem_ch5.adb: Minor comment fix.

2010-06-18  Robert Dewar  <dewar@adacore.com>

	* debug.adb: New debug flag -gnatd.L to control
	Back_End_Handles_Limited_Types.
	* exp_ch4.adb (Expand_N_Conditional_Expression): Let back end handle
	limited case if Back_End_Handles_Limited_Types is True.
	(Expand_N_Conditional_Expression): Use N_Expression_With_Actions to
	simplify expansion if Use_Expression_With_Actions is True.
	* gnat1drv.adb (Adjust_Global_Switches): Set
	Back_End_Handles_Limited_Types.
	* opt.ads (Back_End_Handles_Limited_Types): New flag.

2010-06-18  Ed Schonberg  <schonberg@adacore.com>

	* sem_res.adb (Rewrite_Operator_As_Call): Do not rewrite user-defined
	intrinsic operator if expansion is not enabled, because in an
	instantiation the original operator must be present to verify the
	legality of the operation.

From-SVN: r160969
parent e1be7706
2010-06-18 Thomas Quinot <quinot@adacore.com>
* sem_eval.adb (Test_In_Range): New subprogram, factoring duplicated
code between...
(Is_In_Range, Is_Out_Of_Range): Reimplement in terms of call to
Test_In_Range.
2010-06-18 Robert Dewar <dewar@adacore.com>
* sprint.adb: Minor change in output format for expression wi actions.
* par-ch3.adb: Minor code reorganization. Minor reformatting.
* sem_ch5.adb: Minor comment fix.
2010-06-18 Robert Dewar <dewar@adacore.com>
* debug.adb: New debug flag -gnatd.L to control
Back_End_Handles_Limited_Types.
* exp_ch4.adb (Expand_N_Conditional_Expression): Let back end handle
limited case if Back_End_Handles_Limited_Types is True.
(Expand_N_Conditional_Expression): Use N_Expression_With_Actions to
simplify expansion if Use_Expression_With_Actions is True.
* gnat1drv.adb (Adjust_Global_Switches): Set
Back_End_Handles_Limited_Types.
* opt.ads (Back_End_Handles_Limited_Types): New flag.
2010-06-18 Ed Schonberg <schonberg@adacore.com>
* sem_res.adb (Rewrite_Operator_As_Call): Do not rewrite user-defined
intrinsic operator if expansion is not enabled, because in an
instantiation the original operator must be present to verify the
legality of the operation.
2010-06-18 Robert Dewar <dewar@adacore.com> 2010-06-18 Robert Dewar <dewar@adacore.com>
* exp_disp.adb, sem_ch12.adb: Minor reformatting * exp_disp.adb, sem_ch12.adb: Minor reformatting
......
...@@ -76,7 +76,7 @@ package body Debug is ...@@ -76,7 +76,7 @@ package body Debug is
-- dJ Output debugging trace info for JGNAT (Java VM version of GNAT) -- dJ Output debugging trace info for JGNAT (Java VM version of GNAT)
-- dK Kill all error messages -- dK Kill all error messages
-- dL Output trace information on elaboration checking -- dL Output trace information on elaboration checking
-- dM Asssume all variables are modified (no current values) -- dM Assume all variables are modified (no current values)
-- dN No file name information in exception messages -- dN No file name information in exception messages
-- dO Output immediate error messages -- dO Output immediate error messages
-- dP Do not check for controlled objects in preelaborable packages -- dP Do not check for controlled objects in preelaborable packages
...@@ -129,7 +129,7 @@ package body Debug is ...@@ -129,7 +129,7 @@ package body Debug is
-- d.I SCIL generation mode -- d.I SCIL generation mode
-- d.J Parallel SCIL generation mode -- d.J Parallel SCIL generation mode
-- d.K -- d.K
-- d.L -- d.L Depend on back end for limited types in conditional expressions
-- d.M -- d.M
-- d.N -- d.N
-- d.O Dump internal SCO tables -- d.O Dump internal SCO tables
...@@ -567,6 +567,11 @@ package body Debug is ...@@ -567,6 +567,11 @@ package body Debug is
-- This means in particular not writing the same files under the -- This means in particular not writing the same files under the
-- same directory. -- same directory.
-- d.L Normally the front end generates special expansion for conditional
-- expressions of a limited type. This debug flag removes this special
-- case expansion, leaving it up to the back end to handle conditional
-- expressions correctly.
-- d.O Dump internal SCO tables. Before outputting the SCO information to -- d.O Dump internal SCO tables. Before outputting the SCO information to
-- the ALI file, the internal SCO tables (SCO_Table/SCO_Unit_Table) -- the ALI file, the internal SCO tables (SCO_Table/SCO_Unit_Table)
-- are dumped for debugging purposes. -- are dumped for debugging purposes.
......
...@@ -359,6 +359,30 @@ procedure Gnat1drv is ...@@ -359,6 +359,30 @@ procedure Gnat1drv is
else else
Use_Expression_With_Actions := False; Use_Expression_With_Actions := False;
end if; end if;
-- Set switch indicating if back end can handle limited types, and
-- guarantee that no incorrect copies are made (e.g. in the context
-- of a conditional expression).
-- Debug flag -gnatd.L decisively sets usage on
if Debug_Flag_Dot_XX then
Back_End_Handles_Limited_Types := True;
-- If no debug flag, usage off for AAMP, VM, SCIL cases
elsif AAMP_On_Target
or else VM_Target /= No_VM
or else Generate_SCIL
then
Back_End_Handles_Limited_Types := False;
-- Otherwise normal gcc back end, for now still turn flag off by
-- default, since we have not verified proper back end handling.
else
Back_End_Handles_Limited_Types := False;
end if;
end Adjust_Global_Switches; end Adjust_Global_Switches;
-------------------- --------------------
......
...@@ -172,6 +172,15 @@ package Opt is ...@@ -172,6 +172,15 @@ package Opt is
-- also set true if certain Unchecked_Conversion instantiations require -- also set true if certain Unchecked_Conversion instantiations require
-- checking based on annotated values. -- checking based on annotated values.
Back_End_Handles_Limited_Types : Boolean;
-- This flag is set true if the back end can properly handle limited or
-- other by reference types, and avoid copies. If this flag is False, then
-- the front end does special expansion for conditional expressions to make
-- sure that no copy occurs. If the flag is True, then the expansion for
-- conditional expressions relies on the back end properly handling things.
-- Currently the default is False for all cases (set in gnat1drv). The
-- default can be modified using -gnatd.L (sets the flag True).
Bind_Alternate_Main_Name : Boolean := False; Bind_Alternate_Main_Name : Boolean := False;
-- GNATBIND -- GNATBIND
-- True if main should be called Alternate_Main_Name.all. -- True if main should be called Alternate_Main_Name.all.
...@@ -1239,12 +1248,12 @@ package Opt is ...@@ -1239,12 +1248,12 @@ package Opt is
-- Set to True if -h (-gnath for the compiler) switch encountered -- Set to True if -h (-gnath for the compiler) switch encountered
-- requesting usage information -- requesting usage information
Use_Expression_With_Actions : Boolean := False; Use_Expression_With_Actions : Boolean;
-- The N_Expression_With_Actions node has been introduced relatively -- The N_Expression_With_Actions node has been introduced relatively
-- recently, and not all back ends are prepared to handle it yet. So -- recently, and not all back ends are prepared to handle it yet. So
-- we use this flag to suppress its use during a transitional period. -- we use this flag to suppress its use during a transitional period.
-- Currently the default is False for all cases except the standard -- Currently the default is False for all cases (set in gnat1drv).
-- GCC back end. The default can be modified using -gnatd.X/-gnatd.Y. -- The default can be modified using -gnatd.X/-gnatd.Y.
Use_Pragma_Linker_Constructor : Boolean := False; Use_Pragma_Linker_Constructor : Boolean := False;
-- GNATBIND -- GNATBIND
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2009, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2010, 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- --
...@@ -558,7 +558,8 @@ package body Sem_Ch5 is ...@@ -558,7 +558,8 @@ package body Sem_Ch5 is
and then not Is_Tag_Indeterminate (Rhs) and then not Is_Tag_Indeterminate (Rhs)
and then not Is_Dynamically_Tagged (Rhs) and then not Is_Dynamically_Tagged (Rhs)
then then
Error_Msg_N ("dynamically tagged expression required!", Rhs); Error_Msg_N -- CODEFIX???
("dynamically tagged expression required!", Rhs);
end if; end if;
-- Propagate the tag from a class-wide target to the rhs when the rhs -- Propagate the tag from a class-wide target to the rhs when the rhs
...@@ -572,7 +573,7 @@ package body Sem_Ch5 is ...@@ -572,7 +573,7 @@ package body Sem_Ch5 is
and then Is_Entity_Name (Name (Rhs)) and then Is_Entity_Name (Name (Rhs))
and then Is_Abstract_Subprogram (Entity (Name (Rhs))) and then Is_Abstract_Subprogram (Entity (Name (Rhs)))
then then
Error_Msg_N Error_Msg_N -- CODEFIX???
("call to abstract function must be dispatching", Name (Rhs)); ("call to abstract function must be dispatching", Name (Rhs));
elsif Nkind (Rhs) = N_Qualified_Expression elsif Nkind (Rhs) = N_Qualified_Expression
...@@ -581,7 +582,7 @@ package body Sem_Ch5 is ...@@ -581,7 +582,7 @@ package body Sem_Ch5 is
and then and then
Is_Abstract_Subprogram (Entity (Name (Expression (Rhs)))) Is_Abstract_Subprogram (Entity (Name (Expression (Rhs))))
then then
Error_Msg_N Error_Msg_N -- CODEFIX???
("call to abstract function must be dispatching", ("call to abstract function must be dispatching",
Name (Expression (Rhs))); Name (Expression (Rhs)));
end if; end if;
...@@ -693,10 +694,10 @@ package body Sem_Ch5 is ...@@ -693,10 +694,10 @@ package body Sem_Ch5 is
and then Nkind (Original_Node (Rhs)) not in N_Op and then Nkind (Original_Node (Rhs)) not in N_Op
then then
if Nkind (Lhs) in N_Has_Entity then if Nkind (Lhs) in N_Has_Entity then
Error_Msg_NE Error_Msg_NE -- CODEFIX
("?useless assignment of & to itself!", N, Entity (Lhs)); ("?useless assignment of & to itself!", N, Entity (Lhs));
else else
Error_Msg_N Error_Msg_N -- CODEFIX
("?useless assignment of object to itself!", N); ("?useless assignment of object to itself!", N);
end if; end if;
end if; end if;
...@@ -948,7 +949,7 @@ package body Sem_Ch5 is ...@@ -948,7 +949,7 @@ package body Sem_Ch5 is
-- the case statement has a non static choice. -- the case statement has a non static choice.
procedure Process_Statements (Alternative : Node_Id); procedure Process_Statements (Alternative : Node_Id);
-- Analyzes all the statements associated to a case alternative. -- Analyzes all the statements associated with a case alternative.
-- Needed by the generic instantiation below. -- Needed by the generic instantiation below.
package Case_Choices_Processing is new package Case_Choices_Processing is new
...@@ -1635,10 +1636,11 @@ package body Sem_Ch5 is ...@@ -1635,10 +1636,11 @@ package body Sem_Ch5 is
else else
-- Both of them are user-defined -- Both of them are user-defined
Error_Msg_N Error_Msg_N -- CODEFIX???
("ambiguous bounds in range of iteration", ("ambiguous bounds in range of iteration",
R_Copy); R_Copy);
Error_Msg_N ("\possible interpretations:", R_Copy); Error_Msg_N -- CODEFIX???
("\possible interpretations:", R_Copy);
Error_Msg_NE ("\\} ", R_Copy, Found); Error_Msg_NE ("\\} ", R_Copy, Found);
Error_Msg_NE ("\\} ", R_Copy, It.Typ); Error_Msg_NE ("\\} ", R_Copy, It.Typ);
exit; exit;
...@@ -1890,7 +1892,7 @@ package body Sem_Ch5 is ...@@ -1890,7 +1892,7 @@ package body Sem_Ch5 is
if Compile_Time_Compare if Compile_Time_Compare
(L, H, Assume_Valid => False) = GT (L, H, Assume_Valid => False) = GT
then then
Error_Msg_N Error_Msg_N -- CODEFIX???
("?loop range is null, " ("?loop range is null, "
& "loop will not execute", & "loop will not execute",
DS); DS);
...@@ -1944,7 +1946,8 @@ package body Sem_Ch5 is ...@@ -1944,7 +1946,8 @@ package body Sem_Ch5 is
Intval (Original_Node (H)) = Uint_1) Intval (Original_Node (H)) = Uint_1)
then then
Error_Msg_N ("?loop range may be null", DS); Error_Msg_N ("?loop range may be null", DS);
Error_Msg_N ("\?bounds may be wrong way round", DS); Error_Msg_N -- CODEFIX???
("\?bounds may be wrong way round", DS);
end if; end if;
end; end;
end if; end if;
...@@ -2241,7 +2244,8 @@ package body Sem_Ch5 is ...@@ -2241,7 +2244,8 @@ package body Sem_Ch5 is
-- Now issue the warning -- Now issue the warning
Error_Msg ("?unreachable code!", Error_Loc); Error_Msg -- CODEFIX???
("?unreachable code!", Error_Loc);
end if; end if;
-- If the unconditional transfer of control instruction is -- If the unconditional transfer of control instruction is
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2009, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2010, 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- --
...@@ -1513,7 +1513,6 @@ package body Sprint is ...@@ -1513,7 +1513,6 @@ package body Sprint is
Indent_Begin; Indent_Begin;
Write_Indent_Str_Sloc ("do"); Write_Indent_Str_Sloc ("do");
Indent_Begin; Indent_Begin;
Write_Indent;
Sprint_Node_List (Actions (Node)); Sprint_Node_List (Actions (Node));
Indent_End; Indent_End;
Write_Indent; Write_Indent;
......
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