-
Notifications
You must be signed in to change notification settings - Fork 446
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…1934) * Report errors for duplicate objects with the same name; fixes #1932 * Do not allow two actions with the same name in the same scope
- Loading branch information
Mihai Budiu
authored
Jun 21, 2019
1 parent
522fd89
commit 8eb631f
Showing
46 changed files
with
219 additions
and
91 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,21 @@ | ||
#include <core.p4> | ||
#include <v1model.p4> | ||
|
||
header h1_t { bit<8> f1; } | ||
struct headers_t { h1_t h1; } | ||
struct metadata_t { } | ||
|
||
control ingressImpl(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t stdmeta) { | ||
action foo (in bit<8> x, out bit<8> y) { y = (x >> 2); } | ||
action foo (inout bit<8> x) { x = (x >> 3); } | ||
apply { | ||
foo(hdr.h1.f1); | ||
foo(hdr.h1.f1, hdr.h1.f1); | ||
} | ||
} | ||
parser parserImpl(packet_in packet, out headers_t hdr, inout metadata_t meta, inout standard_metadata_t stdmeta) { state start { transition accept; } } | ||
control verifyChecksum(inout headers_t hdr, inout metadata_t meta) { apply { } } | ||
control egressImpl(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t stdmeta) { apply { } } | ||
control updateChecksum(inout headers_t hdr, inout metadata_t meta) { apply { } } | ||
control deparserImpl(packet_out packet, in headers_t hdr) { apply { } } | ||
V1Switch(parserImpl(), verifyChecksum(), ingressImpl(), egressImpl(), updateChecksum(), deparserImpl()) 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,22 @@ | ||
#include <core.p4> | ||
#include <v1model.p4> | ||
|
||
header h1_t { bit<8> f1; } | ||
struct headers_t { h1_t h1; } | ||
struct metadata_t { } | ||
|
||
action foo (in bit<8> x, out bit<8> y) { y = (x >> 2); } | ||
action foo (inout bit<8> x) { x = (x >> 3); } | ||
|
||
control ingressImpl(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t stdmeta) { | ||
apply { | ||
foo(hdr.h1.f1); | ||
foo(hdr.h1.f1, hdr.h1.f1); | ||
} | ||
} | ||
parser parserImpl(packet_in packet, out headers_t hdr, inout metadata_t meta, inout standard_metadata_t stdmeta) { state start { transition accept; } } | ||
control verifyChecksum(inout headers_t hdr, inout metadata_t meta) { apply { } } | ||
control egressImpl(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t stdmeta) { apply { } } | ||
control updateChecksum(inout headers_t hdr, inout metadata_t meta) { apply { } } | ||
control deparserImpl(packet_out packet, in headers_t hdr) { apply { } } | ||
V1Switch(parserImpl(), verifyChecksum(), ingressImpl(), egressImpl(), updateChecksum(), deparserImpl()) 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,2 @@ | ||
control foo (in bit<8> x, out bit<8> y) { apply { y = x + 7; } } | ||
bool foo() { return true; } |
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,7 @@ | ||
issue1932-1.p4(10): [--Werror=legacy] error: foo: Duplicates declaration foo | ||
action foo (inout bit<8> x) { x = (x >> 3); } | ||
^^^ | ||
issue1932-1.p4(9) | ||
action foo (in bit<8> x, out bit<8> y) { y = (x >> 2); } | ||
^^^ | ||
error: 1 errors encountered, aborting compilation |
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,55 @@ | ||
#include <core.p4> | ||
#include <v1model.p4> | ||
|
||
header h1_t { | ||
bit<8> f1; | ||
} | ||
|
||
struct headers_t { | ||
h1_t h1; | ||
} | ||
|
||
struct metadata_t { | ||
} | ||
|
||
action foo(in bit<8> x, out bit<8> y) { | ||
y = x >> 2; | ||
} | ||
action foo(inout bit<8> x) { | ||
x = x >> 3; | ||
} | ||
control ingressImpl(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t stdmeta) { | ||
apply { | ||
foo(hdr.h1.f1); | ||
foo(hdr.h1.f1, hdr.h1.f1); | ||
} | ||
} | ||
|
||
parser parserImpl(packet_in packet, out headers_t hdr, inout metadata_t meta, inout standard_metadata_t stdmeta) { | ||
state start { | ||
transition accept; | ||
} | ||
} | ||
|
||
control verifyChecksum(inout headers_t hdr, inout metadata_t meta) { | ||
apply { | ||
} | ||
} | ||
|
||
control egressImpl(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t stdmeta) { | ||
apply { | ||
} | ||
} | ||
|
||
control updateChecksum(inout headers_t hdr, inout metadata_t meta) { | ||
apply { | ||
} | ||
} | ||
|
||
control deparserImpl(packet_out packet, in headers_t hdr) { | ||
apply { | ||
} | ||
} | ||
|
||
V1Switch(parserImpl(), verifyChecksum(), ingressImpl(), egressImpl(), updateChecksum(), deparserImpl()) 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,6 @@ | ||
issue1932-2.p4(9): [--Werror=duplicate] error: foo duplicates foo. | ||
action foo (inout bit<8> x) { x = (x >> 3); } | ||
^^^ | ||
issue1932-2.p4(8) | ||
action foo (in bit<8> x, out bit<8> y) { y = (x >> 2); } | ||
^^^ |
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 @@ | ||
control foo(in bit<8> x, out bit<8> y) { | ||
apply { | ||
y = x + 7; | ||
} | ||
} | ||
|
||
bool foo() { | ||
return true; | ||
} |
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,6 @@ | ||
issue1932.p4(2): [--Werror=duplicate] error: foo duplicates foo. | ||
bool foo() { return true; } | ||
^^^ | ||
issue1932.p4(1) | ||
control foo (in bit<8> x, out bit<8> y) { apply { y = x + 7; } } | ||
^^^ |
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
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
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
Oops, something went wrong.