This is the mail archive of the gcc-patches@gcc.gnu.org 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] Parametrized expressions must be parenthesized


This patch implements the restriction that parametrized expressions
must be parenthesized, which was missed in the original implementation.
The following test program is compiled first with -gnat2012 then with
-gnat2005.

     1. package PexpParen is
     2.    function F (A : Integer)
     3.      return Integer is A * A;
                               |
        >>> parametrized expression must be enclosed in parentheses

     4.    function G (A : Integer)
     5.      return Integer is (A * A);
     6. end;

     1. package PexpParen is
     2.    function F (A : Integer)
     3.      return Integer is A * A;
                               |
        >>> parametrized expression must be enclosed in parentheses
        >>> parametrized expression is an Ada 2012 feature
        >>> unit must be compiled with -gnat2012 switch

     4.    function G (A : Integer)
     5.      return Integer is (A * A);
                               |
        >>> parametrized expression is an Ada 2012 feature
        >>> unit must be compiled with -gnat2012 switch

     6. end;

Tested on x86_64-pc-linux-gnu, committed on trunk

2010-10-07  Robert Dewar  <dewar@adacore.com>

	* par-ch3.adb, par-ch6.adb, par-ch7.adb, par-ch9.adb, par-ch10.adb: Add
	Pexp to Pf_Rec constants
	(P_Subprogram): Expression is always enclosed in parentheses
	* par.adb (Pf_Rec): add Pexp flag for parametrized expression
	* sinfo.ads (N_Parametrized_Expression): Expression must be in parens

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]