summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLei YU <mine260309@gmail.com>2019-01-14 09:59:10 +0800
committerLei YU <mine260309@gmail.com>2019-01-17 01:46:50 +0000
commit4d741897f5190720b3cede8da0db9c7f749aa358 (patch)
treec20b6d652ce3e125a3216c2e1b0025b87b1444a8 /tools
parent062205d78d7fd0209e3438807a28c428823ed145 (diff)
downloadsdbusplus-4d741897f5190720b3cede8da0db9c7f749aa358.tar.gz
sdbusplus-4d741897f5190720b3cede8da0db9c7f749aa358.zip
Revert "Revert "Fix incorrect defaultValue in generated server.hpp""
This reverts commit 8192be92b9bf50450eb309a8798b3895bfdae471. The commit "Fix incorrect defaultValue in generated server.hpp" revealed an issue in phosphor-dbus-interfaces that causes the build error, and it was reverted temporarily. The issue is fixed in phosphor-dbus-interface, so we could add it back. Change-Id: I1700ff1ede5f0eedc11fc324f649ea4f2e76edf5 Signed-off-by: Lei YU <mine260309@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/sdbusplus/property.py6
-rw-r--r--tools/sdbusplus/templates/interface.mako.server.hpp2
2 files changed, 7 insertions, 1 deletions
diff --git a/tools/sdbusplus/property.py b/tools/sdbusplus/property.py
index fb774b6..83d9f3a 100644
--- a/tools/sdbusplus/property.py
+++ b/tools/sdbusplus/property.py
@@ -11,6 +11,12 @@ class Property(NamedElement, Renderer):
self.flags = kwargs.pop('flags', [])
self.errors = kwargs.pop('errors', [])
+ # Convert True/False to 'true'/'false'
+ # because it will be rendered as C++ code
+ if (self.defaultValue is not None and
+ isinstance(self.defaultValue, bool)):
+ self.defaultValue = 'true' if self.defaultValue else 'false'
+
super(Property, self).__init__(**kwargs)
def is_enum(self):
diff --git a/tools/sdbusplus/templates/interface.mako.server.hpp b/tools/sdbusplus/templates/interface.mako.server.hpp
index b263c7a..0774fe5 100644
--- a/tools/sdbusplus/templates/interface.mako.server.hpp
+++ b/tools/sdbusplus/templates/interface.mako.server.hpp
@@ -139,7 +139,7 @@ ${ m.cpp_prototype(loader, interface=interface, ptype='callback-header') }
sdbusplus::SdBusInterface *_intf;
% for p in interface.properties:
- % if p.defaultValue:
+ % if p.defaultValue is not None:
${p.cppTypeParam(interface.name)} _${p.camelCase} = \
% if p.is_enum():
${p.cppTypeParam(interface.name)}::\
OpenPOWER on IntegriCloud