Commit 597b0e36 authored by Brenden Blanco's avatar Brenden Blanco

Reorder P4 struct key initializers and blocks

The basic_routing.p4 program was failing verification due to missed map
key initializers in some paths. Put the goto label at the head of the
block and add a " = {}" for each key declaration inside the block.
Signed-off-by: default avatarBrenden Blanco <bblanco@plumgrid.com>
parent 0637fb0e
......@@ -275,6 +275,11 @@ class EbpfTable(object):
keyname = "key"
valueName = "value"
serializer.newline()
serializer.emitIndent()
serializer.appendFormat("{0}:", program.getLabel(self))
serializer.newline()
serializer.emitIndent()
serializer.blockStart()
......@@ -283,7 +288,7 @@ class EbpfTable(object):
serializer.newline()
serializer.emitIndent()
serializer.appendFormat("struct {0} {1};", self.keyTypeName, keyname)
serializer.appendFormat("struct {0} {1} = {{}};", self.keyTypeName, keyname)
serializer.newline()
serializer.emitIndent()
......@@ -291,11 +296,6 @@ class EbpfTable(object):
"struct {0} *{1};", self.valueTypeName, valueName)
serializer.newline()
serializer.newline()
serializer.emitIndent()
serializer.appendFormat("{0}:", program.getLabel(self))
serializer.newline()
self.key.serializeConstruction(serializer, keyname, program)
serializer.emitIndent()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment