From: Arnaud Charlet Date: Wed, 7 Jan 2015 10:12:03 +0000 (+0100) Subject: [multiple changes] X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1c85591cabcde20a01a2ecb90d857625a5681ae4;p=gcc.git [multiple changes] 2015-01-07 Robert Dewar * a-reatim.adb, make.adb, exp_pakd.adb, i-cpoint.adb, sem_ch8.adb, exp_ch3.adb: Minor reformatting. 2015-01-07 Doug Rupp * s-linux.ads (clockid_t): New subtype. * s-osinte-linux.ads (pragma Linker Options): Add -lrt. (clockid_t): New subtype. (clock_getres): Import system call. * s-taprop-linux.adb (System.OS_Constants): With and rename. (RT_Resolution): Remove hardcoded value and call clock_getres. * s-linux-sparc.ads, s-linux-mipsel.ads, s-linux-hppa.ads, s-linux-alpha.ads, s-linux-x32.ads (clockid_t): Add new subtype. 2015-01-07 Robert Dewar * sem_warn.adb (Check_One_Unit): Guard against context item with no Entity field. From-SVN: r219289 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index c0e8fc2fc2b..ed5e35202ee 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,25 @@ +2015-01-07 Robert Dewar + + * a-reatim.adb, make.adb, exp_pakd.adb, i-cpoint.adb, sem_ch8.adb, + exp_ch3.adb: Minor reformatting. + +2015-01-07 Doug Rupp + + * s-linux.ads (clockid_t): New subtype. + * s-osinte-linux.ads (pragma Linker Options): Add -lrt. + (clockid_t): New subtype. + (clock_getres): Import system call. + * s-taprop-linux.adb (System.OS_Constants): With and rename. + (RT_Resolution): Remove + hardcoded value and call clock_getres. + * s-linux-sparc.ads, s-linux-mipsel.ads, s-linux-hppa.ads, + s-linux-alpha.ads, s-linux-x32.ads (clockid_t): Add new subtype. + +2015-01-07 Robert Dewar + + * sem_warn.adb (Check_One_Unit): Guard against context item + with no Entity field. + 2015-01-07 Vincent Celier * clean.adb (Gnatclean): Warn that 'gnatclean -P' is obsolete. diff --git a/gcc/ada/a-reatim.adb b/gcc/ada/a-reatim.adb index 1a233c49481..4597dc3b5a7 100644 --- a/gcc/ada/a-reatim.adb +++ b/gcc/ada/a-reatim.adb @@ -222,8 +222,8 @@ package body Ada.Real_Time is -- the intermediate result Time (SC) we take advantage of the different -- signs in SC and TS (when that is the case). - -- If signs of SC and TS are different then we avoid converting SC to - -- Time (as we do in the else part). The reason for that is that SC + -- If the signs of SC and TS are different then we avoid converting SC + -- to Time (as we do in the else part). The reason for that is that SC -- converted to Time may overflow the range of Time, while the addition -- of SC plus TS does not overflow (because of their different signs). -- The approach is to add and remove the greatest value of time @@ -231,9 +231,7 @@ package body Ada.Real_Time is -- signs, so we add the positive constant to the negative value, and the -- negative constant to the positive value, to prevent overflows. - if (SC > 0 and then TS < 0.0) - or else (SC < 0 and then TS > 0.0) - then + if (SC > 0 and then TS < 0.0) or else (SC < 0 and then TS > 0.0) then declare Closest_Boundary : constant Seconds_Count := (if TS >= 0.0 then diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index 74afb6034c6..3ee51ef8662 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -2395,14 +2395,16 @@ package body Exp_Ch3 is declare Parent_IP : constant Name_Id := Make_Init_Proc_Name (Etype (Rec_Ent)); - Stmt : Node_Id := First (Stmts); - IP_Call : Node_Id := Empty; + Stmt : Node_Id; + IP_Call : Node_Id; IP_Stmts : List_Id; begin -- Look for a call to the parent IP at the beginning -- of Stmts associated with the record extension + Stmt := First (Stmts); + IP_Call := Empty; while Present (Stmt) loop if Nkind (Stmt) = N_Procedure_Call_Statement and then Chars (Name (Stmt)) = Parent_IP diff --git a/gcc/ada/exp_pakd.adb b/gcc/ada/exp_pakd.adb index cd592dc3529..d0836118851 100644 --- a/gcc/ada/exp_pakd.adb +++ b/gcc/ada/exp_pakd.adb @@ -765,9 +765,9 @@ package body Exp_Pakd is elsif not Is_Constrained (Typ) then -- When generating standard DWARF, the ___XP suffix will be stripped - -- by the back-end, but generate it anyway to ease compiler - -- debugging: this will help to distinguish implementation types from - -- original packed arrays. + -- by the back-end but generate it anyway to ease compiler debugging. + -- This will help to distinguish implementation types from original + -- packed arrays. PAT := Make_Defining_Identifier (Loc, diff --git a/gcc/ada/i-cpoint.adb b/gcc/ada/i-cpoint.adb index 39c7bef72a2..8da412bdea7 100644 --- a/gcc/ada/i-cpoint.adb +++ b/gcc/ada/i-cpoint.adb @@ -145,12 +145,14 @@ package body Interfaces.C.Pointers is is L : ptrdiff_t; S : Pointer := Source; + begin if Source = null or Target = null then raise Dereference_Error; end if; -- Compute array length (including the terminator) + L := 1; while S.all /= Terminator and then L < Limit loop L := L + 1; diff --git a/gcc/ada/make.adb b/gcc/ada/make.adb index 8bbe0949955..8fc4763e71c 100644 --- a/gcc/ada/make.adb +++ b/gcc/ada/make.adb @@ -6490,8 +6490,8 @@ package body Make is if Project_File_Name /= null then Write_Line - ("warning: gnatmake -P is obsolete and will not be available " & - "in the next release. Use gprbuild instead."); + ("warning: gnatmake -P is obsolete and will not be available " + & "in the next release; use gprbuild instead"); end if; -- If --subdirs= is specified, but not -P, this is equivalent to -D, diff --git a/gcc/ada/s-linux-alpha.ads b/gcc/ada/s-linux-alpha.ads index e1c97ad9a33..23ca44aad7c 100644 --- a/gcc/ada/s-linux-alpha.ads +++ b/gcc/ada/s-linux-alpha.ads @@ -47,6 +47,7 @@ package System.Linux is subtype long is Interfaces.C.long; subtype suseconds_t is Interfaces.C.long; subtype time_t is Interfaces.C.long; + subtype clockid_t is Interfaces.C.int; type timespec is record tv_sec : time_t; diff --git a/gcc/ada/s-linux-hppa.ads b/gcc/ada/s-linux-hppa.ads index 8f7d8117576..d72c96ebcaf 100644 --- a/gcc/ada/s-linux-hppa.ads +++ b/gcc/ada/s-linux-hppa.ads @@ -47,6 +47,7 @@ package System.Linux is subtype long is Interfaces.C.long; subtype suseconds_t is Interfaces.C.long; subtype time_t is Interfaces.C.long; + subtype clockid_t is Interfaces.C.int; type timespec is record tv_sec : time_t; diff --git a/gcc/ada/s-linux-mipsel.ads b/gcc/ada/s-linux-mipsel.ads index 1799a557ac6..17a3375ccce 100644 --- a/gcc/ada/s-linux-mipsel.ads +++ b/gcc/ada/s-linux-mipsel.ads @@ -46,6 +46,7 @@ package System.Linux is subtype long is Interfaces.C.long; subtype suseconds_t is Interfaces.C.long; subtype time_t is Interfaces.C.long; + subtype clockid_t is Interfaces.C.int; type timespec is record tv_sec : time_t; diff --git a/gcc/ada/s-linux-sparc.ads b/gcc/ada/s-linux-sparc.ads index ae813e6b3b4..96c67145fe1 100644 --- a/gcc/ada/s-linux-sparc.ads +++ b/gcc/ada/s-linux-sparc.ads @@ -47,6 +47,7 @@ package System.Linux is subtype long is Interfaces.C.long; subtype suseconds_t is Interfaces.C.long; subtype time_t is Interfaces.C.long; + subtype clockid_t is Interfaces.C.int; type timespec is record tv_sec : time_t; diff --git a/gcc/ada/s-linux-x32.ads b/gcc/ada/s-linux-x32.ads index 1b2d46eddd2..6fb453c2b4b 100644 --- a/gcc/ada/s-linux-x32.ads +++ b/gcc/ada/s-linux-x32.ads @@ -36,6 +36,8 @@ -- PLEASE DO NOT add any with-clauses to this package or remove the pragma -- Preelaborate. This package is designed to be a bottom-level (leaf) package +with Interfaces.C; + package System.Linux is pragma Preelaborate; @@ -43,7 +45,8 @@ package System.Linux is -- Time -- ---------- - type time_t is new Long_Long_Integer; + type time_t is new Long_Long_Integer; + subtype clockid_t is Interfaces.C.int; type timespec is record tv_sec : time_t; diff --git a/gcc/ada/s-linux.ads b/gcc/ada/s-linux.ads index 8a49e8c891e..3b482846441 100644 --- a/gcc/ada/s-linux.ads +++ b/gcc/ada/s-linux.ads @@ -47,6 +47,7 @@ package System.Linux is subtype long is Interfaces.C.long; subtype suseconds_t is Interfaces.C.long; subtype time_t is Interfaces.C.long; + subtype clockid_t is Interfaces.C.int; type timespec is record tv_sec : time_t; diff --git a/gcc/ada/s-osinte-linux.ads b/gcc/ada/s-osinte-linux.ads index d6930de9640..c71bebc8d8a 100644 --- a/gcc/ada/s-osinte-linux.ads +++ b/gcc/ada/s-osinte-linux.ads @@ -47,6 +47,8 @@ package System.OS_Interface is pragma Preelaborate; pragma Linker_Options ("-lpthread"); + pragma Linker_Options ("-lrt"); + -- Needed for clock_getres with glibc versions prior to 2.17 subtype int is Interfaces.C.int; subtype char is Interfaces.C.char; @@ -217,9 +219,15 @@ package System.OS_Interface is -- Time -- ---------- - subtype time_t is System.Linux.time_t; - subtype timespec is System.Linux.timespec; - subtype timeval is System.Linux.timeval; + subtype time_t is System.Linux.time_t; + subtype timespec is System.Linux.timespec; + subtype timeval is System.Linux.timeval; + subtype clockid_t is System.Linux.clockid_t; + + function clock_getres + (clock_id : clockid_t; + res : access timespec) return int; + pragma Import (C, clock_getres, "clock_getres"); function To_Duration (TS : timespec) return Duration; pragma Inline (To_Duration); diff --git a/gcc/ada/s-taprop-linux.adb b/gcc/ada/s-taprop-linux.adb index a95013fa676..bf5e9929502 100644 --- a/gcc/ada/s-taprop-linux.adb +++ b/gcc/ada/s-taprop-linux.adb @@ -44,6 +44,7 @@ with Interfaces.C.Extensions; with System.Task_Info; with System.Tasking.Debug; with System.Interrupt_Management; +with System.OS_Constants; with System.OS_Primitives; with System.Stack_Checking.Operations; with System.Multiprocessors; @@ -56,6 +57,7 @@ with System.Soft_Links; package body System.Task_Primitives.Operations is + package OSC renames System.OS_Constants; package SSL renames System.Soft_Links; package SC renames System.Stack_Checking.Operations; @@ -658,8 +660,13 @@ package body System.Task_Primitives.Operations is ------------------- function RT_Resolution return Duration is + TS : aliased timespec; + Result : int; begin - return 10#1.0#E-6; + Result := clock_getres (OSC.CLOCK_REALTIME, TS'Unchecked_Access); + pragma Assert (Result = 0); + + return To_Duration (TS); end RT_Resolution; ------------ diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index 2b4f52830e1..bd015886bcc 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -2710,16 +2710,15 @@ package body Sem_Ch8 is -- Check whether the renaming is for a defaulted actual subprogram -- with a class-wide actual. - -- The class-wide wrapper is not needed when we are in - -- GNATprove_Mode and there is an external axiomatization on the - -- package. + -- The class-wide wrapper is not needed in GNATprove_Mode and there + -- is an external axiomatization on the package. if CW_Actual and then Box_Present (Inst_Node) - and then not (GNATprove_Mode - and then - Present (Containing_Package_With_Ext_Axioms - (Formal_Spec))) + and then not + (GNATprove_Mode + and then + Present (Containing_Package_With_Ext_Axioms (Formal_Spec))) then Build_Class_Wide_Wrapper (New_S, Old_S); diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb index 7bdda640731..484509602c0 100644 --- a/gcc/ada/sem_warn.adb +++ b/gcc/ada/sem_warn.adb @@ -2350,6 +2350,13 @@ package body Sem_Warn is if Nkind (Item) = N_With_Clause and then not Implicit_With (Item) and then In_Extended_Main_Source_Unit (Item) + + -- Guard for no entity present. Not clear under what conditions + -- this happens, but it does occur, and since this is only a + -- warning, we just suppress the warning in this case. + + and then Nkind (Name (Item)) in N_Has_Entity + and then Present (Entity (Name (Item))) then Lunit := Entity (Name (Item));