James B
James B

Reputation: 9595

Suppressing Ada Restriction

Is it possible to suppress an ada restriction in a particular part of your source? For example, if I have defined the use of "pragma Restrictions(No_Dynamic_Priorities)" at a high level, but want this restriction to be ignored in a place where I know what I'm doing is safe, is it possible to suppress this restriction so the compiler no longer complains?

Upvotes: 0

Views: 70

Answers (1)

Simon Wright
Simon Wright

Reputation: 25491

You can’t explicitly negate a restriction; the only way to do it is to only apply the restriction to the units of your program that need it (that is, not "at a high level").

Restrictions are discussed in ARM 13.12, and (8.1) says

A restriction may impose requirements on some or all of the units comprising the partition. Unless otherwise specified for a particular restriction, such a requirement applies to all of the units comprising the partition and is enforced via a post-compilation check.

In your particular case, ARM D.7(9) says for No_Dynamic_Priorities

There are no semantic dependences on the package Dynamic_Priorities, and no occurrences of the attribute Priority.

which doesn’t override the general requirement; so I don’t think that what you want to do is allowed.

Upvotes: 4

Related Questions