aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/styleg.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2010-09-09 12:32:50 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2010-09-09 12:32:50 +0200
commitbd29d5193a42a7fbe92c5052fa8d28f35290c823 (patch)
tree29c9bde6be0184567a5d781848146e9b3c6e96b3 /gcc/ada/styleg.adb
parent0e35524dec6e62dfe35360f11eee7c7031c5ab2e (diff)
downloadgcc-bd29d5193a42a7fbe92c5052fa8d28f35290c823.zip
gcc-bd29d5193a42a7fbe92c5052fa8d28f35290c823.tar.gz
gcc-bd29d5193a42a7fbe92c5052fa8d28f35290c823.tar.bz2
[multiple changes]
2010-09-09 Vincent Celier <celier@adacore.com> * osint.adb (Canonical_Case_File_Name): Use procedure To_Lower in System.Case_Util (Canonical_Case_Env_Var_Name): Ditto 2010-09-09 Bob Duff <duff@adacore.com> * g-pehage.adb (Allocate): Initialize the allocated elements of IT. 2010-09-09 Robert Dewar <dewar@adacore.com> * cstand.adb: Mark Boolean and Character types as Ordered * einfo.adb (Has_Pragma_Ordered): New flag * einfo.ads (Has_Pragma_Ordered): New flag * g-calend.ads: Mark Day_Name as Ordered * opt.ads: Mark Ada_Version_Type as Ordered (Warn_On_Unordered_Enumeration_Type): New flag * par-prag.adb: Add procdessing for pragma Ordered * s-ficobl.ads (Read_File_Mode): New subtype * s-fileio.adb: Use Read_File_Mode instead of explicit ranges * s-taskin.ads: Mark Entry_Call_State as ordered * sem_ch3.adb (Build_Derived_Enumeration_Type): Inherit Has_Pragma_Ordered. * sem_ch6.ads: Mark Conformance_Type as Ordered * sem_prag.adb: Implement pragma Ordered * sem_res.adb (Bad_Unordered_Enumeration_Reference): New function (Resolve_Comparison_Op): Diagnose unordered comparison (Resolve_Range): Diagnose unordered range * sem_warn.adb (Warn_On_Unordered_Enumeration_Type): New flag (from -gnatw.u/U) * snames.ads-tmpl: Add entry for pragma Ordered * style.ads (Check_Enumeration_Subrange): Removed * styleg.adb (Check_Enumeration_Subrange): Removed * styleg.ads (Check_Enumeration_Subrange): Removed * stylesw.adb: Remove handling of -gnatyE switch * stylesw.ads: (Style_Check_Enumeration_Subranges): Removed * vms_data.ads: Remove -gnatyE entries Add -gnatw.u entries * ug_words: Entries for -gnatw.u and -gnatw.U * gnat_ugn.texi: Document -gnatw.u/-gnatw.U switches * gnat_rm.texi: Document pragma Ordered. * s-tasren.adb: Avoid unnecessary comparison on unordered enumeration. * s-tpobop.adb: Remove comparison on unordered enumeration type. From-SVN: r164070
Diffstat (limited to 'gcc/ada/styleg.adb')
-rw-r--r--gcc/ada/styleg.adb80
1 files changed, 1 insertions, 79 deletions
diff --git a/gcc/ada/styleg.adb b/gcc/ada/styleg.adb
index c19a096..dc6b6a6 100644
--- a/gcc/ada/styleg.adb
+++ b/gcc/ada/styleg.adb
@@ -32,13 +32,10 @@ with Casing; use Casing;
with Csets; use Csets;
with Einfo; use Einfo;
with Err_Vars; use Err_Vars;
-with Lib; use Lib;
-with Namet; use Namet;
with Opt; use Opt;
with Scans; use Scans;
with Sinfo; use Sinfo;
with Sinput; use Sinput;
-with Snames; use Snames;
with Stylesw; use Stylesw;
package body Styleg is
@@ -205,6 +202,7 @@ package body Styleg is
end OK_Boolean_Operand;
-- Start of processig for Check_Boolean_Operator
+
begin
if Style_Check_Boolean_And_Or
and then Comes_From_Source (Node)
@@ -553,82 +551,6 @@ package body Styleg is
end if;
end Check_Dot_Dot;
- --------------------------------
- -- Check_Enumeration_Subrange --
- --------------------------------
-
- procedure Check_Enumeration_Subrange (N : Node_Id) is
- function First_Last_Ref return Boolean;
- -- Returns True if N is of the form X'First .. X'Last where X is the
- -- same entity for both attributes. N is already known to be N_Range.
-
- --------------------
- -- First_Last_Ref --
- --------------------
-
- function First_Last_Ref return Boolean is
- L : constant Node_Id := Low_Bound (N);
- H : constant Node_Id := High_Bound (N);
-
- begin
- if Nkind (L) = N_Attribute_Reference
- and then Nkind (H) = N_Attribute_Reference
- and then Attribute_Name (L) = Name_First
- and then Attribute_Name (H) = Name_Last
- then
- declare
- PL : constant Node_Id := Prefix (L);
- PH : constant Node_Id := Prefix (H);
- begin
- if Is_Entity_Name (PL)
- and then Is_Entity_Name (PH)
- and then Entity (PL) = Entity (PH)
- then
- return True;
- end if;
- end;
- end if;
-
- return False;
- end First_Last_Ref;
-
- -- Start of processing for Check_Enumeration_Subrange
-
- begin
- if Style_Check_Enumeration_Subranges then
-
- if Nkind (N) = N_Range
-
- -- Only consider ranges that are explicit in the source
-
- and then Comes_From_Source (N)
-
- -- Only consider enumeration types
-
- and then Is_Enumeration_Type (Etype (N))
-
- -- Exclude standard types. Most importantly we want to exclude the
- -- standard character types, since we want to allow ranges like
- -- '0' .. '9'. But also exclude Boolean since False .. True is OK.
-
- and then Sloc (Root_Type (Etype (N))) /= Standard_Location
-
- -- Exclude X'First .. X'Last if X is the same entity for both
-
- and then not First_Last_Ref
-
- -- Allow the range if in same unit as type declaration (or the
- -- corresponding body or any of its subunits).
-
- and then not In_Same_Extended_Unit (N, Etype (N))
- then
- Error_Msg
- ("(style) explicit enumeration subrange not allowed",
- Sloc (N));
- end if;
- end if;
- end Check_Enumeration_Subrange;
-
---------------
-- Check_EOF --
---------------