From 4c833ed80f42d8bd844683efc9f0135f2377fae3 Mon Sep 17 00:00:00 2001 From: charlet Date: Fri, 16 Oct 2015 13:28:39 +0000 Subject: Code clean up. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@228903 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 3 ++- gcc/ada/a-extiin.ads | 4 ++-- gcc/ada/s-osinte-android.adb | 47 +------------------------------------------- gcc/ada/s-osinte-android.ads | 6 +++--- 4 files changed, 8 insertions(+), 52 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index c62e7a21d1a..9c0689623cb 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -12,7 +12,8 @@ * s-taprop-linux.adb (Monotonic_Clock): Call clock_gettime instead of gettimeofday. - * s-osinte-linux.ads (clock_gettime): New imported subprogram. + * s-osinte-android.ads, s-osinte-android.adb, s-osinte-linux.ads + (clock_gettime): New imported subprogram. 2015-10-16 Hristian Kirtchev diff --git a/gcc/ada/a-extiin.ads b/gcc/ada/a-extiin.ads index 9677c580edd..0105a4c88ff 100644 --- a/gcc/ada/a-extiin.ads +++ b/gcc/ada/a-extiin.ads @@ -19,8 +19,8 @@ package Ada.Execution_Time.Interrupts is pragma Unimplemented_Unit; - function Clock (Interrupt : Ada.Interrupts.Interrupt_Id) return CPU_Time; + function Clock (Interrupt : Ada.Interrupts.Interrupt_ID) return CPU_Time; - function Supported (Interrupt : Ada.Interrupts.Interrupt_Id) return Boolean; + function Supported (Interrupt : Ada.Interrupts.Interrupt_ID) return Boolean; end Ada.Execution_Time.Interrupts; diff --git a/gcc/ada/s-osinte-android.adb b/gcc/ada/s-osinte-android.adb index 3b89e777a17..81103ee78d1 100644 --- a/gcc/ada/s-osinte-android.adb +++ b/gcc/ada/s-osinte-android.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1995-2014, AdaCore -- +-- Copyright (C) 1995-2015, 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- -- @@ -39,7 +39,6 @@ pragma Polling (Off); -- that are needed by children of System. with Interfaces.C; use Interfaces.C; -with Interfaces.C.Extensions; use Interfaces.C.Extensions; package body System.OS_Interface is @@ -76,48 +75,4 @@ package body System.OS_Interface is tv_nsec => long (Long_Long_Integer (F * 10#1#E9))); end To_Timespec; - ------------------- - -- clock_gettime -- - ------------------- - - function clock_gettime - (clock_id : clockid_t; - tp : access timespec) return int - is - pragma Unreferenced (clock_id); - - -- Android/Linux don't have clock_gettime, so use gettimeofday - - use Interfaces; - - type timeval is array (1 .. 3) of C.long; - -- The timeval array is sized to contain long_long sec and long usec. - -- If long_long'Size = long'Size then it will be overly large but that - -- won't effect the implementation since it's not accessed directly. - - procedure timeval_to_duration - (T : not null access timeval; - sec : not null access C.Extensions.long_long; - usec : not null access C.long); - pragma Import (C, timeval_to_duration, "__gnat_timeval_to_duration"); - - Micro : constant := 10**6; - sec : aliased C.Extensions.long_long; - usec : aliased C.long; - TV : aliased timeval; - Result : int; - - function gettimeofday - (Tv : access timeval; - Tz : System.Address := System.Null_Address) return int; - pragma Import (C, gettimeofday, "gettimeofday"); - - begin - Result := gettimeofday (TV'Access, System.Null_Address); - pragma Assert (Result = 0); - timeval_to_duration (TV'Access, sec'Access, usec'Access); - tp.all := To_Timespec (Duration (sec) + Duration (usec) / Micro); - return Result; - end clock_gettime; - end System.OS_Interface; diff --git a/gcc/ada/s-osinte-android.ads b/gcc/ada/s-osinte-android.ads index abf5daec645..0fd39da4570 100644 --- a/gcc/ada/s-osinte-android.ads +++ b/gcc/ada/s-osinte-android.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1995-2014, Free Software Foundation, Inc. -- +-- Copyright (C) 1995-2015, 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- -- @@ -208,8 +208,8 @@ package System.OS_Interface is type clockid_t is new int; function clock_gettime - (clock_id : clockid_t; - tp : access timespec) return int; + (clock_id : clockid_t; tp : access timespec) return int; + pragma Import (C, clock_gettime, "clock_gettime"); function clock_getres (clock_id : clockid_t; -- cgit v1.2.1