Remove spurious error on attribute Count with expansion disabled in Ada
This commit removes a false error on the `Count` attribute in specific scenarios where expansion is disabled.
This commit fixes an issue where the Ada compiler would incorrectly flag an error when the Count attribute appeared in the barrier of a protected entry while expansion was disabled (e.g., due to the -gnatc switch or when using GNATprove). The compiler now correctly handles the unexpanded Count attribute in these situations, even when the Pure_Barriers restriction is enabled.
In Details
The issue was in exp_ch9.adb within the Is_Pure_Barrier function. The code now correctly handles the unexpanded attribute Count when expansion is disabled. This scenario arises when using switches like -gnatc or in GNATprove mode, where attribute expansion might not occur.
For Context
In Ada, a 'protected entry' is a mechanism for synchronizing access to shared data between tasks. A 'barrier' is a condition that must be true before a task can proceed through a protected entry. The Count attribute returns the number of tasks waiting on a protected entry. This commit fixes a bug where the compiler would incorrectly report an error when using Count in a barrier under certain conditions (when expansion is disabled, often used during formal verification with GNATprove or with specific compiler flags).