Skip to content

Commit

Permalink
Merge branch 'main' into local-compile-time-known
Browse files Browse the repository at this point in the history
  • Loading branch information
jnfoster committed Jun 3, 2024
2 parents f3dc4b9 + 71679a2 commit f92db37
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 5 additions & 7 deletions p4-16/spec/P4-16-spec.mdk
Original file line number Diff line number Diff line change
Expand Up @@ -1457,12 +1457,7 @@ following expressions are legal l-values:
~ Begin P4Grammar
[INCLUDE=grammar.mdk:prefixedNonTypeName]

lvalue
: prefixedNonTypeName
| lvalue "." member
| lvalue "[" expression "]"
| lvalue "[" expression ":" expression "]"
;
[INCLUDE=grammar.mdk:lvalue]
~ End P4Grammar

- Identifiers of a base or derived type.
Expand Down Expand Up @@ -1511,7 +1506,8 @@ Each parameter may be labeled with a direction:
- For anything other than an action, e.g. a control, parser, or
function, a directionless parameter means that the value supplied
as an argument in a call must be a compile-time known value
(see Section [#sec-compile-time-known]).
(see Section [#sec-compile-time-known]). Note that a directionless
parameter of extern object type is passed by reference.
- For an action, a directionless parameter indicates that it is
"action data". See Section [#sec-actions] for the meaning of
action data, but its meaning includes the following possibilities:
Expand Down Expand Up @@ -8201,13 +8197,15 @@ diagnostics.
The P4 core library contains two overloaded declarations for a
`static_assert` function, as follows:

~ Begin P4Example
/// Static assert evaluates a boolean expression
/// at compilation time. If the expression evaluates to
/// false, compilation is stopped and the corresponding message is printed.
extern bool static_assert(bool check, string message);

/// Like the above but using a default message.
extern bool static_assert(bool check);
~ End P4Example

These functions both return boolean values. Since the parameters are
directionless, these functions require compile-time known values as
Expand Down
4 changes: 3 additions & 1 deletion p4-16/spec/grammar.mdk
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,8 @@ initializer

// BEGIN:functionDeclaration
functionDeclaration
: functionPrototype blockStatement
: annotations functionPrototype blockStatement
| functionPrototype blockStatement
;
// END:functionDeclaration

Expand Down Expand Up @@ -1002,6 +1003,7 @@ lvalue
| lvalue "." member
| lvalue "[" expression "]"
| lvalue "[" expression ":" expression "]"
| "(" lvalue ")"
;
// END:lvalue

Expand Down

0 comments on commit f92db37

Please sign in to comment.