Remove dead code paths
There's a few places where we call return after another return
statement, or after a method that doesn't return. These are not
required, and can be removed.
Change-Id: I091716bd0eb8ad6aec7a54b66d175b348cbe00e0
Signed-off-by: Ed Tanous <edtanous@google.com>
diff --git a/example/calculator-server.cpp b/example/calculator-server.cpp
index e6959b3..2ac6d2d 100644
--- a/example/calculator-server.cpp
+++ b/example/calculator-server.cpp
@@ -72,6 +72,4 @@
// Handle dbus processing forever.
b.process_loop();
-
- return 0;
}
diff --git a/test/vtable/vtable.cpp b/test/vtable/vtable.cpp
index 32f72a8..5ed38b8 100644
--- a/test/vtable/vtable.cpp
+++ b/test/vtable/vtable.cpp
@@ -49,14 +49,12 @@
// check it yet.
// && t1.x.start.vtable_format_reference
// == t2.x.start.vtable_format_reference;
- break;
case _SD_BUS_VTABLE_END:
{
// The union x shall be all zeros for END
constexpr uint8_t allZeors[sizeof(t1.x)] = {0};
return memcmp(&t1.x, allZeors, sizeof(t1.x)) == 0 &&
memcmp(&t2.x, allZeors, sizeof(t2.x)) == 0;
- break;
}
case _SD_BUS_VTABLE_METHOD:
return strcmp(t1.x.method.member, t2.x.method.member) == 0 &&
@@ -65,12 +63,10 @@
t1.x.method.handler == t2.x.method.handler &&
t1.x.method.offset == t2.x.method.offset &&
strcmp(t1.x.method.names, t2.x.method.names) == 0;
- break;
case _SD_BUS_VTABLE_SIGNAL:
return strcmp(t1.x.signal.member, t2.x.signal.member) == 0 &&
strcmp(t1.x.signal.signature, t2.x.signal.signature) == 0 &&
strcmp(t1.x.signal.names, t2.x.signal.names) == 0;
- break;
case _SD_BUS_VTABLE_PROPERTY:
case _SD_BUS_VTABLE_WRITABLE_PROPERTY:
return strcmp(t1.x.property.member, t2.x.property.member) == 0 &&
@@ -79,7 +75,6 @@
t1.x.property.get == t2.x.property.get &&
t1.x.property.set == t2.x.property.set &&
t1.x.property.offset == t2.x.property.offset;
- break;
}
return false;
}
diff --git a/tools/sdbusplus/templates/method.prototype.hpp.mako b/tools/sdbusplus/templates/method.prototype.hpp.mako
index 521ff63..9c6b89c 100644
--- a/tools/sdbusplus/templates/method.prototype.hpp.mako
+++ b/tools/sdbusplus/templates/method.prototype.hpp.mako
@@ -117,8 +117,6 @@
return o->_intf->sd_bus_error_set(error, e.name(), e.description());
}
% endfor
-
- return 0;
}
namespace details
diff --git a/tools/sdbusplus/templates/property.prototype.hpp.mako b/tools/sdbusplus/templates/property.prototype.hpp.mako
index 34c2f85..39f12f8 100644
--- a/tools/sdbusplus/templates/property.prototype.hpp.mako
+++ b/tools/sdbusplus/templates/property.prototype.hpp.mako
@@ -104,8 +104,6 @@
return o->_intf->sd_bus_error_set(error, e.name(), e.description());
}
% endfor
-
- return true;
}
% endif