Skip to content

Pragma Scopes

Benjamin Kowarsch edited this page Jun 14, 2026 · 14 revisions

A pragma annotates a syntactic entity is is associated with. The pragma is said to have the scope of the syntactic entity. There are 17 categories.

File Scope, Module Scope, Constant Scope, Variable Scope, Array Scope, Record Scope, Field List Scope, Field List Item Scope, Procedure Type Scope, Formal Type List Scope, Formal Type List Iten Scope, Other Type Scope, Procedure Scope, Parameter List Scope, Single Parameter Scope, Point-Forward Scope, No Scope.

Overview

pragma scope table

File Scope

Pragmas with file scope apply to the entire file. The following pragmas always have file scope:

ENCODING, VARIANT and GENERATED.

Module Scope

Pragmas with module scope apply to the module. The following pragmas always have module scope:

PRIVATETO, GC, ARC, ABI and FFI.

Whereas the following pragmas may have module scope, depending on their placement.

ALIGN and DEPRECATED.

Constant Scope

Pragmas with constant scope apply to a constant.

Pragma DEPRECATED may have constant scope, depending on its placement.

Variable Scope

Pragmas with variable scope apply to a variable. The following pragmas always have variable scope:

ADDR, SINGLEASSIGN and VOLATILE.

The following pragmas may have variable scope, depending on their placement.

ALIGN, BORROWER, DEPRECATED, FFIDENT, LOWLATENCY and OWNER.

Array Scope

Pragmas with array scope apply to an array type. The following pragmas may have array scope, depending on their placement.

ALIGN and DEPRECATED.

Record Scope

Pragmas with record scope apply to a record type. The following pragmas always have record scope:

LEADBITS and PACKED.

The following pragmas may have record scope, depending on their placement.

ALIGN and DEPRECATED.

Field List Scope

Pragmas with field list scope apply to a record field list. The following pragmas may have field list scope, depending on their placement.

ALIGN, DEPRECATED and PADBITS.

Field List Item Scope

Pragmas with field list item scope apply to a single record field within a field list. The following pragmas may have field list item scope, depending on their placement.

ALIGN, DEPRECATED and PADBITS.

Procedure Type Scope

Pragmas with procedure type scope apply to a procedure type. The following pragmas may have procedure scope, depending on their placement.

DETM, INLINE, NOINLINE, NORETURN, PURE, WEAK. DEPRECATED.

Formal Type List Scope

Pragmas with formal type list scope apply to a procedure type's formal type list. The following pragmas may have formal type list scope, depending on their placement.

BORROWER, IN, LOWLATENCY, OUT and OWNER.

Formal Type List Item Scope

Pragmas with formal type list item scope apply to a single formal type within a procedure type's formal type list. The following pragmas may have formal type list item scope, depending on their placement.

BORROWER, IN, LOWLATENCY, OUT and OWNER.

Other Type Scope

Pragmas with other type scope apply to any type other than record types. The following pragmas may have type scope, depending on their placement.

ALIGN and DEPRECATED.

Procedure Scope

Pragmas with procedure scope apply to a procedure. The following pragmas always have procedure scope:

RELEASE and RETAIN.

The following pragmas may have procedure scope, depending on their placement.

ADDR, FFIDENT, DEPRECATED, DETM, INLINE, NOINLINE, NORETURN, PURE and WEAK.

Parameter List Scope

Pragmas with parameter list scope apply to a procedure's formal parameter list. The following pragmas may have parameter list scope, depending on their placement.

BORROWER, IN, LOWLATENCY, OUT and OWNER.

Parameter List Item Scope

Pragmas with parameter list item scope apply to a single parameter within a procedure's formal parameter list. The following pragmas may have parameter list item scope, depending on their placement.

BORROWER, IN, LOWLATENCY, OUT and OWNER.

Point-Forward Scope

Pragmas with point-forward scope apply from the point forward where they are placed. The following parameters always have point-forward scope:

ENDFWD, FORWARD, PRESETS and UNSET.

No Scope

Pragmas without scope do not apply to any syntactic entity. The following pragmas are always without scope:

MSG, TELL and TICKET.