HOME
| OPENMP API Specification: "Version 5.2 -- GIT rev 95b2e3a44"

3.2  Clause Format

This section defines the format and categories of OpenMP clauses. OpenMP clauses are specified as part of a directive-specification. Clauses are optional and, thus, may be omitted from a directive-specification unless otherwise specified. The order in which clauses appear on directives is not significant unless otherwise specified. A clause-specification specifies each OpenMP clause in a directive-specification where clause-specification for inarguable clauses is simply:  

 
clause-name  

Inarguable clauses often form natural groupings that have similar semantic effect and so are frequently specified as a clause grouping. For argument-modified clauses, clause-specification is:  

 
clause-name[(clause-argument-specification [clause-argument-specification [;...]])]  
White space in a clause-name is prohibited. White space within a clause-argument-specification and between another clause-argument-specification is optional.

An implementation may allow clauses with clause names that start with the ompx_ prefix for use on any OpenMP directive, and the format and semantics of any such clause is implementation defined. All other clause names are reserved.

For argument-modified clauses, the first clause-argument-specification is required unless otherwise explicitly stated while additional ones are only permitted on clauses that explicitly allow them. When the first one is omitted, the syntax is identical to an inarguable clause. Clause arguments may be unmodified or modified. For an unmodified argument, clause-argument-specification is:  

 
clause-argument-list  

Unless otherwise specified, modified arguments are pre-modified, for which the format is:  

 
[modifier-specification [[, modifier-specification] ,... ] :]clause-argument-list  

A few modified arguments are explicitly specified as post-modified, for which the format is:  

 
clause-argument-list[: modifier-specification [[, modifier-specification] ,... ]]  

For many OpenMP clauses, clause-argument-list is an OpenMP argument list, which is a comma-separated list of a specific kind of list items (see Section 3.2.1), in which case the format of clause-argument-list is:  

 
argument-name  

For all other OpenMP clauses, clause-argument-list is a comma-separated list of arguments so the format is:  

 
argument-name [, argument-name [,... ]]  

In most of these cases, the list only has a single item so the format of clause-argument-list is again:  

 
argument-name  

In all cases, white space in clause-argument-list is optional.

Clause argument modifiers may be simple or complex. Almost all clause arguments are simple, for which the format of modifier-specification is:  

 
modifier-name  

The format of a complex modifier is:  

 
modifier-name(modifier-parameter-specification)  

where modifier-parameter-specification is a comma-separated list of arguments as defined above for clause-argument-list. The position of each modifier-argument-name in the list is significant.

Each argument-name and modifier-name is an OpenMP term that may be used in the definitions of the clause and any directives on which the clause may appear. Syntactically, each of these terms is one of the following:

A particular lexical instantiation of an argument specifies a parameter of the clause, while a lexical instantiation of a modifier and its parameters affects how or when the argument is applied.

The order of arguments must match the order in the clause-specification. The order of modifiers in a clause-argument-specification is not significant unless otherwise specified.

General syntactic properties govern the use of clauses, clause and directive arguments, and modifiers in an OpenMP directive. These properties are summarized in 3.1, along with the respective default properties for clauses, arguments and modifiers.

tableSyntactic Properties for Clauses, Arguments and Modifiers

TABLE 3.1: Syntactic Properties for Clauses, Arguments and Modifiers
Property Property Description Inverse Property Clause defaults Argument defaults Modifier defaults
required must be present optional optional required optional
unique may appear at most once repeatable repeatable unique unique
exclusive must appear alone compatible compatible compatible compatible
ultimate must lexically appear last (or first for a modifier in a post-modified clause) free free free free

A clause, argument or modifier with a given property implies that it does not have the corresponding inverse property, and vice versa. The ultimate property implies the unique property. If all arguments and modifiers of an argument-modified clause or directive are optional and omitted then the parentheses of the syntax for the clause or directive is also omitted.

Arguments and modifiers that are expressions may additionally have any of the following value properties: constant, positive, non-negative, and region-invariant.

In this example, clause-specification is depend(inout: d), clause-name is depend and clause-argument-specification is inout: d. The depend clause has an argument for which argument-name is locator-list, which syntactically is the OpenMP locator list d in the example. Similarly, the depend clause accepts a simple clause modifier with the name task-dependence-type. Syntactically, task-dependence-type is the keyword inout in the example.
 
#pragma omp depobj(o) depend(inout: d)  

The clauses that a directive accepts may form sets. These sets may imply restrictions on their use on that directive or may otherwise capture properties for the clauses on the directive. While specific properties may be defined for a clause set on a particular directive, the following clause-set properties have general meanings and implications as indicated by the restrictions below: required, unique, and exclusive.

All clauses that are specified as a clause grouping form a clause set for which properties are specified with the specification of the grouping. Some directives accept a clause grouping for which each member is a directive-name of a directive that has a specific property. These groupings are required, unique and exclusive unless otherwise specified.

Restrictions

Restrictions to clauses and clause sets are as follows:

Cross References

  3.2.1  OpenMP Argument Lists
  3.2.2  Reserved Locators
  3.2.3  OpenMP Operations
  3.2.4  Array Shaping
  3.2.5  Array Sections
  3.2.6  iterator Modifier