Skip to content

Commit

Permalink
Fix for issue #226
Browse files Browse the repository at this point in the history
  • Loading branch information
mbudiu-vmw committed Jan 12, 2017
1 parent 45f02c0 commit 5a2c6c8
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions frontends/p4/fromv1.0/programStructure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1495,12 +1495,12 @@ ProgramStructure::convertControl(const IR::V1Control* control, cstring newName)
if (c.first->direct) {
if (c.first->table.name.isNullOrEmpty()) {
::error("%1%: Direct counter with no table", c.first);
continue;
return nullptr;
}
auto tbl = tables.get(c.first->table.name);
if (tbl == nullptr) {
::error("Cannot locate table %1%", c.first->table.name);
continue;
return nullptr;
}
if (std::find(usedTables.begin(), usedTables.end(), tbl) != usedTables.end())
directCounters.emplace(c.first->table.name, c.first->name);
Expand All @@ -1516,12 +1516,12 @@ ProgramStructure::convertControl(const IR::V1Control* control, cstring newName)
if (m.first->direct) {
if (m.first->table.name.isNullOrEmpty()) {
::error("%1%: Direct meter with no table", m.first);
continue;
return nullptr;
}
auto tbl = tables.get(m.first->table.name);
if (tbl == nullptr) {
::error("Cannot locate table %1%", m.first->table.name);
continue;
return nullptr;
}
if (std::find(usedTables.begin(), usedTables.end(), tbl) != usedTables.end()) {
auto meter = meters.get(m.second);
Expand Down Expand Up @@ -1565,7 +1565,7 @@ ProgramStructure::convertControl(const IR::V1Control* control, cstring newName)
auto act = actions.get(a);
if (act == nullptr) {
::error("Cannot locate action %1%", a);
continue;
return nullptr;
}
auto action = convertAction(act, actions.get(act), nullptr);
stateful->push_back(action);
Expand Down Expand Up @@ -1629,6 +1629,8 @@ void ProgramStructure::createControls() {
for (auto c : controlsToDo) {
auto ct = controls.get(c);
auto ctrl = convertControl(ct, controls.get(ct));
if (ctrl == nullptr)
return;
declarations->push_back(ctrl);
}

Expand Down

0 comments on commit 5a2c6c8

Please sign in to comment.