diff options
author | Thomas Quinot <quinot@adacore.com> | 2009-04-24 14:47:29 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-04-24 16:47:29 +0200 |
commit | c72a85f21a4b21e2fddd4053074f60a57bf6b596 (patch) | |
tree | 6360e69dee919b58d2143bc07997c970eb31e0c6 /gcc | |
parent | 3563739bcd2982f43e3c9c5818c8e0d2ad971394 (diff) | |
download | gcc-c72a85f21a4b21e2fddd4053074f60a57bf6b596.zip gcc-c72a85f21a4b21e2fddd4053074f60a57bf6b596.tar.gz gcc-c72a85f21a4b21e2fddd4053074f60a57bf6b596.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/ada/sem_res.adb | 46 |
2 files changed, 27 insertions, 25 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 872fc8f..9ffd650 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -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, diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 9864e94..0378bd5 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", |