This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Parser clean ups and improvements.

Tested on i686-linux, committed on trunk.

Parentheses are not permitted around a range or subtype mark in a
membership test and other contexts, but the compiler did not check
for this. This patch introduces an appropriate error check:
     1. procedure b is
     2.    type r is range 1 .. 10;
     3.    mr : r;
     4. begin 
     5.    if mr in (r) then
        >>> parentheses not allowed for range or subtype mark
     6.       null;
     7.    end if;
     8. end;

There was also a bug in the parser forbiding the use of "abstract limited"
for derivations. After this patch this problem is fixed and
gnat.dg/specs/ compiles without errors.

Finally, the frontend was incorrectly accepting the reserved word "abstract" in
interface type definitions:
package P is
   type T1 is abstract interface;              --  ERROR
   type T2 is abstract limited interface;      --  ERROR
   type T3 is abstract protected interface;    --  ERROR
   type T4 is abstract task interface;         --  ERROR
   type T5 is abstract synchronized interface; --  ERROR
end P;
After this patch, the compilation of the previous test generates
the following errors:
Command: gcc -c -gnat05 -gnatf

Output: "abstract" not allowed in interface type definition (RM 3.9.4(2/2)) "tagged" expected "abstract" not allowed in interface type definition (RM 3.9.4(2/2)) "abstract" not allowed in interface type definition (RM 3.9.4(2/2)) "abstract" not allowed in interface type definition (RM 3.9.4(2/2)) "abstract" not allowed in interface type definition (RM 3.9.4(2/2))

2006-10-31  Robert Dewar  <>
	    Javier Miranda  <>
	* par-ch3.adb (P_Range_Or_Subtype_Mark): Check for bad parentheses
	(P_Type_Declaration): Remove barrier against the reserved word "limited"
	after "abstract" to give support to the new syntax of AARM 3.4 (2/2).
	(P_Type_Declaration): Minor code cleanup. Add support for synchronized
	private extensions.
	(P_Type_Declaration): Add the new actual Abstract_Present to every call
	to P_Interface_Type_Definition.
	(P_Interface_Type_Definition): Addition of one formal to report an error
	if the reserved word abstract has been previously found.
	(P_Identifier_Declarations): Update grammar rules. Handle parsing of an
	object renaming declaration with an access definition or subtype mark
	with a possible null exclusion.

	* par-ch9.adb: Minor error msg fix

	* par-load.adb: Add missing continuation mark to error msg

	* par-tchk.adb: (Wrong_Token): Code cleanup, use concatenation

Attachment: difs
Description: Text document

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]