-
Notifications
You must be signed in to change notification settings - Fork 1
Pragma Placement
The largest unit of composition for pragmas is the pragma block. A pragma block consists of an opening and closing delimiter and a pragma body.
pragmaBlock := '<*' pragmaBody '*>' ;The length of a pragma block including delimiters, line breaks and NUL termination shall not exceed a buffer size of 1024 octets.
The pragma body consists of one or more pragma clauses. There are three categories: standalone clauses, combinable clauses and implementation defined clauses.
pragmaBody := standalonePragmaClause | pragmaClauseSeq | implDefPragmaClause ;A pragma clause is the smallest unit of composition for pragmas. It consists of one or more tokens that encode the pragma's semantic information.
A pragma clause that may not be placed together with other clauses in a single pragma block is called a standalone pragma clause. Standalone pragma clauses are:
ENCODING,
ENDFWD,
FORWARD,
GENERATED,
MSG,
PRESETS,
TELL,
TICKET,
UNSET and
VARIANT.
A pragma clause that may be placed together with other clauses in a single pragma block is called a combinable pragma clause. Combinable pragma clauses are:
ABI,
ADDR,
ALIGN,
ARC,
BORROWER,
CONTIGUOUS,
DEPRECATED,
DETM,
FFI,
FFIDENT,
GC,
IN,
INLINE,
LEADBITS,
LOWLATENCY,
MEMALIGN,
NOINLINE,
NORETURN,
OUT,
OWNER,
PACKED,
PADBITS,
PRIVATETO,
PURE,
RELEASE,
RESIDENT,
RETAIN,
SINGLEASSIGN,
VOLATILE and
WEAK.
A pragma block may be followed by one or more adjacent pragma blocks.
Pragmas with file scope may be placed strictly in order
(1) ENCODING,
(2) VARIANT,
(3) GENERATED
possibly before or after a comment, but always before the module header.
Pragmas with module scope may be placed at the end of the module header of a top-level module before the terminating semicolon. Pragmas must not be placed in the header of any local module.
Pragmas with constant scope may be placed at the end of a constant definition before the terminating semicolon.
Pragmas with variable scope may be placed at the end of a variable definition before the terminating semicolon.
Pragmas with array scope may be placed at the end of an array type definition before the terminating semicolon.
Pragmas with record scope may be placed at the end of a record type definition's header before the field list sequence.
Pragmas with field list scope may be placed at the end of a record field list before the separating semicolon, or the record's terminating END.
Pragmas with field list item scope may be placed after a field's identifier before a separating comma, or the identifier list's terminating colon.
Pragmas with procedure type scope may be placed at the end of a procedure type definition before the terminating semicolon.
Pragmas with formal type list scope may be placed at the end of a formal type list before the separating semicolon or the terminating closing parenthesis.
Pragmas with formal type list item scope may be placed after a formal type's identifier before a separating comma or the formal type list's terminating closing parenthesis.
Pragmas with any other type scope may be placed at the end of the type definition before the terminating semicolon.
Pragmas with procedure scope may be placed at the end of a procedure header before the terminating semicolon.
Pragmas with parameter list scope may be placed at the end of a formal parameter list before the separating semicolon or the terminating closing parenthesis.
Pragmas with parameter list item scope may be placed after a parameter's identifier before a separating comma or the parameter list's terminating closing parenthesis.
Pragmas with point-forward scope may be placed anywhere within the module body where an import, a declaration or definition, a statement or a comment may appear
Pragmas without scope may be placed anywhere within a source file, after any and all pragmas with file scope, anywhere an import, a declaration or definition, a statement or a comment may appear.
No pragma may be placed in a list scope where a pragma has been placed in list item scope.
TYPE Foo = RECORD
a, b : Bar <*ALIGN=2*> ; (* valid *)
c <*ALIGN=2*>, d : Baz; (* valid *)
e <*PADBITS=2*>, f : Bam <*ALIGN=2*> (* invalid *)
END; (* Foo *)The following pragmas are mutually exclusive when applied to the same scope or overlapping scope: