sdbus++: simplify handling of empty parameter lists

Add a template specialization of the type-tuple generation for
empty parameter lists in order to simplify the Mako templates.
This eliminates a special case for empty parameter lists in
multiple places.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I7ca8d962ab1c7a65e0ad6d80ece1cd7e3847f2c6
diff --git a/include/sdbusplus/message/types.hpp b/include/sdbusplus/message/types.hpp
index 6389ac4..91c7f96 100644
--- a/include/sdbusplus/message/types.hpp
+++ b/include/sdbusplus/message/types.hpp
@@ -303,6 +303,13 @@
         std::make_tuple('\0') /* null terminator for C-string */);
 }
 
+// Special case for empty type.
+template <>
+constexpr auto type_id()
+{
+    return std::make_tuple('\0');
+}
+
 template <typename... Args>
 constexpr auto type_id_nonull()
 {
diff --git a/tools/sdbusplus/templates/method.aserver.typeid.hpp.mako b/tools/sdbusplus/templates/method.aserver.typeid.hpp.mako
index b9b360d..cc9186f 100644
--- a/tools/sdbusplus/templates/method.aserver.typeid.hpp.mako
+++ b/tools/sdbusplus/templates/method.aserver.typeid.hpp.mako
@@ -1,17 +1,9 @@
     static constexpr auto _method_typeid_p_${method.snake_case} =
         utility::tuple_to_array(\
-% if len(method.parameters) == 0:
-std::make_tuple('\0')\
-% else:
 message::types::type_id<${method.parameter_types_as_list(interface)}>()\
-% endif
 );
 
     static constexpr auto _method_typeid_r_${method.snake_case} =
         utility::tuple_to_array(\
-% if len(method.returns) == 0:
-std::make_tuple('\0')\
-% else:
 message::types::type_id<${method.returns_as_list(interface)}>()\
-% endif
 );
diff --git a/tools/sdbusplus/templates/method.prototype.hpp.mako b/tools/sdbusplus/templates/method.prototype.hpp.mako
index 9dd232f..e8dd48b 100644
--- a/tools/sdbusplus/templates/method.prototype.hpp.mako
+++ b/tools/sdbusplus/templates/method.prototype.hpp.mako
@@ -71,19 +71,11 @@
 namespace ${interface.classname}
 {
 static const auto _param_${ method.CamelCase } =
-    % if len(method.parameters) == 0:
-        utility::tuple_to_array(std::make_tuple('\0'));
-    % else:
         utility::tuple_to_array(message::types::type_id<
                 ${ method.parameter_types_as_list(interface) }>());
-    % endif
 static const auto _return_${ method.CamelCase } =
-    % if len(method.returns) == 0:
-        utility::tuple_to_array(std::make_tuple('\0'));
-    % else:
         utility::tuple_to_array(message::types::type_id<
                 ${ method.returns_as_list(interface, full=True) }>());
-    % endif
 }
 }
     % endif
diff --git a/tools/sdbusplus/templates/signal.aserver.typeid.hpp.mako b/tools/sdbusplus/templates/signal.aserver.typeid.hpp.mako
index 5d4f1e9..4f24175 100644
--- a/tools/sdbusplus/templates/signal.aserver.typeid.hpp.mako
+++ b/tools/sdbusplus/templates/signal.aserver.typeid.hpp.mako
@@ -1,7 +1,3 @@
     static constexpr auto _signal_typeid_${signal.snake_case} =
-% if len(signal.properties) == 0:
-        utility::tuple_to_array(std::make_tuple('\0'));
-% else:
         utility::tuple_to_array(message::types::type_id<\
 ${ ", ".join( [ p.cppTypeParam(interface.name, full=True) for p in signal.properties ]) }>());
-% endif
diff --git a/tools/sdbusplus/templates/signal.prototype.hpp.mako b/tools/sdbusplus/templates/signal.prototype.hpp.mako
index ec8ee7e..2cae5f2 100644
--- a/tools/sdbusplus/templates/signal.prototype.hpp.mako
+++ b/tools/sdbusplus/templates/signal.prototype.hpp.mako
@@ -57,12 +57,8 @@
 namespace ${interface.classname}
 {
 static const auto _signal_${ signal.CamelCase } =
-    % if len(signal.properties) == 0:
-        utility::tuple_to_array(std::make_tuple('\0'));
-    % else:
         utility::tuple_to_array(message::types::type_id<
                 ${ parameters_types_as_list() }>());
-    % endif
 }
 }
     % endif