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] Aspect specifications on subprogram renaming declarations


The syntax of Ada 2012 accepts aspect specifications on renaming declarations,
but no language-defined aspects exist for them, so that pre- and postconditions
on these declarations must be rejected.

Compiling db.ads in Ada 2012 mode must yield:

    db.ads:9:07: incorrect placement of aspect "PRE"
    db.ads:10:07: incorrect placement of aspect "POST"
    db.ads:11:06: incorrect placement of aspect "TEST_CASE"

---
package DB is
   type Account is tagged record
      X : Integer;
   end record;

   procedure Open (It : out Account; V : Integer);
   procedure Op (It : out Account; V : Integer) renames Open
   with
      Pre      => (V > 0),
      Post     => (It.X = V),
     Test_Case => (Name     => "existing account",
                   Mode     => Nominal,
                   Ensures  =>  T.X > 0);
end DB;

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

2011-11-23  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch8.adb (Analyze_Subprogram_Renaming_Declaration):
	If the declaration has aspects, analyze them so they can be
	properly rejected.

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]