From: Arnaud Charlet Date: Tue, 25 Apr 2017 13:27:07 +0000 (+0200) Subject: [multiple changes] X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=57f6e00c4611b78a71d060e6a5a10ac95ec0f8fd;p=gcc.git [multiple changes] 2017-04-25 Hristian Kirtchev * sem_warn.adb (Warn_On_Constant_Valid_Condition): Do not consider comparisons between non- scalar expressions expressions because their values cannot be invalidated. * sem_warn.ads (Warn_On_Constant_Valid_Condition): Update the comment on usage. 2017-04-25 Hristian Kirtchev * par_sco.adb: Minor reformatting. 2017-04-25 Ed Schonberg * sem_ch13.adb (Analyze_Aspects_At_Freeze_Point): If entity is a type from an unfrozen local package, install package to complete the analysis of delayed aspects of the type. 2017-04-25 Tristan Gingold * bingen.adb (System_Version_Control_Used): New variable. (Resolve_Binder_Options): Set the above variable. (Gen_Output_File_Ada): Conditionally call Gen_Versions. (Gen_Elab_Order): Emit blank line before. 2017-04-25 Justin Squirek * sem_cat.adb (Validate_RT_RAT_Component): Added an extra check to ignore incomplete types. From-SVN: r247228 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 49eeadba196..1ecb385bc88 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,33 @@ +2017-04-25 Hristian Kirtchev + + * sem_warn.adb (Warn_On_Constant_Valid_Condition): Do not consider + comparisons between non- scalar expressions expressions because + their values cannot be invalidated. + * sem_warn.ads (Warn_On_Constant_Valid_Condition): Update the + comment on usage. + +2017-04-25 Hristian Kirtchev + + * par_sco.adb: Minor reformatting. + +2017-04-25 Ed Schonberg + + * sem_ch13.adb (Analyze_Aspects_At_Freeze_Point): If entity + is a type from an unfrozen local package, install package to + complete the analysis of delayed aspects of the type. + +2017-04-25 Tristan Gingold + + * bingen.adb (System_Version_Control_Used): New variable. + (Resolve_Binder_Options): Set the above variable. + (Gen_Output_File_Ada): Conditionally call Gen_Versions. + (Gen_Elab_Order): Emit blank line before. + +2017-04-25 Justin Squirek + + * sem_cat.adb (Validate_RT_RAT_Component): Added + an extra check to ignore incomplete types. + 2017-04-25 Thomas Quinot * sem_prag.adb (Analyze_Pragma, case Pragma_Check): Remove diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb index fff65d2cb20..1757712e921 100644 --- a/gcc/ada/bindgen.adb +++ b/gcc/ada/bindgen.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2016, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2017, 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- -- @@ -94,6 +94,12 @@ package body Bindgen is -- Resolve_Binder_Options, and it is used to call a procedure that starts -- slave processors. + System_Version_Control_Used : Boolean := False; + -- Flag indicating whether unit System.Version_Control is in the closure. + -- This unit is implicitly withed by the compiler when Version or + -- Body_Version attributes are used. If the package is not in the closure, + -- the version definitions can be removed. + Lib_Final_Built : Boolean := False; -- Flag indicating whether the finalize_library rountine has been built @@ -1303,6 +1309,7 @@ package body Bindgen is procedure Gen_Elab_Order (Elab_Order : Unit_Id_Array) is begin + WBI (""); WBI (" -- BEGIN ELABORATION ORDER"); for J in Elab_Order'Range loop @@ -1313,7 +1320,6 @@ package body Bindgen is end loop; WBI (" -- END ELABORATION ORDER"); - WBI (""); end Gen_Elab_Order; -------------------------- @@ -2259,7 +2265,16 @@ package body Bindgen is Get_Main_Name & """);"); end if; - Gen_Versions; + -- Generate version numbers for units, only if needed. Be very safe on + -- the condition. + + if not Configurable_Run_Time_On_Target + or else System_Version_Control_Used + or else not Bind_Main_Program + then + Gen_Versions; + end if; + Gen_Elab_Order (Elab_Order); -- Spec is complete @@ -2865,6 +2880,11 @@ package body Bindgen is Check_Package (System_BB_CPU_Primitives_Multiprocessors_Used, "system.bb.cpu_primitives.multiprocessors%s"); + -- Ditto for System.Version_Control, which is used for Version and + -- Body_Version attributes. + + Check_Package (System_Version_Control_Used, + "system.version_control%s"); end loop; end Resolve_Binder_Options; diff --git a/gcc/ada/par_sco.adb b/gcc/ada/par_sco.adb index e5bb42a5c82..b3abb6dfbc6 100644 --- a/gcc/ada/par_sco.adb +++ b/gcc/ada/par_sco.adb @@ -1688,15 +1688,15 @@ package body Par_SCO is -- Pre/post can have checks in client units too because of -- inheritance, so should they receive the same treatment??? - when Aspect_Invariant + when Aspect_Dynamic_Predicate + | Aspect_Invariant | Aspect_Post | Aspect_Postcondition | Aspect_Pre | Aspect_Precondition - | Aspect_Type_Invariant - | Aspect_Dynamic_Predicate | Aspect_Predicate | Aspect_Static_Predicate + | Aspect_Type_Invariant => C1 := 'a'; diff --git a/gcc/ada/sem_cat.adb b/gcc/ada/sem_cat.adb index 878cab0119e..e922fb35b1c 100644 --- a/gcc/ada/sem_cat.adb +++ b/gcc/ada/sem_cat.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2016, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2017, 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- -- @@ -1975,7 +1975,9 @@ package body Sem_Cat is U_Typ := Typ; end if; - if Comes_From_Source (Typ) and then Is_Type (Typ) then + if Comes_From_Source (Typ) and then Is_Type (Typ) + and then Ekind (Typ) /= E_Incomplete_Type + then -- Check that the type can be meaningfully transmitted to another -- partition (E.2.2(8)). diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 482eab4dffa..6485df20b3b 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -51,6 +51,7 @@ with Sem_Aux; use Sem_Aux; with Sem_Case; use Sem_Case; with Sem_Ch3; use Sem_Ch3; with Sem_Ch6; use Sem_Ch6; +with Sem_Ch7; use Sem_Ch7; with Sem_Ch8; use Sem_Ch8; with Sem_Dim; use Sem_Dim; with Sem_Disp; use Sem_Disp; @@ -1180,10 +1181,42 @@ package body Sem_Ch13 is -- Start of processing for Analyze_Aspects_At_Freeze_Point begin - -- Must be visible in current scope + -- Must be visible in current scope, but if this is a type from + -- a nested package it may be frozen from an object declaration + -- in the enclosing scope, so install the package declarations + -- to complete the analysis of the aspects, if any. If the package + -- itself is frozen the type will have been frozen as well. if not Scope_Within_Or_Same (Current_Scope, Scope (E)) then - return; + if Is_Type (E) + and then Ekind (Scope (E)) = E_Package + and then not Is_Frozen (Scope (E)) + then + declare + Pack : constant Entity_Id := Scope (E); + + begin + Push_Scope (Pack); + Install_Visible_Declarations (Pack); + Install_Private_Declarations (Pack); + Analyze_Aspects_At_Freeze_Point (E); + + if Is_Private_Type (E) + and then Present (Full_View (E)) + then + Analyze_Aspects_At_Freeze_Point (Full_View (E)); + end if; + + End_Package_Scope (Pack); + end; + + else + + -- Aspects from other entities in different contexts are + -- analyzed elsewhere. + + return; + end if; end if; -- Look for aspect specification entries for this entity diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb index 52fc372b250..29d0a9df498 100644 --- a/gcc/ada/sem_warn.adb +++ b/gcc/ada/sem_warn.adb @@ -3275,10 +3275,12 @@ package body Sem_Warn is begin -- Determine the potential outcome of the comparison assuming that the - -- operands are valid. + -- scalar operands are valid. if Constant_Condition_Warnings and then Comes_From_Source (Original_Node (Op)) + and then Is_Scalar_Type (Etype (Left)) + and then Is_Scalar_Type (Etype (Right)) -- Do not consider instances because the check was already performed -- in the generic. diff --git a/gcc/ada/sem_warn.ads b/gcc/ada/sem_warn.ads index 98f33875d15..e19c1c76c06 100644 --- a/gcc/ada/sem_warn.ads +++ b/gcc/ada/sem_warn.ads @@ -170,8 +170,8 @@ package Sem_Warn is procedure Warn_On_Constant_Valid_Condition (Op : Node_Id); -- Determine the outcome of evaluating conditional or relational operator - -- Op assuming that its operands are valid. Emit a warning when the result - -- of the evaluation is True or False. + -- Op assuming that its scalar operands are valid. Emit a warning when the + -- result of the evaluation is True or False. procedure Warn_On_Known_Condition (C : Node_Id); -- C is a node for a boolean expression resulting from a relational