aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2014-07-31 12:11:39 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2014-07-31 12:11:39 +0200
commit9d827cd5792155202a12d13b04c36abc1b29189d (patch)
treea4b1b0aa22f1442f5a2f2a3cfbd7f7a0b8187370 /gcc
parent9d2a20713d87bed983029db5ffacb8dc06662ff6 (diff)
downloadgcc-9d827cd5792155202a12d13b04c36abc1b29189d.zip
gcc-9d827cd5792155202a12d13b04c36abc1b29189d.tar.gz
gcc-9d827cd5792155202a12d13b04c36abc1b29189d.tar.bz2
[multiple changes]
2014-07-31 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb (Make_Index): Reject properly the use of 'Length in a discrete range, when 'range was probably intended. 2014-07-31 Robert Dewar <dewar@adacore.com> * sem_warn.adb, sem_warn.ads (Has_Junk_Name): Moved from body to spec. From-SVN: r213339
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog9
-rw-r--r--gcc/ada/sem_ch3.adb10
-rw-r--r--gcc/ada/sem_warn.adb10
-rw-r--r--gcc/ada/sem_warn.ads16
4 files changed, 32 insertions, 13 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index dbfad40..c4d668a 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,12 @@
+2014-07-31 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch3.adb (Make_Index): Reject properly the use of 'Length
+ in a discrete range, when 'range was probably intended.
+
+2014-07-31 Robert Dewar <dewar@adacore.com>
+
+ * sem_warn.adb, sem_warn.ads (Has_Junk_Name): Moved from body to spec.
+
2014-07-31 Robert Dewar <dewar@adacore.com>
* frontend.adb: Minor reformatting.
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index b5df709..2d5a430 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -17285,10 +17285,16 @@ package body Sem_Ch3 is
elsif Nkind (N) = N_Attribute_Reference then
- -- The parser guarantees that the attribute is a RANGE attribute
+ -- Catch beginner's error (use of attribute other than 'Range)
+
+ if Attribute_Name (N) /= Name_Range then
+ Error_Msg_N ("expect attribute ''Range", N);
+ Set_Etype (N, Any_Type);
+ return;
+ end if;
-- If the node denotes the range of a type mark, that is also the
- -- resulting type, and we do no need to create an Itype for it.
+ -- resulting type, and we do not need to create an Itype for it.
if Is_Entity_Name (Prefix (N))
and then Comes_From_Source (N)
diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb
index 8db6835..6974c45 100644
--- a/gcc/ada/sem_warn.adb
+++ b/gcc/ada/sem_warn.adb
@@ -128,16 +128,6 @@ package body Sem_Warn is
-- If E is a parameter entity for a subprogram body, then this function
-- returns the corresponding spec entity, if not, E is returned unchanged.
- function Has_Junk_Name (E : Entity_Id) return Boolean;
- -- Return True if the entity name contains any of the following substrings:
- -- discard
- -- dummy
- -- ignore
- -- junk
- -- unused
- -- Used to suppress warnings on names matching these patterns. The contents
- -- of Name_Buffer and Name_Len are destroyed by this call.
-
function Has_Pragma_Unmodified_Check_Spec (E : Entity_Id) return Boolean;
-- Tests Has_Pragma_Unmodified flag for entity E. If E is not a formal,
-- this is simply the setting of the flag Has_Pragma_Unmodified. If E is
diff --git a/gcc/ada/sem_warn.ads b/gcc/ada/sem_warn.ads
index efd3195..41c5a22 100644
--- a/gcc/ada/sem_warn.ads
+++ b/gcc/ada/sem_warn.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1999-2013, Free Software Foundation, Inc. --
+-- Copyright (C) 1999-2014, 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- --
@@ -239,4 +239,18 @@ package Sem_Warn is
-- block or subprogram to see if there are any variables for which useless
-- assignments were made (assignments whose values were never read).
+ ----------------------
+ -- Utility Routines --
+ ----------------------
+
+ function Has_Junk_Name (E : Entity_Id) return Boolean;
+ -- Return True if the entity name contains any of the following substrings:
+ -- discard
+ -- dummy
+ -- ignore
+ -- junk
+ -- unused
+ -- Used to suppress warnings on names matching these patterns. The contents
+ -- of Name_Buffer and Name_Len are destroyed by this call.
+
end Sem_Warn;