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] Improve error message on misplaced 'Result in Ada 2012 mode


In Ada 2012 mode, 'Result is allowed both in Postcondition pragma and in aspect
Post. The error message issued by GNAT was not mentioning aspect Post. This is
now fixed.

Compiling the following code in mode Ada 2012 raises the error:

$ gcc -c -gnat2012 p.adb
p.ads:3:18: "Result" attribute can only appear in function Postcondition pragma or Post aspect

---
package P is
   function F return Boolean
     with Pre => F'Result;
end P;
---
package body P is
   function F return Boolean is
   begin
      return True;
   end F;
end P;

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

2011-08-04  Yannick Moy  <moy@adacore.com>

	* sem_attr.adb (Result): modify error message to take into account Post
	aspect when compiling Ada 2012 (or newer) code.

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]