diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-05-15 11:44:53 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-05-15 11:44:53 +0200 |
commit | 5277d0b7109e67d3dd582f5b832723ed8e008cb1 (patch) | |
tree | e07c7f61f1320e6afd3773609fb222507665b4f3 | |
parent | e4f422b8afeaed39fbc0ad5f6735739489f57d10 (diff) | |
download | gcc-5277d0b7109e67d3dd582f5b832723ed8e008cb1.zip gcc-5277d0b7109e67d3dd582f5b832723ed8e008cb1.tar.gz gcc-5277d0b7109e67d3dd582f5b832723ed8e008cb1.tar.bz2 |
[multiple changes]
2012-05-15 Hristian Kirtchev <kirtchev@adacore.com>
* g-calend.adb (Split_At_Locale): New routine.
(Time_Of_At_Locale): New routine.
* g-calend.ads (Split_At_Locale): New routine.
(Time_Of_At_Locale): New routine.
2012-05-15 Gary Dismukes <dismukes@adacore.com>
* a-except.ads: Minor reformatting.
2012-05-15 Ed Schonberg <schonberg@adacore.com>
* sem_ch5.adb (Analyze_Loop_Parameter_Specification): If the loop
parameter specification is part of a quantified expression, and it
already carries a type, do not repeat the analysis to preserve
type information: a range attribute reference may have been
rewritten as a range with static bounds, and its re-analysis may
type it as Integer by default, instead of the original index type.
2012-05-15 Robert Dewar <dewar@adacore.com>
* s-osprim-mingw.adb: Minor reformatting.
From-SVN: r187512
-rw-r--r-- | gcc/ada/ChangeLog | 26 | ||||
-rw-r--r-- | gcc/ada/a-except.ads | 2 | ||||
-rw-r--r-- | gcc/ada/g-calend.adb | 108 | ||||
-rw-r--r-- | gcc/ada/g-calend.ads | 39 | ||||
-rw-r--r-- | gcc/ada/impunit.adb | 1 | ||||
-rw-r--r-- | gcc/ada/s-osprim-mingw.adb | 2 | ||||
-rw-r--r-- | gcc/ada/sem_ch5.adb | 15 |
7 files changed, 183 insertions, 10 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 8d5355f..8f936b6 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,27 @@ +2012-05-15 Hristian Kirtchev <kirtchev@adacore.com> + + * g-calend.adb (Split_At_Locale): New routine. + (Time_Of_At_Locale): New routine. + * g-calend.ads (Split_At_Locale): New routine. + (Time_Of_At_Locale): New routine. + +2012-05-15 Gary Dismukes <dismukes@adacore.com> + + * a-except.ads: Minor reformatting. + +2012-05-15 Ed Schonberg <schonberg@adacore.com> + + * sem_ch5.adb (Analyze_Loop_Parameter_Specification): If the loop + parameter specification is part of a quantified expression, and it + already carries a type, do not repeat the analysis to preserve + type information: a range attribute reference may have been + rewritten as a range with static bounds, and its re-analysis may + type it as Integer by default, instead of the original index type. + +2012-05-15 Robert Dewar <dewar@adacore.com> + + * s-osprim-mingw.adb: Minor reformatting. + 2012-05-15 Arnaud Charlet <charlet@adacore.com> * a-except.adb, a-except.ads (Reraise_Library_Exception_If_Any): New. @@ -132,8 +156,6 @@ * a-calfor.adb (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. - * impunit.adb: Include g-calloc to the list of non-RM defined - units. 2012-05-15 Vincent Celier <celier@adacore.com> diff --git a/gcc/ada/a-except.ads b/gcc/ada/a-except.ads index a77df93..0561fb7 100644 --- a/gcc/ada/a-except.ads +++ b/gcc/ada/a-except.ads @@ -35,7 +35,7 @@ -- This version of Ada.Exceptions is a full Ada 95 version. It omits Ada 2005 -- features such as the additional definitions of Exception_Name returning --- Wide_[Wide_]String. If differs from the 95 version only in that it is +-- Wide_[Wide_]String. It differs from the Ada 95 version only in that it is -- declared Preelaborate (see declaration below for why this is done). -- It is used for building the compiler and the basic tools, since these diff --git a/gcc/ada/g-calend.adb b/gcc/ada/g-calend.adb index 2e9f1cc..3b731e1 100644 --- a/gcc/ada/g-calend.adb +++ b/gcc/ada/g-calend.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1999-2010, AdaCore -- +-- Copyright (C) 1999-2012, 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- -- @@ -188,6 +188,61 @@ package body GNAT.Calendar is Second := Second_Number (Secs mod 60); end Split; + --------------------- + -- Split_At_Locale -- + --------------------- + + procedure Split_At_Locale + (Date : Time; + Year : out Year_Number; + Month : out Month_Number; + Day : out Day_Number; + Hour : out Hour_Number; + Minute : out Minute_Number; + Second : out Second_Number; + Sub_Second : out Second_Duration) + is + procedure Ada_Calendar_Split + (Date : Time; + Year : out Year_Number; + Month : out Month_Number; + Day : out Day_Number; + Day_Secs : out Day_Duration; + Hour : out Integer; + Minute : out Integer; + Second : out Integer; + Sub_Sec : out Duration; + Leap_Sec : out Boolean; + Use_TZ : Boolean; + Is_Historic : Boolean; + Time_Zone : Long_Integer); + pragma Import (Ada, Ada_Calendar_Split, "__gnat_split"); + + Ds : Day_Duration; + Le : Boolean; + + pragma Unreferenced (Ds, Le); + + begin + -- Even though the input time zone is UTC (0), the flag Use_TZ will + -- ensure that Split picks up the local time zone. + + Ada_Calendar_Split + (Date => Date, + Year => Year, + Month => Month, + Day => Day, + Day_Secs => Ds, + Hour => Hour, + Minute => Minute, + Second => Second, + Sub_Sec => Sub_Second, + Leap_Sec => Le, + Use_TZ => False, + Is_Historic => False, + Time_Zone => 0); + end Split_At_Locale; + ---------------- -- Sub_Second -- ---------------- @@ -219,7 +274,6 @@ package body GNAT.Calendar is Second : Second_Number; Sub_Second : Second_Duration := 0.0) return Time is - Day_Secs : constant Day_Duration := Day_Duration (Hour * 3_600) + Day_Duration (Minute * 60) + @@ -229,6 +283,56 @@ package body GNAT.Calendar is return Time_Of (Year, Month, Day, Day_Secs); end Time_Of; + ----------------------- + -- Time_Of_At_Locale -- + ----------------------- + + function Time_Of_At_Locale + (Year : Year_Number; + Month : Month_Number; + Day : Day_Number; + Hour : Hour_Number; + Minute : Minute_Number; + Second : Second_Number; + Sub_Second : Second_Duration := 0.0) return Time + is + function Ada_Calendar_Time_Of + (Year : Year_Number; + Month : Month_Number; + Day : Day_Number; + Day_Secs : Day_Duration; + Hour : Integer; + Minute : Integer; + Second : Integer; + Sub_Sec : Duration; + Leap_Sec : Boolean; + Use_Day_Secs : Boolean; + Use_TZ : Boolean; + Is_Historic : Boolean; + Time_Zone : Long_Integer) return Time; + pragma Import (Ada, Ada_Calendar_Time_Of, "__gnat_time_of"); + + begin + -- Even though the input time zone is UTC (0), the flag Use_TZ will + -- ensure that Split picks up the local time zone. + + return + Ada_Calendar_Time_Of + (Year => Year, + Month => Month, + Day => Day, + Day_Secs => 0.0, + Hour => Hour, + Minute => Minute, + Second => Second, + Sub_Sec => Sub_Second, + Leap_Sec => False, + Use_Day_Secs => False, + Use_TZ => False, + Is_Historic => False, + Time_Zone => 0); + end Time_Of_At_Locale; + ----------------- -- To_Duration -- ----------------- diff --git a/gcc/ada/g-calend.ads b/gcc/ada/g-calend.ads index 9dd5ae0..b1c5a40 100644 --- a/gcc/ada/g-calend.ads +++ b/gcc/ada/g-calend.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1999-2010, Free Software Foundation, Inc. -- +-- Copyright (C) 1999-2012, Free Software Foundation, Inc. -- -- -- -- 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- -- @@ -83,8 +83,25 @@ package GNAT.Calendar is Minute : out Minute_Number; Second : out Second_Number; Sub_Second : out Second_Duration); - -- Split the standard Ada.Calendar.Time data in date data (Year, Month, - -- Day) and Time data (Hour, Minute, Second, Sub_Second) + -- Split a standard Ada.Calendar.Time value in date data (Year, Month, Day) + -- and Time data (Hour, Minute, Second, Sub_Second). + + procedure Split_At_Locale + (Date : Ada.Calendar.Time; + Year : out Ada.Calendar.Year_Number; + Month : out Ada.Calendar.Month_Number; + Day : out Ada.Calendar.Day_Number; + Hour : out Hour_Number; + Minute : out Minute_Number; + Second : out Second_Number; + Sub_Second : out Second_Duration); + -- Split a standard Ada.Calendar.Time value in date data (Year, Month, Day) + -- and Time data (Hour, Minute, Second, Sub_Second). This version of Split + -- utilizes the time zone and DST bias of the locale (equivalent to Clock). + -- Due to this simplified behavior, the implementation does not require + -- expensive system calls on targets such as Windows. + -- WARNING: Split_At_Locale is no longer aware of historic events and may + -- produce inaccurate results over DST changes which occurred in the past. function Time_Of (Year : Ada.Calendar.Year_Number; @@ -96,6 +113,22 @@ package GNAT.Calendar is Sub_Second : Second_Duration := 0.0) return Ada.Calendar.Time; -- Return an Ada.Calendar.Time data built from the date and time values + function Time_Of_At_Locale + (Year : Ada.Calendar.Year_Number; + Month : Ada.Calendar.Month_Number; + Day : Ada.Calendar.Day_Number; + Hour : Hour_Number; + Minute : Minute_Number; + Second : Second_Number; + Sub_Second : Second_Duration := 0.0) return Ada.Calendar.Time; + -- Return an Ada.Calendar.Time data built from the date and time values. + -- This version of Time_Of utilizes the time zone and DST bias of the + -- locale (equivalent to Clock). Due to this simplified behavior, the + -- implementation does not require expensive system calls on targets such + -- as Windows. + -- WARNING: Split_At_Locale is no longer aware of historic events and may + -- produce inaccurate results over DST changes which occurred in the past. + function Week_In_Year (Date : Ada.Calendar.Time) return Week_In_Year_Number; -- Return the week number as defined in ISO 8601. A week always starts on -- a Monday and the first week of a particular year is the one containing diff --git a/gcc/ada/impunit.adb b/gcc/ada/impunit.adb index 30ec793..99d0c27 100644 --- a/gcc/ada/impunit.adb +++ b/gcc/ada/impunit.adb @@ -246,7 +246,6 @@ package body Impunit is ("g-byorma", F), -- GNAT.Byte_Order_Mark ("g-bytswa", F), -- GNAT.Byte_Swapping ("g-calend", F), -- GNAT.Calendar - ("g-calloc", F), -- GNAT.Calendar.Locale ("g-catiio", F), -- GNAT.Calendar.Time_IO ("g-casuti", F), -- GNAT.Case_Util ("g-cgi ", F), -- GNAT.CGI diff --git a/gcc/ada/s-osprim-mingw.adb b/gcc/ada/s-osprim-mingw.adb index bb1108a..931d012 100644 --- a/gcc/ada/s-osprim-mingw.adb +++ b/gcc/ada/s-osprim-mingw.adb @@ -236,9 +236,11 @@ package body System.OS_Primitives is function Monotonic_Clock return Duration is Current_Ticks : aliased LARGE_INTEGER; Elap_Secs_Tick : Duration; + begin if QueryPerformanceCounter (Current_Ticks'Access) = Win32.FALSE then return 0.0; + else Elap_Secs_Tick := Duration (Long_Long_Float (Current_Ticks - BMTA.all) / diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb index aedb973..ba94d77 100644 --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -2267,7 +2267,20 @@ package body Sem_Ch5 is -- free. else - Analyze (DS); + -- A quantified expression that appears in a pre/post condition + -- is pre-analyzed several times. If the range is given by an + -- attribute reference it is rewritten as a range, and this is + -- done even with expansion disabled. If the type is already set + -- do not reanalyze, because a range with static bounds may be + -- typed Integer by default. + + if Nkind (Parent (N)) = N_Quantified_Expression + and then Present (Etype (DS)) + then + null; + else + Analyze (DS); + end if; end if; end if; |