summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-08-17 10:09:55 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-08-17 10:09:55 +0000
commite2c9a0153d4c7bde3f380ec853788b7147684da0 (patch)
tree413a1ca4724e02b6fd1f64e1fe14e1d496bbffa8 /gcc
parent447e605f4566b27ff6da22c7dca9671073f49508 (diff)
downloadgcc-e2c9a0153d4c7bde3f380ec853788b7147684da0.tar.gz
2009-08-17 Robert Dewar <dewar@adacore.com>
* 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). git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150834 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/a-caldel-vms.adb11
-rw-r--r--gcc/ada/a-calend-vms.adb15
-rw-r--r--gcc/ada/a-calfor.adb19
-rw-r--r--gcc/ada/a-cdlili.adb10
-rw-r--r--gcc/ada/a-chahan.adb13
-rw-r--r--gcc/ada/a-cidlli.adb10
-rw-r--r--gcc/ada/a-coinve.adb12
-rw-r--r--gcc/ada/a-comlin.adb5
9 files changed, 29 insertions, 72 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 5a17cdbe2be..2107917f803 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,11 @@
2009-08-17 Robert Dewar <dewar@adacore.com>
+ * 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 <dewar@adacore.com>
+
* make.adb: Add ??? comment
* tbuild.adb: Minor reformatting
diff --git a/gcc/ada/a-caldel-vms.adb b/gcc/ada/a-caldel-vms.adb
index 8b7715744d6..128918a9ac6 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 374ea715ff6..3daf4e0c185 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 10e9617022c..b8e6222475d 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 c0fae213a4f..f9d7db832da 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 e6a93617857..61419b090ee 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 510b7707b09..0d01502e05d 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 ffa2d1b4e2b..9169e086ebd 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 2b6c32e104f..b29693638d6 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;