aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2014-02-04 15:32:37 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2014-02-04 15:32:37 +0100
commit5a521b8ade74674b926ba242e3449ba094274bc3 (patch)
tree60be11727d2b79ae67da96274b2e1d62b14a73a1 /gcc
parent81bd8c9075b533aab81a9778119b92f4b7cd7737 (diff)
downloadgcc-5a521b8ade74674b926ba242e3449ba094274bc3.zip
gcc-5a521b8ade74674b926ba242e3449ba094274bc3.tar.gz
gcc-5a521b8ade74674b926ba242e3449ba094274bc3.tar.bz2
[multiple changes]
2014-02-04 Gary Dismukes <dismukes@adacore.com> * exp_ch13.adb: Minor spelling fix. 2014-02-04 Robert Dewar <dewar@adacore.com> * opt.ads: Minor comment update. 2014-02-04 Robert Dewar <dewar@adacore.com> * exp_ch4.adb (Expand_N_Expression_With_Actions): Use Rewrite instead of Replace. 2014-02-04 Ed Schonberg <schonberg@adacore.com> * sem_aggr.adb (Resolve_Array_Aggregate): Suppress warnings on null expressions if component type is non-null, when the corresponding association covers an empty range of index values. From-SVN: r207468
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog19
-rw-r--r--gcc/ada/exp_ch13.adb2
-rw-r--r--gcc/ada/exp_ch4.adb9
-rw-r--r--gcc/ada/opt.ads4
-rw-r--r--gcc/ada/sem_aggr.adb37
5 files changed, 58 insertions, 13 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 330ff75..cab5263 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,22 @@
+2014-02-04 Gary Dismukes <dismukes@adacore.com>
+
+ * exp_ch13.adb: Minor spelling fix.
+
+2014-02-04 Robert Dewar <dewar@adacore.com>
+
+ * opt.ads: Minor comment update.
+
+2014-02-04 Robert Dewar <dewar@adacore.com>
+
+ * exp_ch4.adb (Expand_N_Expression_With_Actions): Use Rewrite
+ instead of Replace.
+
+2014-02-04 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_aggr.adb (Resolve_Array_Aggregate): Suppress warnings
+ on null expressions if component type is non-null, when the
+ corresponding association covers an empty range of index values.
+
2014-02-04 Robert Dewar <dewar@adacore.com>
* sinfo.ads: Further comments on N_Expression_With_Actions node.
diff --git a/gcc/ada/exp_ch13.adb b/gcc/ada/exp_ch13.adb
index 72d3f2a..3b8d05d 100644
--- a/gcc/ada/exp_ch13.adb
+++ b/gcc/ada/exp_ch13.adb
@@ -174,7 +174,7 @@ package body Exp_Ch13 is
New_Decl : Node_Id;
begin
- -- Replace entity with temporary and renalyze
+ -- Replace entity with temporary and reanalyze
Set_Defining_Identifier (Decl, Temp);
Set_Analyzed (Decl, False);
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 39a80d3..7232ec8 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -5113,11 +5113,16 @@ package body Exp_Ch4 is
Act := First (Actions (N));
-- Deal with case where there are no actions. In this case we simply
- -- replace the node by its expression since we don't need the actions
+ -- rewrite the node with its expression since we don't need the actions
-- and the specification of this node does not allow a null action list.
+ -- Note: we use Rewrite instead of Replace, because Codepeer is using
+ -- the expanded tree and relying on being able to retrieve the original
+ -- tree in cases like this. This raises a whole lot of issues of whether
+ -- we have problems elsewhere, which will be addressed in the future???
+
if No (Act) then
- Replace (N, Relocate_Node (Expression (N)));
+ Rewrite (N, Relocate_Node (Expression (N)));
-- Otherwise process the actions as described above
diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads
index 95f87e8..1b192a0 100644
--- a/gcc/ada/opt.ads
+++ b/gcc/ada/opt.ads
@@ -1292,8 +1292,8 @@ package Opt is
Sprint_Line_Limit : Nat := 72;
-- GNAT
- -- Limit values for chopping long lines in Sprint output, can be reset by
- -- use of NNN parameter with -gnatG or -gnatD switches.
+ -- Limit values for chopping long lines in Cprint/Sprint output, can be
+ -- reset by use of NNN parameter with -gnatG or -gnatD switches.
Stack_Checking_Enabled : Boolean := False;
-- GNAT
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index 18365fc..504ddcd 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -1937,6 +1937,25 @@ package body Sem_Aggr is
Errors_Posted_On_Choices : Boolean := False;
-- Keeps track of whether any choices have semantic errors
+ function Empty_Range (A : Node_Id) return Boolean;
+ -- If an association covers an empty range, some warnings on the
+ -- expression of the association can be disabled.
+
+ -----------------
+ -- Empty_Range --
+ -----------------
+
+ function Empty_Range (A : Node_Id) return Boolean is
+ R : constant Node_Id := First (Choices (A));
+ begin
+ return No (Next (R))
+ and then Nkind (R) = N_Range
+ and then Compile_Time_Compare
+ (Low_Bound (R), High_Bound (R), False) = GT;
+ end Empty_Range;
+
+ -- Start of processing for Step_2
+
begin
-- STEP 2 (A): Check discrete choices validity
@@ -2059,6 +2078,7 @@ package body Sem_Aggr is
if Ada_Version >= Ada_2005
and then Known_Null (Expression (Assoc))
+ and then not Empty_Range (Assoc)
then
Check_Can_Never_Be_Null (Etype (N), Expression (Assoc));
end if;
@@ -4717,16 +4737,17 @@ package body Sem_Aggr is
-- Apply_Compile_Time_Constraint_Error here to the Expr, which might
-- seem the more natural approach. That's because in some cases the
-- components are rewritten, and the replacement would be missed.
+ -- We do not mark the whole aggregate as raising a constraint error,
+ -- because the association may be a null array range.
- Insert_Action
- (Compile_Time_Constraint_Error
- (Expr,
- "(Ada 2005) null not allowed in null-excluding component??"),
- Make_Raise_Constraint_Error
- (Sloc (Expr), Reason => CE_Access_Check_Failed));
-
- -- Set proper type for bogus component (why is this needed???)
+ Error_Msg_N
+ ("(Ada 2005) null not allowed in null-excluding component??", Expr);
+ Error_Msg_N
+ ("\Constraint_Error will be raised at runtime?", Expr);
+ Rewrite (Expr,
+ Make_Raise_Constraint_Error
+ (Sloc (Expr), Reason => CE_Access_Check_Failed));
Set_Etype (Expr, Comp_Typ);
Set_Analyzed (Expr);
end if;