[Ada] Spurious error on the placement of aspect Global
authorHristian Kirtchev <kirtchev@adacore.com>
Tue, 31 Jul 2018 09:55:59 +0000 (09:55 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Tue, 31 Jul 2018 09:55:59 +0000 (09:55 +0000)
commit007443a0c1bb11ae55a43d562f070aba88a607c6
tree26e10abace19553f3fd5d6ff39ece5add8a893f8
parent76ed5f08f4462d7d22bc6cda3624e131e65bdd52
[Ada] Spurious error on the placement of aspect Global

This patch modifies the expansion of stand-alone subprogram bodies that appear
in the body of a protected type to properly associate aspects and pragmas to
the newly created spec for the subprogram body. As a result, the annotations
are properly associated with the initial declaration of the subprogram.

2018-07-31  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

* exp_ch9.adb (Analyze_Pragmas): New routine.
(Build_Private_Protected_Declaration): Code clean up. Relocate
relevant aspects and pragmas from the stand-alone body to the
newly created spec.  Explicitly analyze any pragmas that have
been either relocated or produced by the analysis of the
aspects.
(Move_Pragmas): New routine.
* sem_prag.adb (Find_Related_Declaration_Or_Body): Recognize the
case where a pragma applies to the internally created spec for a
stand-along subprogram body declared in a protected body.

gcc/testsuite/

* gnat.dg/global.adb, gnat.dg/global.ads: New testcase.

From-SVN: r263097
gcc/ada/ChangeLog
gcc/ada/exp_ch9.adb
gcc/ada/sem_prag.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/global.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/global.ads [new file with mode: 0644]