[Ada] Spurious error on legal synchronized constituent
authorHristian Kirtchev <kirtchev@adacore.com>
Wed, 30 May 2018 08:57:21 +0000 (08:57 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Wed, 30 May 2018 08:57:21 +0000 (08:57 +0000)
commit56a05ce0839d83fbbbc7e57d085ca483b884b805
tree4522a0436bfd55179c72a8e6645bd2499cfdcb5d
parent131780ac08a8dfc1b9c14a9d5c38575fcc34b205
[Ada] Spurious error on legal synchronized constituent

This patch corrects the predicate which determines whether an entity denotes a
synchronized object as per SPARK RM 9.1. to account for a case where the object
is not atomic, but its type is.

The patch also cleans up various atomic object-related predicates.

2018-05-30  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

* sem_util.adb (Is_Atomic_Object): Cleaned up. Split the entity logic
in a separate routine.
(Is_Atomic_Object_Entity): New routine.
(Is_Atomic_Prefix): Cleaned up.
(Is_Synchronized_Object): Check that the object is atomic, or its type
is atomic.
(Object_Has_Atomic_Components): Removed.
* sem_util.ads (Is_Atomic_Object): Reword the comment on usage.
(Is_Atomic_Object_Entity): New routine.

gcc/testsuite/

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

From-SVN: r260933
gcc/ada/ChangeLog
gcc/ada/sem_util.adb
gcc/ada/sem_util.ads
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/synchronized1.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/synchronized1.ads [new file with mode: 0644]