r260507 - in /trunk/gcc: ada/ChangeLog ada/sem_...

pmderodat@gcc.gnu.org pmderodat@gcc.gnu.org
Tue May 22 13:18:00 GMT 2018


Author: pmderodat
Date: Tue May 22 13:17:58 2018
New Revision: 260507

URL: https://gcc.gnu.org/viewcvs?rev=260507&root=gcc&view=rev
Log:
[Ada] No error on misplaced pragma Pure_Function

This patch fixes an issue whereby placement of the pragma/aspect Pure_Function
was not verified to have been in the same declarative part as the function
declaration incorrectly allowing it to appear after a function body or in a
different region like a private section.

2018-05-22  Justin Squirek  <squirek@adacore.com>

gcc/ada/

	* sem_ch12.adb (In_Same_Declarative_Part): Moved to sem_util.
	(Freeze_Subprogram_Body, Install_Body): Modify calls to
	In_Same_Declarative_Part.
	* sem_prag.adb (Analyze_Pragma-Pragma_Pure_Function): Add check to
	verify pragma declaration is within the same declarative list with
	corresponding error message.
	* sem_util.adb, sem_util.ads (In_Same_Declarative_Part): Moved from
	sem_ch12.adb and generalized to be useful outside the scope of
	freezing.

gcc/testsuite/

	* gnat.dg/pure_function1.adb, gnat.dg/pure_function1.ads,
	gnat.dg/pure_function2.adb, gnat.dg/pure_function2.ads: New testcases.

Added:
    trunk/gcc/testsuite/gnat.dg/pure_function1.adb
    trunk/gcc/testsuite/gnat.dg/pure_function1.ads
    trunk/gcc/testsuite/gnat.dg/pure_function2.adb
    trunk/gcc/testsuite/gnat.dg/pure_function2.ads
Modified:
    trunk/gcc/ada/ChangeLog
    trunk/gcc/ada/sem_ch12.adb
    trunk/gcc/ada/sem_prag.adb
    trunk/gcc/ada/sem_util.adb
    trunk/gcc/ada/sem_util.ads
    trunk/gcc/testsuite/ChangeLog



More information about the Gcc-cvs mailing list