aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch6.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2010-10-26 13:02:31 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2010-10-26 13:02:31 +0200
commit038140ede0175799d17e489b3509c218ee4fc2f1 (patch)
tree6821664022f05bc795d8aa4856e6c8ea2d162c49 /gcc/ada/sem_ch6.adb
parent3b097d112828a037df20ac72ece37f771d321a1b (diff)
downloadgcc-038140ede0175799d17e489b3509c218ee4fc2f1.zip
gcc-038140ede0175799d17e489b3509c218ee4fc2f1.tar.gz
gcc-038140ede0175799d17e489b3509c218ee4fc2f1.tar.bz2
[multiple changes]
2010-10-26 Javier Miranda <miranda@adacore.com> * einfo.ads, einfo.adb (Is_Overriding_Operation): Removed. (Set_Is_Overriding_Operation): Removed. * sem_ch3.adb (Check_Abstract_Overriding): Remove redundant call to Is_Overriding_Operation. * exp_ch7.adb (Check_Visibly_Controlled): Remove redundant call to Is_Overriding_Operation. * sem_ch7.adb (Declare_Inherited_Private_Subprograms): Remove redundant call to Set_Is_Overriding_Operation. * sem_util.adb (Collect_Primitive_Operations): Replace test on Is_Overriding_Operation by test on the presence of attribute Overridden_Operation. (Original_Corresponding_Operation): Remove redundant call to attribute Is_Overriding_Operation. * sem_ch6.adb (Analyze_Abstract_Subprogram_Declaration): Remove redundant call to Is_Overriding_Operation. (Verify_Overriding_Indicator): Replace several occurrences of test on Is_Overriding_Operation by test on the presence of attribute Overridden_Operation. (Check_Convention): Replace test on Is_Overriding_Operation by test on the presence of Overridden_Operation. (Check_Overriding_Indicator): Add missing decoration of attribute Overridden_Operation. Minor code cleanup. (New_Overloaded_Entity): Replace occurrence of test on Is_Overriding_Operation by test on the presence of attribute Overridden_Operation. Remove redundant setting of attribute Is_Overriding_Operation plus minor code reorganization. Add missing decoration of attribute Overridden_Operation. * sem_elim.adb (Set_Eliminated): Replace test on Is_Overriding_Operation by test on the presence of Overridden_Operation. * sem_ch8.adb (Analyze_Subprogram_Renaming): Replace test on Is_Overriding_Operation by test on the presence of Overridden_Operation. Remove a redundant test on attribute Is_Overriding_Operation. * lib-xref.adb (Generate_Reference): Replace test on Is_Overriding_Operation by test on the presence of Overridden_Operation. (Output_References): Replace test on Is_Overriding_Operation by test on the presence of Overridden_Operation. * sem_disp.adb (Override_Dispatching_Operation): Replace test on Is_Overriding_Operation by test on the presence of Overridden_Operation. Add missing decoration of attribute Overridden_Operation. 2010-10-26 Robert Dewar <dewar@adacore.com> * sem_ch13.adb (Adjust_Record_For_Reverse_Bit_Order): Properly check RM 13.4.1(10). 2010-10-26 Bob Duff <duff@adacore.com> * sem_res.adb (Resolve_Actuals): In case of certain internally-generated type conversions (created by OK_Convert_To, so the Conversion_OK flag is set), avoid fetching the component type when it's not really an array type, but a private type completed by an array type. From-SVN: r165945
Diffstat (limited to 'gcc/ada/sem_ch6.adb')
-rw-r--r--gcc/ada/sem_ch6.adb54
1 files changed, 20 insertions, 34 deletions
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 95ca6e4..920706b 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -374,7 +374,7 @@ package body Sem_Ch6 is
elsif Warn_On_Redundant_Constructs
and then not Is_Dispatching_Operation (Designator)
- and then not Is_Overriding_Operation (Designator)
+ and then not Present (Overridden_Operation (Designator))
and then (not Is_Operator_Symbol_Name (Chars (Designator))
or else Scop /= Scope (Etype (First_Formal (Designator))))
then
@@ -1960,13 +1960,13 @@ package body Sem_Ch6 is
then
null;
- elsif not Is_Overriding_Operation (Spec_Id) then
+ elsif not Present (Overridden_Operation (Spec_Id)) then
Error_Msg_NE
("subprogram& is not overriding", Body_Spec, Spec_Id);
end if;
elsif Must_Not_Override (Body_Spec) then
- if Is_Overriding_Operation (Spec_Id) then
+ if Present (Overridden_Operation (Spec_Id)) then
Error_Msg_NE
("subprogram& overrides inherited operation",
Body_Spec, Spec_Id);
@@ -1991,7 +1991,7 @@ package body Sem_Ch6 is
end if;
elsif Style_Check -- ??? incorrect use of Style_Check!
- and then Is_Overriding_Operation (Spec_Id)
+ and then Present (Overridden_Operation (Spec_Id))
then
pragma Assert (Unit_Declaration_Node (Body_Id) = N);
Style.Missing_Overriding (N, Body_Id);
@@ -4196,7 +4196,7 @@ package body Sem_Ch6 is
Error_Msg_Sloc := Sloc (Op);
if Comes_From_Source (Op) or else No (Alias (Op)) then
- if not Is_Overriding_Operation (Op) then
+ if not Present (Overridden_Operation (Op)) then
Error_Msg_N ("\\primitive % defined #", Typ);
else
Error_Msg_N
@@ -4672,7 +4672,7 @@ package body Sem_Ch6 is
end if;
elsif Is_Subprogram (Subp) then
- Set_Is_Overriding_Operation (Subp);
+ Set_Overridden_Operation (Subp, Overridden_Subp);
end if;
-- If primitive flag is set or this is a protected operation, then
@@ -4728,10 +4728,9 @@ package body Sem_Ch6 is
end if;
elsif Must_Override (Spec) then
- if Is_Overriding_Operation (Subp) then
- null;
-
- elsif not Can_Override then
+ if No (Overridden_Operation (Subp))
+ and then not Can_Override
+ then
Error_Msg_NE ("subprogram & is not overriding", Spec, Subp);
end if;
@@ -4742,8 +4741,6 @@ package body Sem_Ch6 is
not Is_Predefined_File_Name
(Unit_File_Name (Get_Source_Unit (Subp)))
then
- Set_Is_Overriding_Operation (Subp);
-
-- If style checks are enabled, indicate that the indicator is
-- missing. However, at the point of declaration, the type of
-- which this is a primitive operation may be private, in which
@@ -7860,7 +7857,7 @@ package body Sem_Ch6 is
if Ada_Version >= Ada_2012
and then No (Overridden_Subp)
and then Is_Dispatching_Operation (S)
- and then Is_Overriding_Operation (S)
+ and then Present (Overridden_Operation (S))
then
Overridden_Subp := Overridden_Operation (S);
end if;
@@ -7982,22 +7979,18 @@ package body Sem_Ch6 is
Check_Operation_From_Private_View (S, E);
end if;
- -- In any case the implicit operation remains hidden by
- -- the existing declaration, which is overriding.
+ -- In any case the implicit operation remains hidden by the
+ -- existing declaration, which is overriding. Indicate that
+ -- E overrides the operation from which S is inherited.
- Set_Is_Overriding_Operation (E);
+ if Present (Alias (S)) then
+ Set_Overridden_Operation (E, Alias (S));
+ else
+ Set_Overridden_Operation (E, S);
+ end if;
if Comes_From_Source (E) then
Check_Overriding_Indicator (E, S, Is_Primitive => False);
-
- -- Indicate that E overrides the operation from which
- -- S is inherited.
-
- if Present (Alias (S)) then
- Set_Overridden_Operation (E, Alias (S));
- else
- Set_Overridden_Operation (E, S);
- end if;
end if;
return;
@@ -8145,22 +8138,17 @@ package body Sem_Ch6 is
if No (Next_Entity (Prev)) then
Set_Last_Entity (Current_Scope, Prev);
end if;
-
end if;
end if;
Enter_Overloaded_Entity (S);
- Set_Is_Overriding_Operation (S);
+ Set_Overridden_Operation (S, E);
Check_Overriding_Indicator (S, E, Is_Primitive => True);
-- If S is a user-defined subprogram or a null procedure
-- expanded to override an inherited null procedure, or a
-- predefined dispatching primitive then indicate that E
- -- overrides the operation from which S is inherited. It
- -- seems odd that Overridden_Operation isn't set in all
- -- cases where Is_Overriding_Operation is true, but doing
- -- so causes infinite loops in the compiler for implicit
- -- overriding subprograms. ???
+ -- overrides the operation from which S is inherited.
if Comes_From_Source (S)
or else
@@ -8176,8 +8164,6 @@ package body Sem_Ch6 is
then
if Present (Alias (E)) then
Set_Overridden_Operation (S, Alias (E));
- else
- Set_Overridden_Operation (S, E);
end if;
end if;