From: Robert Dewar Date: Mon, 17 Aug 2009 10:09:55 +0000 (+0000) Subject: a-caldel-vms.adb, [...]: Minor code reorganization (use conditional expressions). X-Git-Tag: releases/gcc-4.5.0~3978 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1d5a85bd838e6d42ca7315c3980b4f6d99f217a5;p=thirdparty%2Fgcc.git a-caldel-vms.adb, [...]: Minor code reorganization (use conditional expressions). 2009-08-17 Robert Dewar * a-caldel-vms.adb, a-calend-vms.adb, a-calfor.adb, a-cdlili.adb, a-chahan.adb, a-cidlli.adb, a-coinve.adb, a-comlin.adb: Minor code reorganization (use conditional expressions). From-SVN: r150834 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 5a17cdbe2bee..2107917f803e 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2009-08-17 Robert Dewar + + * a-caldel-vms.adb, a-calend-vms.adb, a-calfor.adb, a-cdlili.adb, + a-chahan.adb, a-cidlli.adb, a-coinve.adb, a-comlin.adb: Minor code + reorganization (use conditional expressions). + 2009-08-17 Robert Dewar * make.adb: Add ??? comment diff --git a/gcc/ada/a-caldel-vms.adb b/gcc/ada/a-caldel-vms.adb index 8b7715744d6a..128918a9ac62 100644 --- a/gcc/ada/a-caldel-vms.adb +++ b/gcc/ada/a-caldel-vms.adb @@ -7,7 +7,7 @@ -- B o d y -- -- -- -- Copyright (C) 1991-1994, Florida State University -- --- Copyright (C) 1995-2008, AdaCore -- +-- Copyright (C) 1995-2009, AdaCore -- -- -- -- GNARL 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- -- @@ -79,15 +79,10 @@ package body Ada.Calendar.Delays is -- A value distant enough to emulate "end of time" but which does not -- cause overflow. - Safe_T : Time; + Safe_T : constant Time := + (if T > Safe_Ada_High then Safe_Ada_High else T); begin - if T > Safe_Ada_High then - Safe_T := Safe_Ada_High; - else - Safe_T := T; - end if; - return OSP.To_Duration (OSP.OS_Time (Safe_T), OSP.Absolute_Calendar); end To_Duration; diff --git a/gcc/ada/a-calend-vms.adb b/gcc/ada/a-calend-vms.adb index 374ea715ff62..3daf4e0c185c 100644 --- a/gcc/ada/a-calend-vms.adb +++ b/gcc/ada/a-calend-vms.adb @@ -921,11 +921,7 @@ package body Ada.Calendar is -- Step 3: Handle leap second occurrences - if Leap_Sec then - tm_sec := 60; - else - tm_sec := Second; - end if; + tm_Sec := (if Leap_Sec then 60 else Second); end To_Struct_Tm; ------------------ @@ -1195,11 +1191,10 @@ package body Ada.Calendar is else -- Sub second extraction - if Day_Secs > 0.0 then - Int_Day_Secs := Integer (Day_Secs - 0.5); - else - Int_Day_Secs := Integer (Day_Secs); - end if; + Int_Day_Secs := + (if Day_Secs > 0.0 + then Integer (Day_Secs - 0.5) + else Integer (Day_Secs)); H := Int_Day_Secs / 3_600; Mi := (Int_Day_Secs / 60) mod 60; diff --git a/gcc/ada/a-calfor.adb b/gcc/ada/a-calfor.adb index 10e9617022c4..b8e6222475da 100644 --- a/gcc/ada/a-calfor.adb +++ b/gcc/ada/a-calfor.adb @@ -156,17 +156,8 @@ package body Ada.Calendar.Formatting is -- Determine the two slice bounds for the result string depending on -- whether the input is negative and whether fractions are requested. - if Elapsed_Time < 0.0 then - Low := 1; - else - Low := 2; - end if; - - if Include_Time_Fraction then - High := 12; - else - High := 9; - end if; + Low := (if Elapsed_Time < 0.0 then 1 else 2); + High := (if Include_Time_Fraction then 12 else 9); -- Prevent rounding when converting to natural @@ -457,11 +448,7 @@ package body Ada.Calendar.Formatting is raise Constraint_Error; end if; - if Seconds = 0.0 then - Secs := 0; - else - Secs := Natural (Seconds - 0.5); - end if; + Secs := (if Seconds = 0.0 then 0 else Natural (Seconds - 0.5)); Sub_Second := Second_Duration (Seconds - Day_Duration (Secs)); Hour := Hour_Number (Secs / 3_600); diff --git a/gcc/ada/a-cdlili.adb b/gcc/ada/a-cdlili.adb index c0fae213a4fc..f9d7db832da1 100644 --- a/gcc/ada/a-cdlili.adb +++ b/gcc/ada/a-cdlili.adb @@ -561,15 +561,9 @@ package body Ada.Containers.Doubly_Linked_Lists is ---------- procedure Sort (Front, Back : Node_Access) is - Pivot : Node_Access; - + Pivot : constant Node_Access := + (if Front = null then Container.First else Front.Next); begin - if Front = null then - Pivot := Container.First; - else - Pivot := Front.Next; - end if; - if Pivot /= Back then Partition (Pivot, Back); Sort (Front, Pivot); diff --git a/gcc/ada/a-chahan.adb b/gcc/ada/a-chahan.adb index e6a936178575..61419b090ee8 100644 --- a/gcc/ada/a-chahan.adb +++ b/gcc/ada/a-chahan.adb @@ -457,11 +457,7 @@ package body Ada.Characters.Handling is Substitute : ISO_646 := ' ') return ISO_646 is begin - if Item in ISO_646 then - return Item; - else - return Substitute; - end if; + return (if Item in ISO_646 then Item else Substitute); end To_ISO_646; function To_ISO_646 @@ -472,11 +468,8 @@ package body Ada.Characters.Handling is begin for J in Item'Range loop - if Item (J) in ISO_646 then - Result (J - (Item'First - 1)) := Item (J); - else - Result (J - (Item'First - 1)) := Substitute; - end if; + Result (J - (Item'First - 1)) := + (if Item (J) in ISO_646 then Item (J) else Substitute); end loop; return Result; diff --git a/gcc/ada/a-cidlli.adb b/gcc/ada/a-cidlli.adb index 510b7707b09a..0d01502e05dc 100644 --- a/gcc/ada/a-cidlli.adb +++ b/gcc/ada/a-cidlli.adb @@ -605,15 +605,9 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is ---------- procedure Sort (Front, Back : Node_Access) is - Pivot : Node_Access; - + Pivot : constant Node_Access := + (if Front = null then Container.First else Front.Next); begin - if Front = null then - Pivot := Container.First; - else - Pivot := Front.Next; - end if; - if Pivot /= Back then Partition (Pivot, Back); Sort (Front, Pivot); diff --git a/gcc/ada/a-coinve.adb b/gcc/ada/a-coinve.adb index ffa2d1b4e2b6..9169e086ebdf 100644 --- a/gcc/ada/a-coinve.adb +++ b/gcc/ada/a-coinve.adb @@ -1171,7 +1171,6 @@ package body Ada.Containers.Indefinite_Vectors is and then Index_Type'Last >= 0 then CC := UInt (Index_Type'Last) + UInt (-Index_Type'First) + 1; - else CC := UInt (Int (Index_Type'Last) - First + 1); end if; @@ -1610,7 +1609,6 @@ package body Ada.Containers.Indefinite_Vectors is and then Index_Type'Last >= 0 then CC := UInt (Index_Type'Last) + UInt (-Index_Type'First) + 1; - else CC := UInt (Int (Index_Type'Last) - First + 1); end if; @@ -2283,15 +2281,9 @@ package body Ada.Containers.Indefinite_Vectors is Item : Element_Type; Index : Index_Type := Index_Type'Last) return Extended_Index is - Last : Index_Type'Base; - + Last : constant Index_Type'Base := + (if Index > Container.Last then Container.Last else Index); begin - if Index > Container.Last then - Last := Container.Last; - else - Last := Index; - end if; - for Indx in reverse Index_Type'First .. Last loop if Container.Elements.EA (Indx) /= null and then Container.Elements.EA (Indx).all = Item diff --git a/gcc/ada/a-comlin.adb b/gcc/ada/a-comlin.adb index 2b6c32e104f3..b29693638d6e 100644 --- a/gcc/ada/a-comlin.adb +++ b/gcc/ada/a-comlin.adb @@ -29,7 +29,9 @@ -- -- ------------------------------------------------------------------------------ -with System; use System; +pragma Compiler_Unit; + +with System; use System; package body Ada.Command_Line is @@ -71,7 +73,6 @@ package body Ada.Command_Line is declare Arg : aliased String (1 .. Len_Arg (Num)); - begin Fill_Arg (Arg'Address, Num); return Arg;