diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-11-30 12:15:51 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-11-30 12:15:51 +0100 |
commit | 6a2afd139d8a7719f2ce49028f23a781a25d9093 (patch) | |
tree | 8e96d9ba09117e739624fe6b6c89ef394cce59e4 /gcc/ada/exp_ch4.adb | |
parent | 1c6b661582f0c97a02587588a81e84ee34602686 (diff) | |
download | gcc-6a2afd139d8a7719f2ce49028f23a781a25d9093.zip gcc-6a2afd139d8a7719f2ce49028f23a781a25d9093.tar.gz gcc-6a2afd139d8a7719f2ce49028f23a781a25d9093.tar.bz2 |
[multiple changes]
2009-11-30 Robert Dewar <dewar@adacore.com>
* gnat_rm.texi: Add documentation for attribute Result.
2009-11-30 Arnaud Charlet <charlet@adacore.com>
* s-osinte-hpux.ads, s-osinte-aix.ads, s-osinte-solaris-posix.ads,
s-osinte-tru64.ads, s-osinte-darwin.ads, s-osinte-freebsd.ads
(Get_Page_Size): Update comment since Get_Page_Size is now required.
2009-11-30 Jerome Lambourg <lambourg@adacore.com>
* freeze.adb: Disable Warning on VM targets concerning C Imports, not
relevant.
2009-11-30 Bob Duff <duff@adacore.com>
* sprint.adb (Source_Dump): Minor comment fix.
(Write_Itype): When writing a string literal subtype, use Expr_Value
instead of Intval to get the low bound.
2009-11-30 Vincent Celier <celier@adacore.com>
* gnatlink.adb (Process_Args): Do not call Executable_Name on arguments
of switch -o.
2009-11-30 Robert Dewar <dewar@adacore.com>
* exp_ch4.adb (Expand_N_Op_And): Implement pragma Short_Circuit_And_Or
(Expand_N_Op_Or): Implement pragma Short_Circuit_And_Or
* opt.ads (Short_Circuit_And_Or): New flag
* par-prag.adb: Add dummy entry for pragma Short_Circuit_And_Or
* sem_prag.adb: Implement pragma Short_Circuit_And_Or
* snames.ads-tmpl: Add entries for pragma Short_Circuit_And_Or
From-SVN: r154786
Diffstat (limited to 'gcc/ada/exp_ch4.adb')
-rw-r--r-- | gcc/ada/exp_ch4.adb | 48 |
1 files changed, 40 insertions, 8 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 6a7ea4f..dd74a15 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -5025,10 +5025,26 @@ package body Exp_Ch4 is Expand_Boolean_Operator (N); elsif Is_Boolean_Type (Etype (N)) then - Adjust_Condition (Left_Opnd (N)); - Adjust_Condition (Right_Opnd (N)); - Set_Etype (N, Standard_Boolean); - Adjust_Result_Type (N, Typ); + + -- Replace AND by AND THEN if Short_Circuit_And_Or active and the + -- type is standard Boolean (do not mess with AND that uses a non- + -- standard Boolean type, because something strange is going on). + + if Short_Circuit_And_Or and then Typ = Standard_Boolean then + Rewrite (N, + Make_And_Then (Sloc (N), + Left_Opnd => Relocate_Node (Left_Opnd (N)), + Right_Opnd => Relocate_Node (Right_Opnd (N)))); + Analyze_And_Resolve (N, Typ); + + -- Otherwise, adjust conditions + + else + Adjust_Condition (Left_Opnd (N)); + Adjust_Condition (Right_Opnd (N)); + Set_Etype (N, Standard_Boolean); + Adjust_Result_Type (N, Typ); + end if; end if; end Expand_N_Op_And; @@ -6913,10 +6929,26 @@ package body Exp_Ch4 is Expand_Boolean_Operator (N); elsif Is_Boolean_Type (Etype (N)) then - Adjust_Condition (Left_Opnd (N)); - Adjust_Condition (Right_Opnd (N)); - Set_Etype (N, Standard_Boolean); - Adjust_Result_Type (N, Typ); + + -- Replace OR by OR ELSE if Short_Circuit_And_Or active and the + -- type is standard Boolean (do not mess with AND that uses a non- + -- standard Boolean type, because something strange is going on). + + if Short_Circuit_And_Or and then Typ = Standard_Boolean then + Rewrite (N, + Make_Or_Else (Sloc (N), + Left_Opnd => Relocate_Node (Left_Opnd (N)), + Right_Opnd => Relocate_Node (Right_Opnd (N)))); + Analyze_And_Resolve (N, Typ); + + -- Otherwise, adjust conditions + + else + Adjust_Condition (Left_Opnd (N)); + Adjust_Condition (Right_Opnd (N)); + Set_Etype (N, Standard_Boolean); + Adjust_Result_Type (N, Typ); + end if; end if; end Expand_N_Op_Or; |