aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ada/ChangeLog21
-rw-r--r--gcc/ada/a-calend.adb71
-rw-r--r--gcc/ada/init.c8
-rw-r--r--gcc/ada/put_scos.adb25
-rw-r--r--gcc/ada/scos.ads4
-rw-r--r--gcc/ada/sem_prag.adb6
6 files changed, 69 insertions, 66 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 532d8dc..b30003b 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,24 @@
+2009-11-30 Thomas Quinot <quinot@adacore.com>
+
+ * put_scos.adb (Put_SCOs): Do not generate a SCO unit header for a unit
+ that has no SCOs.
+ * scos.ads: Minor reformatting
+
+2009-11-30 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_prag.adb: Second unanalyzed parameter of Annotate is optional.
+
+2009-11-30 Eric Botcazou <ebotcazou@adacore.com>
+
+ * init.c (__gnat_adjust_context_for_raise, Linux version): Add guard
+ for null PC saved in the context.
+
+2009-11-30 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * a-calend.adb (Day_Of_Week): Rewritten. The routine determines the
+ number of days from the Ada Epoch to the input date while ensuring that
+ both dates are in the same time zone.
+
2009-11-30 Emmanuel Briot <briot@adacore.com>
* clean.adb ("-eL"): Also set Follow_Links_For_Dirs, to match what is
diff --git a/gcc/ada/a-calend.adb b/gcc/ada/a-calend.adb
index 1a49c58..dd500f4 100644
--- a/gcc/ada/a-calend.adb
+++ b/gcc/ada/a-calend.adb
@@ -1029,63 +1029,40 @@ package body Ada.Calendar is
-----------------
function Day_Of_Week (Date : Time) return Integer is
- Y : Year_Number;
- Mo : Month_Number;
- D : Day_Number;
- Ds : Day_Duration;
- H : Integer;
- Mi : Integer;
- Se : Integer;
- Su : Duration;
- Le : Boolean;
-
- pragma Unreferenced (Ds, H, Mi, Se, Su, Le);
+ Date_N : constant Time_Rep := Time_Rep (Date);
+ Time_Zone : constant Long_Integer :=
+ Time_Zones_Operations.UTC_Time_Offset (Date);
+ Ada_Low_N : Time_Rep;
Day_Count : Long_Integer;
- Res_Dur : Time_Dur;
- Res_N : Time_Rep;
+ Day_Dur : Time_Dur;
+ High_N : Time_Rep;
+ Low_N : Time_Rep;
begin
- Formatting_Operations.Split
- (Date => Date,
- Year => Y,
- Month => Mo,
- Day => D,
- Day_Secs => Ds,
- Hour => H,
- Minute => Mi,
- Second => Se,
- Sub_Sec => Su,
- Leap_Sec => Le,
- Is_Ada_05 => True,
- Time_Zone => 0);
-
- -- Build a time value in the middle of the same day
-
- Res_N :=
- Time_Rep
- (Formatting_Operations.Time_Of
- (Year => Y,
- Month => Mo,
- Day => D,
- Day_Secs => 0.0,
- Hour => 12,
- Minute => 0,
- Second => 0,
- Sub_Sec => 0.0,
- Leap_Sec => False,
- Use_Day_Secs => False,
- Is_Ada_05 => True,
- Time_Zone => 0));
+ -- As declared, the Ada Epoch is set in UTC. For this calculation to
+ -- work properly, both the Epoch and the input date must be in the
+ -- same time zone. The following places the Epoch in the input date's
+ -- time zone.
+
+ Ada_Low_N := Ada_Low - Time_Rep (Time_Zone) * Nano;
+
+ if Date_N > Ada_Low_N then
+ High_N := Date_N;
+ Low_N := Ada_Low_N;
+ else
+ High_N := Ada_Low_N;
+ Low_N := Date_N;
+ end if;
-- Determine the elapsed seconds since the start of Ada time
- Res_Dur := Time_Dur (Res_N / Nano - Ada_Low / Nano);
+ Day_Dur := Time_Dur (High_N / Nano - Low_N / Nano);
- -- Count the number of days since the start of Ada time. 1901-1-1
+ -- Count the number of days since the start of Ada time. 1901-01-01
-- GMT was a Tuesday.
- Day_Count := Long_Integer (Res_Dur / Secs_In_Day) + 1;
+ Day_Count := Long_Integer (Day_Dur / Secs_In_Day) + 1;
return Integer (Day_Count mod 7);
end Day_Of_Week;
diff --git a/gcc/ada/init.c b/gcc/ada/init.c
index a8be23d..5e5d1c6 100644
--- a/gcc/ada/init.c
+++ b/gcc/ada/init.c
@@ -601,14 +601,14 @@ __gnat_adjust_context_for_raise (int signo ATTRIBUTE_UNUSED, void *ucontext)
time this happens. */
#if defined (i386)
- unsigned long pattern = *(unsigned long *)mcontext->gregs[REG_EIP];
+ unsigned long *pc = (unsigned long *)mcontext->gregs[REG_EIP];
/* The pattern is "orl $0x0,(%esp)" for a probe in 32-bit mode. */
- if (signo == SIGSEGV && pattern == 0x00240c83)
+ if (signo == SIGSEGV && pc && *pc == 0x00240c83)
mcontext->gregs[REG_ESP] += 4096 + 4 * sizeof (unsigned long);
#elif defined (__x86_64__)
- unsigned long pattern = *(unsigned long *)mcontext->gregs[REG_RIP];
+ unsigned long *pc = (unsigned long *)mcontext->gregs[REG_RIP];
/* The pattern is "orq $0x0,(%rsp)" for a probe in 64-bit mode. */
- if (signo == SIGSEGV && (pattern & 0xffffffffff) == 0x00240c8348)
+ if (signo == SIGSEGV && pc && (*pc & 0xffffffffff) == 0x00240c8348)
mcontext->gregs[REG_RSP] += 4096 + 4 * sizeof (unsigned long);
#elif defined (__ia64__)
/* ??? The IA-64 unwinder doesn't compensate for signals. */
diff --git a/gcc/ada/put_scos.adb b/gcc/ada/put_scos.adb
index d7667b8..bca3f69 100644
--- a/gcc/ada/put_scos.adb
+++ b/gcc/ada/put_scos.adb
@@ -37,21 +37,26 @@ begin
Stop : Nat;
begin
- Write_Info_Initiate ('C');
- Write_Info_Char (' ');
- Write_Info_Nat (SUT.Dep_Num);
- Write_Info_Char (' ');
+ Start := SUT.From;
+ Stop := SUT.To;
- for N in SUT.File_Name'Range loop
- Write_Info_Char (SUT.File_Name (N));
- end loop;
+ -- Write unit header (omitted if no SCOs are generated for this unit)
+
+ if Start <= Stop then
+ Write_Info_Initiate ('C');
+ Write_Info_Char (' ');
+ Write_Info_Nat (SUT.Dep_Num);
+ Write_Info_Char (' ');
- Write_Info_Terminate;
+ for N in SUT.File_Name'Range loop
+ Write_Info_Char (SUT.File_Name (N));
+ end loop;
+
+ Write_Info_Terminate;
+ end if;
-- Loop through SCO entries for this unit
- Start := SUT.From;
- Stop := SUT.To;
loop
exit when Start = Stop + 1;
pragma Assert (Start <= Stop);
diff --git a/gcc/ada/scos.ads b/gcc/ada/scos.ads
index c58545f..153bf5d 100644
--- a/gcc/ada/scos.ads
+++ b/gcc/ada/scos.ads
@@ -54,7 +54,7 @@ package SCOs is
-- Source coverage obligations are generated on a unit-by-unit basis in the
-- ALI file, using lines that start with the identifying character C. These
- -- lines are generated if the -gnatC switch is set.
+ -- lines are generated if the -gnateS switch is set.
-- Sloc Ranges
@@ -75,7 +75,7 @@ package SCOs is
-- is divided into sections, one section for each unit for which SCO's
-- are generated. A SCO section has a header of the form:
- -- C dependency-number filename
+ -- C dependency-number filename
-- This header precedes SCO information for the unit identified by
-- dependency number and file name. The dependency number is the
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 9e9df30..2aa6c2e 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -5228,10 +5228,10 @@ package body Sem_Prag is
Exp : Node_Id;
begin
- if No (Arg2) then
- Error_Pragma_Arg
- ("pragma requires at least two arguments", Arg1);
+ -- Second unanalyzed parameter is optional.
+ if No (Arg2) then
+ null;
else
Arg := Next (Arg2);
while Present (Arg) loop