From: Simon McVittie Date: Tue, 17 Jan 2017 21:09:07 +0000 (+0000) Subject: bus policy: assert that no invalid rule types are seen X-Git-Tag: dbus-1.11.12~7 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e2edb6c4b8b0f9dcd116fdb74c731f32f7ed8c02;p=thirdparty%2Fdbus.git bus policy: assert that no invalid rule types are seen This silences -Wswitch-default. Based on part of a patch from Thomas Zimmermann. Signed-off-by: Simon McVittie Reviewed-by: Philip Withnall Bug: https://bugs.freedesktop.org/show_bug.cgi?id=98191 --- diff --git a/bus/policy.c b/bus/policy.c index dd0ac869c..b5cca35a1 100644 --- a/bus/policy.c +++ b/bus/policy.c @@ -69,6 +69,8 @@ bus_policy_rule_new (BusPolicyRuleType type, break; case BUS_POLICY_RULE_OWN: break; + default: + _dbus_assert_not_reached ("invalid rule"); } return rule; @@ -116,6 +118,8 @@ bus_policy_rule_unref (BusPolicyRule *rule) break; case BUS_POLICY_RULE_GROUP: break; + default: + _dbus_assert_not_reached ("invalid rule"); } dbus_free (rule); @@ -261,6 +265,9 @@ add_list_to_client (DBusList **list, if (!bus_client_policy_append_rule (client, rule)) return FALSE; break; + + default: + _dbus_assert_not_reached ("invalid rule"); } } @@ -830,8 +837,11 @@ bus_client_policy_optimize (BusClientPolicy *policy) remove_preceding = rule->d.own.service_name == NULL; break; + + /* The other rule types don't appear in this list */ case BUS_POLICY_RULE_USER: case BUS_POLICY_RULE_GROUP: + default: _dbus_assert_not_reached ("invalid rule"); break; }