Commit 3ffffa7c authored by 4ast's avatar 4ast

Merge pull request #335 from iovisor/p4-fixes

Reorder P4 struct key initializers and blocks
parents 0637fb0e 597b0e36
...@@ -275,6 +275,11 @@ class EbpfTable(object): ...@@ -275,6 +275,11 @@ class EbpfTable(object):
keyname = "key" keyname = "key"
valueName = "value" valueName = "value"
serializer.newline()
serializer.emitIndent()
serializer.appendFormat("{0}:", program.getLabel(self))
serializer.newline()
serializer.emitIndent() serializer.emitIndent()
serializer.blockStart() serializer.blockStart()
...@@ -283,7 +288,7 @@ class EbpfTable(object): ...@@ -283,7 +288,7 @@ class EbpfTable(object):
serializer.newline() serializer.newline()
serializer.emitIndent() serializer.emitIndent()
serializer.appendFormat("struct {0} {1};", self.keyTypeName, keyname) serializer.appendFormat("struct {0} {1} = {{}};", self.keyTypeName, keyname)
serializer.newline() serializer.newline()
serializer.emitIndent() serializer.emitIndent()
...@@ -291,11 +296,6 @@ class EbpfTable(object): ...@@ -291,11 +296,6 @@ class EbpfTable(object):
"struct {0} *{1};", self.valueTypeName, valueName) "struct {0} *{1};", self.valueTypeName, valueName)
serializer.newline() serializer.newline()
serializer.newline()
serializer.emitIndent()
serializer.appendFormat("{0}:", program.getLabel(self))
serializer.newline()
self.key.serializeConstruction(serializer, keyname, program) self.key.serializeConstruction(serializer, keyname, program)
serializer.emitIndent() 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