From 574fe6f90785c7ad59ad03347dc782737e356fc8 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 17 Jan 2017 21:09:07 +0000 Subject: [PATCH 15/16] 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 --- bus/policy.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bus/policy.c b/bus/policy.c index dd0ac869..b5cca35a 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; } -- 2.11.0