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] Fix handling of boolean aspects


This patch fixes boolean aspects in two respects, first
there is no delay in evaluation of the arguments. The
following compiles clean and executes quietly in -gnata
mode.

     1. pragma Ada_2012;
     2. procedure baspect1 is
     3.    type X is array (0 .. 31) of Boolean with
     4.      Pack => True;
     5.    True : constant Boolean := False;
     6. begin
     7.    pragma Assert (X'Size = 32);
     8. end;

Second, it is no longer allowed to cancel inherited
aspects on derived types, as shown by this example:

     1. pragma Ada_2012;
     2. package baspect2 is
     3.    type P is array (0 .. 31) of Boolean with
     4.      Pack => True;
     5.    type U is array (0 .. 31) of Boolean with
     6.      Pack => False;
     7.    type DP1 is new P with
     8.      Pack => True;        -- OK
     9.    type DU1 is new U with
    10.      Pack => False;       -- OK
    11.    type DP2 is new P with
    12.      Pack => False;       -- ERROR
                     |
        >>> derived type "DP2" inherits aspect "pack", cannot cancel

    13.    type DU2 is new U with
    14.      Pack => True;        -- OK
    15. end;

In addition, the calling sequence of Analyze_Aspect_Specification
is changed to improve performance efficiency (some slow down in
compilation time was noticed from the previous implementation).

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

2011-08-02  Robert Dewar  <dewar@adacore.com>

	* sem_ch12.adb, sem_ch11.adb: New calling sequence for
	Analyze_Aspect_Specifications
	* sem_ch13.adb
	(Analyze_Aspect_Specifications): New handling for boolean aspects
	* sem_ch13.ads (Analyze_Aspect_Specifications): New calling sequence
	* sem_ch3.adb, sem_ch6.adb, sem_ch7.adb, sem_ch9.adb: New calling
	sequence for Analyze_Aspect_Specifications
	* sem_prag.adb (Analyze_Pragma): Remove use of Aspect_Cancel entirely
	* sinfo.ads, sinfo.adb (Aspect_Cancel): Remove, no longer used

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]