diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2004-02-09 15:56:05 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2004-02-09 15:56:05 +0100 |
commit | 2e0717349d7cb5660d38c281ab6c65d5e01fa8fc (patch) | |
tree | 9d8577ad0140661a3b83d8e92d9d61821ae41213 /gcc/ada/sem_ch8.adb | |
parent | 77077b39cb4b8bf659af916a7a055413afb41e9e (diff) | |
download | gcc-2e0717349d7cb5660d38c281ab6c65d5e01fa8fc.tar.gz |
[multiple changes]
2004-02-09 Ed Schonberg <schonberg@gnat.com>
* exp_ch4.adb (Expand_N_Op_Eq): When looking for the primitive equality
for a tagged type, verify that both formals have the same type.
* exp_ch6.adb (Add_Call_By_Copy_Code): Initialize properly the
temporary when the formal is an in-parameter and the actual a possibly
unaligned slice.
* exp_ch9.adb (Expand_Entry_Barrier): Resolve barrier expression even
when expansion is disabled, to ensure proper name capture with
overloaded literals. Condition can be of any boolean type, resolve
accordingly.
* sem_ch8.adb (Analyze_Subprogram_Renaming): Emit warning if the
renaming is for a formal subprogram with a default operator name, and
there is a usable operator that is visible at the point of
instantiation.
2004-02-09 Robert Dewar <dewar@gnat.com>
* ali.adb (Scan_Ali) Add Ignore_Errors argument. This is a major
rewrite to ignore errors in ali files, intended to allow tools downward
compatibility with new versions of ali files.
* ali.ads: Add new parameter Ignore_Errors
* bcheck.adb (Check_Consistent_Restrictions): Fix error of sometimes
duplicating the error message giving the file with restrictions.
* debug.adb: Add debug flag I for gnatbind
* errout.adb (Set_Msg_Insertion_Node): Suppress extra quotes around
operators for the case where the operator is a defining operator.
* exp_ch3.adb: Minor reformatting (new function spec format).
* exp_ch4.adb: Add comment for previous change, and make minor
adjustment to loop to always check for improper loop termination.
Minor reformatting throughout (new function spec format).
* gnatbind.adb: Implement -di debug flag for gnatbind
* gnatlink.adb: Call Scan_ALI with Ignore_Errors set to True
* gnatls.adb: Call Scan_ALI with Ignore_Errors set to True
* lib-load.adb: Fix bad assertion.
Found by testing and code reading.
Minor reformatting.
* lib-load.ads: Minor reformatting.
* lib-writ.adb: There is only one R line now.
* lib-writ.ads: Add documentation on making downward compatible changes
to ali files so old tools work with new ali files.
There is only one R line now.
Add documentation on format incompatibilities (with special GPS note)
* namet.ads, namet.adb: (Is_Operator_Name): New procedure
* par-load.adb: Minor reformatting
* sem_ch8.adb: Fix to error message from last update
Minor reformatting and restructuring of code from last update
* par-prag.adb, snames.adb, snames.ads, snames.h,
sem_prag.adb: Implement pragma Profile.
* stylesw.adb: Implement -gnatyN switch to turn off all style check
options.
* usage.adb: Add line for -gnatyN switch
* vms_data.ads: Add entry STYLE_CHECKS=NONE for -gnatyN
From-SVN: r77537
Diffstat (limited to 'gcc/ada/sem_ch8.adb')
-rw-r--r-- | gcc/ada/sem_ch8.adb | 68 |
1 files changed, 53 insertions, 15 deletions
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index 0a44a2da090..31b2a4aa6a1 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -756,7 +756,6 @@ package body Sem_Ch8 is else Error_Msg_N ("expect object name in renaming", Nam); end if; - end if; Set_Etype (Id, T2); @@ -1179,10 +1178,49 @@ package body Sem_Ch8 is Old_S := Entity (Nam); New_S := Analyze_Subprogram_Specification (Spec); - if Ekind (Entity (Nam)) = E_Operator - and then Box_Present (Inst_Node) - then - Old_S := Find_Renamed_Entity (N, Name (N), New_S, Is_Actual); + -- Operator case + + if Ekind (Entity (Nam)) = E_Operator then + + -- Box present + + if Box_Present (Inst_Node) then + Old_S := Find_Renamed_Entity (N, Name (N), New_S, Is_Actual); + + -- If there is an immediately visible homonym of the operator + -- and the declaration has a default, this is worth a warning + -- because the user probably did not intend to get the pre- + -- defined operator, visible in the generic declaration. + -- To find if there is an intended candidate, analyze the + -- renaming again in the current context. + + elsif Scope (Old_S) = Standard_Standard + and then Present (Default_Name (Inst_Node)) + then + declare + Decl : constant Node_Id := New_Copy_Tree (N); + Hidden : Entity_Id; + + begin + Set_Entity (Name (Decl), Empty); + Analyze (Name (Decl)); + Hidden := + Find_Renamed_Entity (Decl, Name (Decl), New_S, True); + + if Present (Hidden) + and then In_Open_Scopes (Scope (Hidden)) + and then Is_Immediately_Visible (Hidden) + and then Comes_From_Source (Hidden) + and then Hidden /= Old_S + then + Error_Msg_Sloc := Sloc (Hidden); + Error_Msg_N ("?default subprogram is resolved " & + "in the generic declaration " & + "('R'M 12.6(17))", N); + Error_Msg_NE ("\?and will not use & #", N, Hidden); + end if; + end; + end if; end if; else @@ -2163,9 +2201,8 @@ package body Sem_Ch8 is Elmt : Elmt_Id; function Is_Primitive_Operator - (Op : Entity_Id; - F : Entity_Id) - return Boolean; + (Op : Entity_Id; + F : Entity_Id) return Boolean; -- Check whether Op is a primitive operator of a use-visible type --------------------------- @@ -2173,9 +2210,8 @@ package body Sem_Ch8 is --------------------------- function Is_Primitive_Operator - (Op : Entity_Id; - F : Entity_Id) - return Boolean + (Op : Entity_Id; + F : Entity_Id) return Boolean is T : constant Entity_Id := Etype (F); @@ -4730,10 +4766,8 @@ package body Sem_Ch8 is -- Is_Appropriate_For_Record -- ------------------------------- - function Is_Appropriate_For_Record - (T : Entity_Id) - return Boolean - is + function Is_Appropriate_For_Record (T : Entity_Id) return Boolean is + function Has_Components (T1 : Entity_Id) return Boolean; -- Determine if given type has components (i.e. is either a record -- type or a type that has discriminants). @@ -4968,6 +5002,10 @@ package body Sem_Ch8 is -- Scan context clause of compilation unit to find a with_clause -- for System. + ----------------- + -- Find_System -- + ----------------- + function Find_System (C_Unit : Node_Id) return Entity_Id is With_Clause : Node_Id; |