From 8a68e67afa48370adfae846b71dc4b86f70c7c0b Mon Sep 17 00:00:00 2001 From: Frediano Ziglio Date: Fri, 28 Sep 2018 14:22:16 +0100 Subject: [PATCH] codegen: Remove fixedsize attribute This attribute was used only in SPICE version 1. The intention was use fixed size for switch type in the protocol. However this does not bring any improvement, just increase network bytes used. Generated code does not change. Signed-off-by: Frediano Ziglio Acked-by: Christophe Fergeau --- docs/spice_protocol.txt | 6 ------ python_modules/demarshal.py | 7 ------- python_modules/marshal.py | 8 -------- python_modules/ptypes.py | 6 ------ 4 files changed, 27 deletions(-) diff --git a/docs/spice_protocol.txt b/docs/spice_protocol.txt index 18b636f..421393d 100644 --- a/docs/spice_protocol.txt +++ b/docs/spice_protocol.txt @@ -454,9 +454,3 @@ virtual ~~~~~~~ TODO - -fixedsize -~~~~~~~~~ - -TODO - diff --git a/python_modules/demarshal.py b/python_modules/demarshal.py index 541137e..5209272 100644 --- a/python_modules/demarshal.py +++ b/python_modules/demarshal.py @@ -729,10 +729,6 @@ def write_switch_parser(writer, container, switch, dest, scope): var = container.lookup_member(switch.variable) var_type = var.member_type - if switch.has_attr("fixedsize"): - scope.variable_def("uint8_t *", "in_save") - writer.assign("in_save", "in") - first = True for c in switch.cases: check = c.get_check(dest.get_ref(switch.variable), var_type) @@ -775,9 +771,6 @@ def write_switch_parser(writer, container, switch, dest, scope): writer.newline() - if switch.has_attr("fixedsize"): - writer.assign("in", "in_save + %s" % switch.get_fixed_nw_size()) - def write_parse_ptr_function(writer, target_type): if target_type.is_array(): parse_function = "parse_array_%s" % target_type.element_type.primitive_type() diff --git a/python_modules/marshal.py b/python_modules/marshal.py index 940c925..4e98993 100644 --- a/python_modules/marshal.py +++ b/python_modules/marshal.py @@ -289,15 +289,7 @@ def write_switch_marshaller(writer, container, switch, src, scope): else: writer.todo("Can't handle type %s" % m.member_type) - if switch.has_attr("fixedsize"): - remaining = switch.get_fixed_nw_size() - t.get_fixed_nw_size() - if remaining != 0: - writer.statement("spice_marshaller_reserve_space(m, %s)" % remaining) - first = False - if switch.has_attr("fixedsize"): - with writer.block(" else"): - writer.statement("spice_marshaller_reserve_space(m, %s)" % switch.get_fixed_nw_size()) writer.newline() diff --git a/python_modules/ptypes.py b/python_modules/ptypes.py index 4b74225..f39f044 100644 --- a/python_modules/ptypes.py +++ b/python_modules/ptypes.py @@ -111,9 +111,6 @@ valid_attributes=set([ 'minor', # this attribute does not exist on the network, fill just structure with the value 'virtual', - # for a switch this indicates that on network - # it will occupy always the same size (maximum size required for all members) - 'fixedsize', ]) attributes_with_arguments=set([ @@ -737,9 +734,6 @@ class Switch(Containee): return True def is_fixed_nw_size(self): - if self.has_attr("fixedsize"): - return True - size = None has_default = False for c in self.cases: