diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-01-03 15:32:19 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-01-03 15:32:19 +0000 |
commit | e0521a36726eeeabf7bf46626f1b9a27a27fe373 (patch) | |
tree | b913840c88dfad71cc2715a06794206e2889a7a3 /gcc/ada/sem_attr.adb | |
parent | 05c3e0e9708795d88a1f0b2f7e653f5bd16dc17c (diff) | |
download | gcc-e0521a36726eeeabf7bf46626f1b9a27a27fe373.tar.gz |
* s-atacco.ads, a-direio.adb: Protect use of 'Constrained by warnings
on/off, since this is an obsolescent feature, for which we now generate
a warning.
* sem_attr.adb (Analyze_Attribute, case Constrained): Issue warning if
warning mode is set and obsolescent usage of this attribute occurs.
(Resolve_Access, case 'Access): Note that GNAT uses the context type to
disambiguate overloaded prefixes, in accordance with AI-235. GNAT code
predates, and partly motivates, the adoption of the AI.
Implement new Ada 2005 attribute Mod
* exp_attr.adb (Expand_N_Attribute_Reference): Implement Ada 2005
attribute Mod.
* par-ch4.adb (P_Name): In Ada 2005 mode, recognize new attribute Mod
* snames.h, snames.ads, snames.adb: Add entry for No_Dependence for
pragma restrictions.
New entry for Ada 2005 attribute Mod.
* par-prag.adb:
Add recognition of new pragma Restrictions No_Dependence
Recognize restriction No_Obsolescent_Features at parse time
* bcheck.adb: Add circuitry for checking for consistency of
No_Dependence restrictions.
* lib-writ.ads, lib-writ.adb: Output new R lines for No_Dependence
restrictions.
* restrict.ads, restrict.adb: Add subprograms to deal with
No_Dependence restrictions.
* rtsfind.adb: Check that implicit with's do not violate No_Dependence
restrictions.
* sem_ch3.adb, sem_ch11.adb, sem_ch13.adb, lib-xref.adb,
sem_attr.adb: Add check for new restriction No_Obsolescent_Features
* scn.ads, prj-err.ads, prj-err.adb, ali-util.adb, gprep.adb: Add new
dummy parameter to scng instantiation.
Needed for new restriction No_Obsolescent_Features
* scn.adb: (Obsolescent_Check): New procedure
Needed for new restriction No_Obsolescent_Features
* scng.ads, scng.adb: Always allow wide characters in Ada 2005 mode, as
specified by AI-285, needed for implementation of AI-388 (adding greek
pi to Ada.Numerics).
Add new generic formal to scng, needed for new restriction
No_Obsolescent_Features.
* s-rident.ads: Add new restriction No_Obsolescent_Features.
* ali.ads, ali.adb: Adjustments for reading new No_Dependence
restrictions lines.
(Scan_ALI): When finding an unexpected character on an R line, raise
exception Bad_R_Line, instead of calling Fatal_Error, so that, when
Ignore_Errors is True, default restrictions are set and scanning of the
ALI file continues with the next line. Also, when Bad_R_Line is raised
and Ignore_Errors is True, skip to the end of le line.
* sem_ch10.adb: Check that explicit with's do not violate
No_Dependence restrictions.
(Install_Withed_Unit): Add code to implement AI-377 and diagnose
illegal context clauses containing child units of instance.
* sem_prag.adb: Processing and checking for new No_Dependence
restrictions.
(Analyze_Pragma, case Psect_Object): Call Check_Arg_Is_External_Name to
analyze and check the External argument.
* a-numeri.ads: Add greek letter pi as alternative spelling of Pi
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@92829 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_attr.adb')
-rw-r--r-- | gcc/ada/sem_attr.adb | 65 |
1 files changed, 56 insertions, 9 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 57c06a599a1..553fb7138a1 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -259,6 +259,9 @@ package body Sem_Attr is procedure Check_Library_Unit; -- Verify that prefix of attribute N is a library unit + procedure Check_Modular_Integer_Type; + -- Verify that prefix of attribute N is a modular integer type + procedure Check_Not_Incomplete_Type; -- Check that P (the prefix of the attribute) is not an incomplete -- type or a private type for which no full view has been given. @@ -1074,6 +1077,20 @@ package body Sem_Attr is end if; end Check_Library_Unit; + -------------------------------- + -- Check_Modular_Integer_Type -- + -------------------------------- + + procedure Check_Modular_Integer_Type is + begin + Check_Type; + + if not Is_Modular_Integer_Type (P_Type) then + Error_Attr + ("prefix of % attribute must be modular integer type", P); + end if; + end Check_Modular_Integer_Type; + ------------------------------- -- Check_Not_Incomplete_Type -- ------------------------------- @@ -2197,6 +2214,13 @@ package body Sem_Attr is -- Case from RM J.4(2) of constrained applied to private type if Is_Entity_Name (P) and then Is_Type (Entity (P)) then + Check_Restriction (No_Obsolescent_Features, N); + + if Warn_On_Obsolescent_Feature then + Error_Msg_N + ("constrained for private type is an " & + "obsolescent feature ('R'M 'J.4)?", N); + end if; -- If we are within an instance, the attribute must be legal -- because it was valid in the generic unit. Ditto if this is @@ -2897,6 +2921,21 @@ package body Sem_Attr is Resolve (E2, P_Base_Type); Set_Etype (N, P_Base_Type); + --------- + -- Mod -- + --------- + + when Attribute_Mod => + + -- Note: this attribute is only allowed in Ada 2005 mode, but + -- we do not need to test that here, since Mod is only recognized + -- as an attribute name in Ada 2005 mode during the parse. + + Check_E1; + Check_Modular_Integer_Type; + Resolve (E1, Any_Integer); + Set_Etype (N, P_Base_Type); + ----------- -- Model -- ----------- @@ -2944,12 +2983,7 @@ package body Sem_Attr is when Attribute_Modulus => Check_E0; - Check_Type; - - if not Is_Modular_Integer_Type (P_Type) then - Error_Attr ("prefix of % attribute must be modular type", P); - end if; - + Check_Modular_Integer_Type; Set_Etype (N, Universal_Integer); -------------------- @@ -5412,10 +5446,19 @@ package body Sem_Attr is Fold_Ureal (N, UR_Min (Expr_Value_R (E1), Expr_Value_R (E2)), Static); else - Fold_Uint (N, UI_Min (Expr_Value (E1), Expr_Value (E2)), Static); + Fold_Uint + (N, UI_Min (Expr_Value (E1), Expr_Value (E2)), Static); end if; end Min; + --------- + -- Mod -- + --------- + + when Attribute_Mod => + Fold_Uint + (N, UI_Mod (Expr_Value (E1), Modulus (P_Base_Type)), Static); + ----------- -- Model -- ----------- @@ -6678,14 +6721,18 @@ package body Sem_Attr is elsif Is_Overloaded (P) then - -- Use the designated type of the context to disambiguate + -- Use the designated type of the context to disambiguate + -- Note that this was not strictly conformant to Ada 95, + -- but was the implementation adopted by most Ada 95 compilers. + -- The use of the context type to resolve an Access attribute + -- reference is now mandated in AI-235 for Ada 2005. declare Index : Interp_Index; It : Interp; + begin Get_First_Interp (P, Index, It); - while Present (It.Typ) loop if Covers (Designated_Type (Typ), It.Typ) then Resolve (P, It.Typ); |