From: charlet Date: Fri, 24 Apr 2009 14:47:29 +0000 (+0000) Subject: 2009-04-24 Thomas Quinot X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eef002be96a344da1c34ef69ef268c05b48e6f15;p=thirdparty%2Fgcc.git 2009-04-24 Thomas Quinot * sem_res.adb (Static_Concatenation): Simplify predicate to make it accurately handle cases such as "lit" & "lit" and "lit" & static_string_constant git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146728 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 872fc8f195de..9ffd6500b237 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2009-04-24 Thomas Quinot + + * 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 * prj-proc.adb, make.adb, mlib-prj.adb, prj.adb, prj.ads, clean.adb, diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 9864e94f3aa2..0378bd542ccf 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.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",