forked from p4lang/p4c
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When errors happen do not bug-check; fixes p4lang#2290
- Loading branch information
Mihai Budiu
committed
Apr 7, 2020
1 parent
90c7d7d
commit 7abd726
Showing
5 changed files
with
142 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#include <core.p4> | ||
#include <v1model.p4> | ||
|
||
header ethernet_t { | ||
bit<48> dst_addr; | ||
bit<48> src_addr; | ||
bit<16> eth_type; | ||
} | ||
|
||
|
||
header simple_header { | ||
bit<8> a; | ||
} | ||
|
||
header nested_header { | ||
simple_header s; | ||
} | ||
|
||
struct Headers { | ||
ethernet_t eth_hdr; | ||
nested_header n; | ||
} | ||
|
||
struct Meta { | ||
} | ||
|
||
|
||
parser p(packet_in pkt, out Headers hdr, inout Meta m, inout standard_metadata_t sm) { | ||
state start { | ||
transition parse_hdrs; | ||
} | ||
state parse_hdrs { | ||
pkt.extract(hdr.eth_hdr); | ||
transition accept; | ||
} | ||
} | ||
|
||
control ingress(inout Headers h, inout Meta m, inout standard_metadata_t sm) { | ||
|
||
apply { | ||
|
||
} | ||
} | ||
|
||
control vrfy(inout Headers h, inout Meta m) { apply {} } | ||
|
||
control update(inout Headers h, inout Meta m) { apply {} } | ||
|
||
control egress(inout Headers h, inout Meta m, inout standard_metadata_t sm) { apply {} } | ||
|
||
control deparser(packet_out b, in Headers h) { apply {b.emit(h);} } | ||
|
||
V1Switch(p(), vrfy(), ingress(), egress(), update(), deparser()) main; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#include <core.p4> | ||
#include <v1model.p4> | ||
|
||
header ethernet_t { | ||
bit<48> dst_addr; | ||
bit<48> src_addr; | ||
bit<16> eth_type; | ||
} | ||
|
||
header simple_header { | ||
bit<8> a; | ||
} | ||
|
||
header nested_header { | ||
simple_header s; | ||
} | ||
|
||
struct Headers { | ||
ethernet_t eth_hdr; | ||
nested_header n; | ||
} | ||
|
||
struct Meta { | ||
} | ||
|
||
parser p(packet_in pkt, out Headers hdr, inout Meta m, inout standard_metadata_t sm) { | ||
state start { | ||
transition parse_hdrs; | ||
} | ||
state parse_hdrs { | ||
pkt.extract(hdr.eth_hdr); | ||
transition accept; | ||
} | ||
} | ||
|
||
control ingress(inout Headers h, inout Meta m, inout standard_metadata_t sm) { | ||
apply { | ||
} | ||
} | ||
|
||
control vrfy(inout Headers h, inout Meta m) { | ||
apply { | ||
} | ||
} | ||
|
||
control update(inout Headers h, inout Meta m) { | ||
apply { | ||
} | ||
} | ||
|
||
control egress(inout Headers h, inout Meta m, inout standard_metadata_t sm) { | ||
apply { | ||
} | ||
} | ||
|
||
control deparser(packet_out b, in Headers h) { | ||
apply { | ||
b.emit(h); | ||
} | ||
} | ||
|
||
V1Switch(p(), vrfy(), ingress(), egress(), update(), deparser()) main; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
issue2290.p4(16): [--Werror=type-error] error: Field s of header nested_header cannot have type header simple_header | ||
simple_header s; | ||
^ | ||
issue2290.p4(11) | ||
header simple_header { | ||
^^^^^^^^^^^^^ | ||
issue2290.p4(53): [--Werror=type-error] error: p: cannot evaluate to a compile-time constant | ||
V1Switch(p(), vrfy(), ingress(), egress(), update(), deparser()) main; | ||
^^^ |