summaryrefslogtreecommitdiffstats
path: root/python_modules/marshal.py
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2011-01-24 23:32:43 +0200
committerAlon Levy <alevy@redhat.com>2011-01-25 17:29:31 +0200
commita13824b22a7946bbf6f8f440b44d03c28c1748be (patch)
treebdcdbb21c8642b7d5885294fac8a4bab7c294d82 /python_modules/marshal.py
parent00f2d2782863a1ddd951e04931e72ef1dbef2cca (diff)
downloadspice-a13824b22a7946bbf6f8f440b44d03c28c1748be.tar.gz
spice-a13824b22a7946bbf6f8f440b44d03c28c1748be.tar.xz
spice-a13824b22a7946bbf6f8f440b44d03c28c1748be.zip
demarshaller/marshaller fix gcc 4.6.0
python_modules/demarshal.py and marshal.py fixes for gcc 4.6.0 warning about set but unused variables. The fixes disable creating of variables mem_size when they are not used (demarshall) and declaring a src variable when the message doesn't use it (marshal). You need to touch *.proto after applying this (should add a Makefile dependency).
Diffstat (limited to 'python_modules/marshal.py')
-rw-r--r--python_modules/marshal.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/python_modules/marshal.py b/python_modules/marshal.py
index a82df981..5b4dfdd7 100644
--- a/python_modules/marshal.py
+++ b/python_modules/marshal.py
@@ -356,10 +356,12 @@ def write_message_marshaller(writer, message, is_server, private):
for n in names:
writer.assign("*%s_out" % n, "NULL")
- src = RootMarshallingSource(None, message.c_type(), message.sizeof(), "msg")
- src.reuse_scope = scope
+ # fix warnings about unused variables by not creating body if no members to parse
+ if any(x.is_fixed_nw_size() for x in message.members):
+ src = RootMarshallingSource(None, message.c_type(), message.sizeof(), "msg")
+ src.reuse_scope = scope
- write_container_marshaller(writer, message, src)
+ write_container_marshaller(writer, message, src)
writer.end_block()
writer.newline()