summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Fonseca <jfonseca@vmware.com>2015-08-13 15:50:46 +0100
committerJose Fonseca <jfonseca@vmware.com>2015-08-13 22:01:48 +0100
commitda621b59eb8ac436d9fefab51a3954cfd7252c44 (patch)
tree0da83bcedd427f3626db3728599d033b2493b537
parent92020921e86c42f2ae057cd3fecabe65b27816ae (diff)
wrappers: Allow empty structures without hitting MSVC C2466 error.
-rw-r--r--wrappers/trace.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/wrappers/trace.py b/wrappers/trace.py
index e5ef6e09..cb510246 100644
--- a/wrappers/trace.py
+++ b/wrappers/trace.py
@@ -67,7 +67,8 @@ class ComplexValueSerializer(stdapi.OnceVisitor):
self.visit(const.type)
def visitStruct(self, struct):
- print 'static const char * _struct%s_members[%u] = {' % (struct.tag, len(struct.members))
+ # Ensure member array has nonzero length to avoid MSVC error C2466
+ print 'static const char * _struct%s_members[%u] = {' % (struct.tag, max(len(struct.members), 1))
for type, name, in struct.members:
if name is None:
print ' "",'