diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-07-13 10:39:28 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-07-13 10:39:28 +0200 |
commit | 019578498e189c256e1238fe7d981fb02740a71a (patch) | |
tree | 164176c7f48023bea63ede90147c01010044b3fa /gcc/ada/g-calend.adb | |
parent | 79afa047b2dd7cd699600ade0275d5392cfc3e03 (diff) | |
download | gcc-019578498e189c256e1238fe7d981fb02740a71a.tar.gz |
[multiple changes]
2009-07-13 Robert Dewar <dewar@adacore.com>
* gnat_ugn.texi: The gnatf switch no longer is needed to get full
details on unsupported constructs.
* rtsfind.adb: Remove references to All_Errors_Mode, give errors
unconditionally.
* s-trafor-default.adb: Correct some warnings
* s-valwch.adb, a-calend.adb, freeze.adb, prj.ads, s-vmexta.adb,
sem.adb, sem_ch10.adb, sem_ch6.adb, sem_disp.adb, vxaddr2line.adb:
Minor reformatting.
* par-ch4.adb (Conditional_Expression): Capture proper location for
conditional expression, should point to IF.
* s-tassta.adb, a-wtdeau.adb, s-tasren.adb, s-arit64.adb, s-imgdec.adb,
s-direio.adb, s-tpobop.adb, g-socket.adb, s-tposen.adb, s-taskin.adb,
g-calend.adb, s-regpat.adb, s-scaval.adb, g-catiio.adb: Minor code
reorganization (use conditional expressions).
2009-07-13 Ed Schonberg <schonberg@adacore.com>
* exp_util.adb (Remove_Side_Effects): If the expression is a call to a
build-in-place function that returns an inherently limited type (not
just a task type) create proper object declaration so that extra
build-in-place actuals are properly added to the call.
From-SVN: r149551
Diffstat (limited to 'gcc/ada/g-calend.adb')
-rw-r--r-- | gcc/ada/g-calend.adb | 46 |
1 files changed, 13 insertions, 33 deletions
diff --git a/gcc/ada/g-calend.adb b/gcc/ada/g-calend.adb index 8ccd4337b61..46d647f8af3 100644 --- a/gcc/ada/g-calend.adb +++ b/gcc/ada/g-calend.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1999-2008, AdaCore -- +-- Copyright (C) 1999-2009, AdaCore -- -- -- -- GNAT 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- -- @@ -182,12 +182,7 @@ package body GNAT.Calendar is begin Split (Date, Year, Month, Day, Day_Secs); - if Day_Secs = 0.0 then - Secs := 0; - else - Secs := Natural (Day_Secs - 0.5); - end if; - + Secs := (if Day_Secs = 0.0 then 0 else Natural (Day_Secs - 0.5)); Sub_Second := Second_Duration (Day_Secs - Day_Duration (Secs)); Hour := Hour_Number (Secs / 3_600); Secs := Secs mod 3_600; @@ -370,18 +365,9 @@ package body GNAT.Calendar is begin if Last_Year then - if Is_Leap (Year - 1) then - Shift := -2; - else - Shift := -1; - end if; - + Shift := (if Is_Leap (Year - 1) then -2 else -1); elsif Next_Year then - if Is_Leap (Year) then - Shift := 2; - else - Shift := 1; - end if; + Shift := (if Is_Leap (Year) then 2 else 1); end if; return Day_Name'Val ((Day_Name'Pos (Jan_1) + Shift) mod 7); @@ -452,11 +438,11 @@ package body GNAT.Calendar is -- when special casing the first week of January and the last week of -- December. - if Day = 1 and then Month = 1 then - Jan_1 := Day_Of_Week (Date); - else - Jan_1 := Day_Of_Week (Time_Of (Year, 1, 1, 0.0)); - end if; + Jan_1 := Day_Of_Week (if Day = 1 and then Month = 1 + then Date + else (Time_Of (Year, 1, 1, 0.0))); + + -- Special cases for January if Month = 1 then @@ -479,11 +465,7 @@ package body GNAT.Calendar is or else (Day = 3 and then Jan_1 = Friday) then - if Last_Year_Has_53_Weeks (Jan_1, Year) then - Week := 53; - else - Week := 52; - end if; + Week := (if Last_Year_Has_53_Weeks (Jan_1, Year) then 53 else 52); -- January 1, 2 and 3 belong to the previous year @@ -516,6 +498,8 @@ package body GNAT.Calendar is return; end if; + -- Month other than 1 + -- Special case 3: December 29, 30 and 31. These days may belong to -- next year's first week. @@ -551,11 +535,7 @@ package body GNAT.Calendar is -- not belong to the first week of the input year, then the next week -- is the first week. - if Jan_1 in Friday .. Sunday then - Start_Week := 1; - else - Start_Week := 2; - end if; + Start_Week := (if Jan_1 in Friday .. Sunday then 1 else 2); -- At this point all special combinations have been accounted for and -- the proper start week has been found. Since January 1 may not fall |