aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2017-04-25 15:27:07 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2017-04-25 15:27:07 +0200
commit57f6e00c4611b78a71d060e6a5a10ac95ec0f8fd (patch)
treeb8a8972018a6a41508bfb012563dbf31e8fcbf45
parent628078425bbdfc487c569bf949ad5a334c13a006 (diff)
downloadgcc-57f6e00c4611b78a71d060e6a5a10ac95ec0f8fd.zip
gcc-57f6e00c4611b78a71d060e6a5a10ac95ec0f8fd.tar.gz
gcc-57f6e00c4611b78a71d060e6a5a10ac95ec0f8fd.tar.bz2
[multiple changes]
2017-04-25 Hristian Kirtchev <kirtchev@adacore.com> * 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 <kirtchev@adacore.com> * par_sco.adb: Minor reformatting. 2017-04-25 Ed Schonberg <schonberg@adacore.com> * 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 <gingold@adacore.com> * 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 <squirek@adacore.com> * sem_cat.adb (Validate_RT_RAT_Component): Added an extra check to ignore incomplete types. From-SVN: r247228
-rw-r--r--gcc/ada/ChangeLog30
-rw-r--r--gcc/ada/bindgen.adb26
-rw-r--r--gcc/ada/par_sco.adb6
-rw-r--r--gcc/ada/sem_cat.adb6
-rw-r--r--gcc/ada/sem_ch13.adb37
-rw-r--r--gcc/ada/sem_warn.adb4
-rw-r--r--gcc/ada/sem_warn.ads4
7 files changed, 100 insertions, 13 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 49eeadb..1ecb385 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,33 @@
+2017-04-25 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * 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 <kirtchev@adacore.com>
+
+ * par_sco.adb: Minor reformatting.
+
+2017-04-25 Ed Schonberg <schonberg@adacore.com>
+
+ * 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 <gingold@adacore.com>
+
+ * 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 <squirek@adacore.com>
+
+ * sem_cat.adb (Validate_RT_RAT_Component): Added
+ an extra check to ignore incomplete types.
+
2017-04-25 Thomas Quinot <quinot@adacore.com>
* sem_prag.adb (Analyze_Pragma, case Pragma_Check): Remove
diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb
index fff65d2..1757712 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 e5bb42a..b3abb6d 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 878cab0..e922fb3 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 482eab4..6485df2 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 52fc372..29d0a9d 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 98f3387..e19c1c7 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