+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
-----------------
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;
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. */
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);
-- 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
-- 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
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