[Spice-devel] [PATCH 8/9] codegen: avoid creating out if not used (fix gcc 4.6.0 warning)

Alon Levy alevy at redhat.com
Tue Jan 25 07:34:04 PST 2011


---
 python_modules/demarshal.py |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/python_modules/demarshal.py b/python_modules/demarshal.py
index cbe3599..48551c0 100644
--- a/python_modules/demarshal.py
+++ b/python_modules/demarshal.py
@@ -1047,9 +1047,11 @@ def write_msg_parser(writer, message):
         writer.assign("end", "data + %s" % (msg_sizeof))
         writer.assign("in", "start").newline()
 
-        dest = RootDemarshallingDestination(None, msg_type, msg_sizeof, "data")
-        dest.reuse_scope = parent_scope
-        write_container_parser(writer, message, dest)
+        # avoid defined and assigned but not used warnings of gcc 4.6.0+
+        if message.is_extra_size() or not message.is_fixed_nw_size() or message.get_fixed_nw_size() > 0:
+            dest = RootDemarshallingDestination(None, msg_type, msg_sizeof, "data")
+            dest.reuse_scope = parent_scope
+            write_container_parser(writer, message, dest)
 
         writer.newline()
         writer.statement("assert(in <= message_end)")
-- 
1.7.3.5



More information about the Spice-devel mailing list