-
Notifications
You must be signed in to change notification settings - Fork 451
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove unused actions whose external name starts with '__'
Signed-off-by: Kyle Cripps <kyle@pensando.io>
- Loading branch information
Showing
8 changed files
with
190 additions
and
5 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,41 @@ | ||
#include <core.p4> | ||
|
||
struct S { | ||
bit<16> f; | ||
} | ||
|
||
extern bool foo(in bool x, in bool y); | ||
|
||
control C(inout S s) { | ||
action a1() { | ||
if (foo(s.f == 0, false)) { | ||
return; | ||
} | ||
} | ||
|
||
@name("._xyz") | ||
action a2() { | ||
a1(); | ||
a1(); | ||
} | ||
|
||
table t { | ||
actions = { a2; } | ||
} | ||
|
||
apply { | ||
t.apply(); | ||
} | ||
} | ||
|
||
control C2() { | ||
apply { | ||
S s; | ||
C.apply(s); | ||
} | ||
} | ||
|
||
control proto(); | ||
package top(proto p); | ||
|
||
top(C2()) main; |
40 changes: 40 additions & 0 deletions
40
testdata/p4_16_samples_outputs/issue4883_dup_has_returned_decl-first.p4
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,40 @@ | ||
#include <core.p4> | ||
|
||
struct S { | ||
bit<16> f; | ||
} | ||
|
||
extern bool foo(in bool x, in bool y); | ||
control C(inout S s) { | ||
action a1() { | ||
if (foo(s.f == 16w0, false)) { | ||
return; | ||
} | ||
} | ||
@name("._xyz") action a2() { | ||
a1(); | ||
a1(); | ||
} | ||
table t { | ||
actions = { | ||
a2(); | ||
@defaultonly NoAction(); | ||
} | ||
default_action = NoAction(); | ||
} | ||
apply { | ||
t.apply(); | ||
} | ||
} | ||
|
||
control C2() { | ||
@name("C") C() C_inst; | ||
apply { | ||
S s; | ||
C_inst.apply(s); | ||
} | ||
} | ||
|
||
control proto(); | ||
package top(proto p); | ||
top(C2()) main; |
31 changes: 31 additions & 0 deletions
31
testdata/p4_16_samples_outputs/issue4883_dup_has_returned_decl-frontend.p4
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,31 @@ | ||
#include <core.p4> | ||
|
||
struct S { | ||
bit<16> f; | ||
} | ||
|
||
extern bool foo(in bool x, in bool y); | ||
control C2() { | ||
@name("C2.s") S s_0; | ||
@name("C2.C.tmp") bool C_tmp; | ||
@noWarn("unused") @name(".NoAction") action NoAction_1() { | ||
} | ||
@name("._xyz") action __xyz_0() { | ||
C_tmp = foo(s_0.f == 16w0, false); | ||
C_tmp = foo(s_0.f == 16w0, false); | ||
} | ||
@name("C2.C.t") table C_t { | ||
actions = { | ||
__xyz_0(); | ||
@defaultonly NoAction_1(); | ||
} | ||
default_action = NoAction_1(); | ||
} | ||
apply { | ||
C_t.apply(); | ||
} | ||
} | ||
|
||
control proto(); | ||
package top(proto p); | ||
top(C2()) main; |
30 changes: 30 additions & 0 deletions
30
testdata/p4_16_samples_outputs/issue4883_dup_has_returned_decl-midend.p4
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,30 @@ | ||
#include <core.p4> | ||
|
||
struct S { | ||
bit<16> f; | ||
} | ||
|
||
extern bool foo(in bool x, in bool y); | ||
control C2() { | ||
@name("C2.s") S s_0; | ||
@noWarn("unused") @name(".NoAction") action NoAction_1() { | ||
} | ||
@name("._xyz") action __xyz_0() { | ||
foo(s_0.f == 16w0, false); | ||
foo(s_0.f == 16w0, false); | ||
} | ||
@name("C2.C.t") table C_t { | ||
actions = { | ||
__xyz_0(); | ||
@defaultonly NoAction_1(); | ||
} | ||
default_action = NoAction_1(); | ||
} | ||
apply { | ||
C_t.apply(); | ||
} | ||
} | ||
|
||
control proto(); | ||
package top(proto p); | ||
top(C2()) main; |
37 changes: 37 additions & 0 deletions
37
testdata/p4_16_samples_outputs/issue4883_dup_has_returned_decl.p4
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,37 @@ | ||
#include <core.p4> | ||
|
||
struct S { | ||
bit<16> f; | ||
} | ||
|
||
extern bool foo(in bool x, in bool y); | ||
control C(inout S s) { | ||
action a1() { | ||
if (foo(s.f == 0, false)) { | ||
return; | ||
} | ||
} | ||
@name("._xyz") action a2() { | ||
a1(); | ||
a1(); | ||
} | ||
table t { | ||
actions = { | ||
a2; | ||
} | ||
} | ||
apply { | ||
t.apply(); | ||
} | ||
} | ||
|
||
control C2() { | ||
apply { | ||
S s; | ||
C.apply(s); | ||
} | ||
} | ||
|
||
control proto(); | ||
package top(proto p); | ||
top(C2()) main; |
6 changes: 6 additions & 0 deletions
6
testdata/p4_16_samples_outputs/issue4883_dup_has_returned_decl.p4-stderr
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 @@ | ||
issue4883_dup_has_returned_decl.p4(34): [--Wwarn=uninitialized_use] warning: s.f may be uninitialized | ||
C.apply(s); | ||
^ | ||
issue4883_dup_has_returned_decl.p4(11): [--Wwarn=uninitialized_use] warning: s.f may be uninitialized | ||
if (foo(s.f == 0, false)) { | ||
^^^ |