summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch4.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2004-05-10 16:18:54 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2004-05-10 16:18:54 +0000
commite161d1a33f33dd457c94a584e39ffcb8250afbf6 (patch)
treeb05f1a8a1cace3f818e7721e71eb91c837736b59 /gcc/ada/sem_ch4.adb
parent3a00c4d1c8f03bffe50ec2ac68d2eb2efea28032 (diff)
downloadgcc-e161d1a33f33dd457c94a584e39ffcb8250afbf6.tar.gz
2004-05-10 Doug Rupp <rupp@gnat.com>
* 5qsystem.ads: Remove Short_Address subtype declaration. Moved to system.aux_dec. * s-auxdec.ads: Add Short_Address subtype (moved here from System). * Makefile.in: [VMS]: Add translation for 5qauxdec.ads. * init.c: [VMS] Macroize LIB$ calls for IA64 and Alpha. Fixes undefined symbols in IA64 gnatlib. * 5vinmaop.adb: Reference s-auxdec for Short_Address. * 5xsystem.ads, 5vsystem.ads: Back out last change (addition of subtype Short_Address). This will be moved to system.auxdec. 2004-05-10 Thomas Quinot <quinot@act-europe.fr> * sem_util.adb: Replace test for presence of a node that is always present with a call to Discard_Node. * sem_ch10.adb (Analyze_Compilation_Unit): Remove superfluous call to Analyze on the library unit node after generation of distribution stub constructs. The call was a no-op because Unit_Node has already been Analyzed, and the tree fragments for the distribution stubs are analyzed as they are inserted in Exp_Dist. Update comment regarding to distribution stubs to reflect that we do not generate stub in separate files anymore. * einfo.ads: Clarify the fact that a tagged private type has the E_Record_Type_With_Private Ekind. * erroutc.adb: Minor reformatting * erroutc.ads (Max_Msg_Length): Increase to cover possible larger values if line length is increased using -gnatyM (noticed during code reading). * eval_fat.adb: Minor reformatting Put spaces around exponentiation operator 2004-05-10 Ed Schonberg <schonberg@gnat.com> PR ada/15005 * sem_util.adb (Is_Dependent_Component_Of_Mutable_Object): If prefix has been rewritten as an explicit dereference, retrieve type of original node to check for possibly unconstrained record type. 2004-05-10 Ed Schonberg <schonberg@gnat.com> * exp_ch7.adb (Check_Visibly_Controlled): If given operation is not overriding, use the operation of the parent unconditionally. * sem_ch4.adb (Remove_Address_Interpretations): Remove address operation when either operand is a literal, to avoid further ambiguities. * sem_ch6.adb (New_Overloaded_Entity): If new entity is inherited and overridden by a previous explicit declaration, mark the previous entity as overriding. * sem_disp.adb (Check_Dispatching_Operation): New predicate Is_Visibly_Controlled, to determine whether a declaration of a primitive control operation for a derived type overrides an inherited one. Add warning if the explicit declaration does not override. 2004-05-10 Vincent Celier <celier@gnat.com> * gnatls.adb (Gnatls): Initialize Snames, to avoid assertion error in some cases when the sources are no longer present. * make.adb (Collect_Arguments): Fail if an external source, not part of any project need to be compiled, when switch -x has not been specified. * makeusg.adb: Document new switch -x * opt.ads (External_Unit_Compilation_Allowed): New Boolean flag, defaulted to False. * switch-m.adb (Scan_Make_Switches): New switch -x * vms_data.ads: Add VMS qualifier /NON_PROJECT_UNIT_COMPILATION for gnatmake switch -x. * gnat_ugn.texi: Document new gnatmake switch -x 2004-05-10 Eric Botcazou <ebotcazou@act-europe.fr> * misc.c (gnat_init_options): Set flag_zero_initialized_in_bss to 0. * utils.c (create_var_decl): Do not modify the DECL_COMMON flag. (process_attributes): Likewise. 2004-05-10 Joel Brobecker <brobecker@gnat.com> * s-inmaop.ads: Fix spelling mistake in one of the comments. 2004-05-10 Robert Dewar <dewar@gnat.com> * gnat_ugn.texi: Document that for config pragma files, the maximum line length is always 32767. * gnat_rm.texi: For pragma Eliminate, note that concatenation of string literals is now allowed. * gnat-style.texi: Remove statement about splitting long lines before an operator rather than after, since we do not follow this rule at all. Clarify rule (really lack of rule) for spaces around exponentiation * sem_elim.adb: Allow concatenation of string literals as well as a single string literal for pragma arguments. * sem_prag.ads, sem_prag.adb: (Is_Config_Static_String): New function * a-textio.adb (Terminate_Line): Do not add line feed if nothing written for append case. * frontend.adb: Changes to avoid checking max line length in config pragma files. * g-os_lib.ads: Minor reformatting * mlib-utl.adb: Do not define Max_Line_Length locally (definition was wrong in any case. Instead use standard value. Noticed during code reading. * opt.ads (Max_Line_Length): New field, used to implement removal of limitation on length of lines when scanning config pragma files. * osint.ads, prj-dect.adb, prj-strt.adb, prj-tree.adb, makeutl.ads, makeutl.adb: Minor reformatting * scn.adb: Do not check line length while scanning config pragma files Do not check line length while scanning out license information * scng.adb: Changes to avoid line length checks while parsing config pragma files. 2004-05-10 GNAT Script <nobody@gnat.com> * Make-lang.in: Makefile automatically updated git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@81671 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_ch4.adb')
-rw-r--r--gcc/ada/sem_ch4.adb95
1 files changed, 53 insertions, 42 deletions
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index 954d4d343cb..4f9383142e5 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -4359,17 +4359,19 @@ package body Sem_Ch4 is
-- subprograms are used to hide its operators, they will be
-- truly hidden.
- procedure Remove_Address_Interpretations;
+ type Operand_Position is (First_Op, Second_Op);
+
+ procedure Remove_Address_Interpretations (Op : Operand_Position);
-- Ambiguities may arise when the operands are literal and the
-- address operations in s-auxdec are visible. In that case, remove
-- the interpretation of a literal as Address, to retain the semantics
-- of Address as a private type.
------------------------------------
- -- Remove_Address_Intereprtations --
+ -- Remove_Address_Interpretations --
------------------------------------
- procedure Remove_Address_Interpretations is
+ procedure Remove_Address_Interpretations (Op : Operand_Position) is
Formal : Entity_Id;
begin
@@ -4378,13 +4380,11 @@ package body Sem_Ch4 is
while Present (It.Nam) loop
Formal := First_Entity (It.Nam);
- if Is_Descendent_Of_Address (Etype (Formal))
- or else
- (Present (Next_Entity (Formal))
- and then
- Is_Descendent_Of_Address
- (Etype (Next_Entity (Formal))))
- then
+ if Op = Second_Op then
+ Formal := Next_Entity (Formal);
+ end if;
+
+ if Is_Descendent_Of_Address (Etype (Formal)) then
Remove_Interp (I);
end if;
@@ -4417,38 +4417,43 @@ package body Sem_Ch4 is
Get_Next_Interp (I, It);
end loop;
- -- Remove corresponding predefined operator, which is
- -- always added to the overload set, unless it is a universal
- -- operation.
-
if No (Abstract_Op) then
return;
- -- Remove address interpretations if we have a universal
- -- interpretation. This avoids literals being interpreted
- -- as type Address, which is never appropriate.
-
elsif Nkind (N) in N_Op then
- if Nkind (N) in N_Unary_Op
- and then Present (Universal_Interpretation (Right_Opnd (N)))
- then
- Remove_Address_Interpretations;
+ -- Remove interpretations that treat literals as addresses.
+ -- This is never appropriate.
- elsif Nkind (N) in N_Binary_Op
- and then Present (Universal_Interpretation (Right_Opnd (N)))
- and then Present (Universal_Interpretation (Left_Opnd (N)))
- then
- Remove_Address_Interpretations;
+ if Nkind (N) in N_Binary_Op then
+ declare
+ U1 : constant Boolean :=
+ Present (Universal_Interpretation (Right_Opnd (N)));
+ U2 : constant Boolean :=
+ Present (Universal_Interpretation (Left_Opnd (N)));
- else
- Get_First_Interp (N, I, It);
- while Present (It.Nam) loop
- if Scope (It.Nam) = Standard_Standard then
- Remove_Interp (I);
+ begin
+ if U1 and then not U2 then
+ Remove_Address_Interpretations (Second_Op);
+
+ elsif U2 and then not U1 then
+ Remove_Address_Interpretations (First_Op);
end if;
- Get_Next_Interp (I, It);
- end loop;
+ if not (U1 and U2) then
+
+ -- Remove corresponding predefined operator, which is
+ -- always added to the overload set.
+
+ Get_First_Interp (N, I, It);
+ while Present (It.Nam) loop
+ if Scope (It.Nam) = Standard_Standard then
+ Remove_Interp (I);
+ end if;
+
+ Get_Next_Interp (I, It);
+ end loop;
+ end if;
+ end;
end if;
elsif Nkind (N) = N_Function_Call
@@ -4459,18 +4464,24 @@ package body Sem_Ch4 is
and then
Nkind (Selector_Name (Name (N))) = N_Operator_Symbol))
then
+
declare
Arg1 : constant Node_Id := First (Parameter_Associations (N));
+ U1 : constant Boolean :=
+ Present (Universal_Interpretation (Arg1));
+ U2 : constant Boolean :=
+ Present (Next (Arg1)) and then
+ Present (Universal_Interpretation (Next (Arg1)));
begin
- if Present (Universal_Interpretation (Arg1))
- and then
- (No (Next (Arg1))
- or else Present (Universal_Interpretation (Next (Arg1))))
- then
- Remove_Address_Interpretations;
+ if U1 and then not U2 then
+ Remove_Address_Interpretations (First_Op);
- else
+ elsif U2 and then not U1 then
+ Remove_Address_Interpretations (Second_Op);
+ end if;
+
+ if not (U1 and U2) then
Get_First_Interp (N, I, It);
while Present (It.Nam) loop
if Scope (It.Nam) = Standard_Standard
@@ -4486,7 +4497,7 @@ package body Sem_Ch4 is
end if;
-- If the removal has left no valid interpretations, emit
- -- error message now an label node as illegal.
+ -- error message now and label node as illegal.
if Present (Abstract_Op) then
Get_First_Interp (N, I, It);