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] Pre- and post conditions on generic units that are not compilatiom units.


When scanning the list of declaration preceeding a pre/postcondition, to locate
the subprogram to which it applies, we skip over other pragmas that may have
been rewritten. We use the original_node to determine their source meaning. If
the node denotes a generic unit we must use the rewritten tree which contains
the semantic information, not the original undecorated tree.

The following must compile quietly:

package Precondition2 is
   generic
      type T_Item is private;

   function F (T : in T_Item; I : in Integer) return Integer;
   pragma Precondition (I > 0);
end Precondition2;

package body Precondition2 is
   function F (T : in T_Item; I : Integer) return Integer is
      pragma Precondition (I > 0);
   begin
      return I;
   end F;
end Precondition2;

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

2008-08-04  Ed Schonberg  <schonberg@adacore.com>

	* sem_prag.adb (Check_Precondition_Postcondition): When scanning the
	list of declaration to find previous subprogram, do not go to the
	original node of a generic unit.

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]