2
0
mirror of git://gcc.gnu.org/git/gcc.git synced 2025-04-09 23:21:31 +08:00

sem_res.adb (Static_Concatenation): Simplify predicate to make it accurately handle cases such as "lit" & "lit" and...

2009-04-24  Thomas Quinot  <quinot@adacore.com>

	* sem_res.adb (Static_Concatenation): Simplify predicate to make it
	accurately handle cases such as "lit" & "lit" and
	"lit" & static_string_constant

From-SVN: r146728
This commit is contained in:
Thomas Quinot 2009-04-24 14:47:29 +00:00 committed by Arnaud Charlet
parent 3563739bcd
commit c72a85f21a
2 changed files with 27 additions and 25 deletions

@ -1,3 +1,9 @@
2009-04-24 Thomas Quinot <quinot@adacore.com>
* sem_res.adb (Static_Concatenation): Simplify predicate to make it
accurately handle cases such as "lit" & "lit" and
"lit" & static_string_constant
2009-04-24 Emmanuel Briot <briot@adacore.com>
* prj-proc.adb, make.adb, mlib-prj.adb, prj.adb, prj.ads, clean.adb,

@ -3026,34 +3026,30 @@ package body Sem_Res is
function Static_Concatenation (N : Node_Id) return Boolean is
begin
if Nkind (N) /= N_Op_Concat
or else Etype (N) /= Standard_String
then
return False;
case Nkind (N) is
when N_String_Literal =>
return True;
elsif Nkind (Left_Opnd (N)) = N_String_Literal then
return Static_Concatenation (Right_Opnd (N));
when N_Op_Concat =>
return Static_Concatenation (Left_Opnd (N))
and then
Static_Concatenation (Right_Opnd (N));
when others =>
if Is_Entity_Name (N) then
declare
Ent : constant Entity_Id := Entity (N);
begin
return Ekind (Ent) = E_Constant
and then Present (Constant_Value (Ent))
and then Is_Static_Expression
(Constant_Value (Ent));
end;
elsif Is_Entity_Name (Left_Opnd (N)) then
declare
Ent : constant Entity_Id := Entity (Left_Opnd (N));
begin
if Ekind (Ent) = E_Constant
and then Present (Constant_Value (Ent))
and then Is_Static_Expression (Constant_Value (Ent))
then
return Static_Concatenation (Right_Opnd (N));
else
return False;
end if;
end;
elsif Static_Concatenation (Left_Opnd (N)) then
return Static_Concatenation (Right_Opnd (N));
else
return False;
end if;
end case;
end Static_Concatenation;
-- Start of processing for Resolve_Actuals
@ -8315,7 +8311,7 @@ package body Sem_Res is
if From_With_Type (Opnd) then
Error_Msg_Qual_Level := 99;
Error_Msg_NE ("missing with-clause on package &", N,
Error_Msg_NE ("missing WITH clause on package &", N,
Cunit_Entity (Get_Source_Unit (Base_Type (Opnd))));
Error_Msg_N
("type conversions require visibility of the full view",
@ -8327,7 +8323,7 @@ package body Sem_Res is
and then Present (Non_Limited_View (Etype (Target))))
then
Error_Msg_Qual_Level := 99;
Error_Msg_NE ("missing with-clause on package &", N,
Error_Msg_NE ("missing WITH clause on package &", N,
Cunit_Entity (Get_Source_Unit (Base_Type (Target))));
Error_Msg_N
("type conversions require visibility of the full view",