Skip to content

Issue #722: Document restrictions on types IH and EH in PSA#1027

Open
jafingerhut wants to merge 1 commit intop4lang:mainfrom
jafingerhut:issue722-restrictions-on-type-H
Open

Issue #722: Document restrictions on types IH and EH in PSA#1027
jafingerhut wants to merge 1 commit intop4lang:mainfrom
jafingerhut:issue722-restrictions-on-type-H

Conversation

@jafingerhut
Copy link
Collaborator

No description provided.

@jafingerhut
Copy link
Collaborator Author

Intended to address this issue #722

@hesingh
Copy link
Contributor

hesingh commented Oct 28, 2022

Why does section 7.2.7 of p4-16 working doc does not allow header_union as a member of struct?

@jafingerhut
Copy link
Collaborator Author

@hesingh If I go to the working draft of the P4_16 specification here: https://p4.org/p4-spec/docs/P4-16-working-spec.html#sec-type-nesting the first table I see has a row labeled "header_union", and in the column labeled "struct or tuple" the table entry says "allow". Do you see something different, or interpret that somehow as not being allowed?

@hesingh
Copy link
Contributor

hesingh commented Oct 28, 2022

I see

struct | allowed2 | error | allowed

7.2.7. Type nesting rules

The table below lists all types that may appear as members of headers, header unions, structs, and tuples. Note that int means an infinite-precision integer, without a width specified.

   

  |   |   |  
bit | allowed | error | allowed
int | allowed | error | allowed
varbit | allowed | error | allowed
int | error | error | error
void | error | error | error
error | error | error | allowed
match_kind | error | error | error
bool | allowed | error | allowed
enum | allowed1 | error | allowed
header | error | allowed | allowed
header stack | error | error | allowed
header_union | error | error | allowed
struct | allowed2 | error | allowed
tuple | error | error | allowed
  |   |   |  

Rationale: int does not have precise storage requirements, un

7.2.7. Type nesting rules The table below lists all types that may appear as members of headers, header unions, structs, and tuples. Note that int means an infinite-precision integer, without a width specified

@jafingerhut
Copy link
Collaborator Author

This row in that table:

struct | allowed2 | error | allowed

means:

struct is allowed as a member in a header (the column heading of the second column), but see footnote 2.
it is an error if you attempt to use a struct as a member of a header_union
struct is allowed as a member in a struct or tuple

@apinski-cavium
Copy link
Contributor

Note something is going on with the draft HTML generation though, see #1175 . The released spec 1.2.3 is correct.

@hesingh
Copy link
Contributor

hesingh commented Oct 28, 2022

@jafingerhut Duh, got it, sorry. Your proposal looks fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments