From 7ce45d2e282cb460150080039709a4a2a74fbecf Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 13 Oct 2016 23:26:55 +0100 Subject: [PATCH] WiP: remaining -Wswitch-* fixes from Thomas Zimmermann These need reviewing, and in some cases clarifying. --- bus/config-parser.c | 29 +++++++++++++++++++++++++++++ bus/dispatch.c | 12 ++++++++++++ bus/main.c | 3 +++ bus/policy.c | 8 ++++++++ dbus/dbus-marshal-recursive-util.c | 2 ++ dbus/dbus-sha.c | 2 ++ dbus/dbus-spawn.c | 7 +++++++ dbus/dbus-sysdeps-util-win.c | 2 ++ dbus/dbus-sysdeps-win.c | 6 ++++++ dbus/dbus-transport-socket.c | 3 +++ dbus/dbus-transport.c | 8 ++++++++ test/test-utils-glib.c | 2 ++ tools/dbus-cleanup-sockets.c | 3 +++ tools/dbus-launch.c | 8 ++++++++ tools/dbus-monitor.c | 7 +++++++ tools/dbus-run-session.c | 3 +++ 16 files changed, 105 insertions(+) diff --git a/bus/config-parser.c b/bus/config-parser.c index b776a2d0..1dca5399 100644 --- a/bus/config-parser.c +++ b/bus/config-parser.c @@ -1676,6 +1676,9 @@ append_rule_from_element (BusConfigParser *parser, rule)) goto nomem; break; + + default: + break; } bus_policy_rule_unref (rule); @@ -2097,6 +2100,7 @@ bus_config_parser_end_element (BusConfigParser *parser, case ELEMENT_STANDARD_SYSTEM_SERVICEDIRS: case ELEMENT_ALLOW_ANONYMOUS: case ELEMENT_APPARMOR: + default: break; } @@ -2653,6 +2657,9 @@ bus_config_parser_content (BusConfigParser *parser, e->d.limit.name); } break; + + default: + break; } _DBUS_ASSERT_ERROR_IS_CLEAR (error); @@ -3094,6 +3101,28 @@ elements_equal (const Element *a, return FALSE; break; + case ELEMENT_NONE: + case ELEMENT_BUSCONFIG: + case ELEMENT_USER: + case ELEMENT_LISTEN: + case ELEMENT_AUTH: + case ELEMENT_ALLOW: + case ELEMENT_DENY: + case ELEMENT_FORK: + case ELEMENT_PIDFILE: + case ELEMENT_SERVICEDIR: + case ELEMENT_SERVICEHELPER: + case ELEMENT_INCLUDEDIR: + case ELEMENT_CONFIGTYPE: + case ELEMENT_SELINUX: + case ELEMENT_ASSOCIATE: + case ELEMENT_STANDARD_SESSION_SERVICEDIRS: + case ELEMENT_STANDARD_SYSTEM_SERVICEDIRS: + case ELEMENT_KEEP_UMASK: + case ELEMENT_SYSLOG: + case ELEMENT_ALLOW_ANONYMOUS: + case ELEMENT_APPARMOR: + /* fall through */ default: /* do nothing */ break; diff --git a/bus/dispatch.c b/bus/dispatch.c index 620fd36a..37e166fa 100644 --- a/bus/dispatch.c +++ b/bus/dispatch.c @@ -2956,6 +2956,9 @@ check_existent_service_no_auto_start (BusContext *context, goto out; break; + + default: + break; } } @@ -3552,6 +3555,9 @@ check_existent_service_auto_start (BusContext *context, case GOT_SOMETHING_ELSE: _dbus_warn ("Unexpected message after auto activation"); goto out; + + default: + break; } } @@ -4245,6 +4251,9 @@ check_shell_service_success_auto_start (BusContext *context, case GOT_SOMETHING_ELSE: _dbus_warn ("Unexpected message after auto activation"); goto out; + + default: + break; } } @@ -4698,6 +4707,9 @@ check_list_services (BusContext *context, } break; + + default: + break; } } diff --git a/bus/main.c b/bus/main.c index 5e26820a..4c76c067 100644 --- a/bus/main.c +++ b/bus/main.c @@ -128,6 +128,9 @@ signal_handler (int sig) } } break; + + default: + break; } } #endif /* DBUS_UNIX */ diff --git a/bus/policy.c b/bus/policy.c index dd0ac869..be48f94f 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: + break; } return rule; @@ -116,6 +118,8 @@ bus_policy_rule_unref (BusPolicyRule *rule) break; case BUS_POLICY_RULE_GROUP: break; + default: + break; } dbus_free (rule); @@ -261,6 +265,8 @@ add_list_to_client (DBusList **list, if (!bus_client_policy_append_rule (client, rule)) return FALSE; break; + default: + break; } } @@ -834,6 +840,8 @@ bus_client_policy_optimize (BusClientPolicy *policy) case BUS_POLICY_RULE_GROUP: _dbus_assert_not_reached ("invalid rule"); break; + default: + break; } if (remove_preceding) diff --git a/dbus/dbus-marshal-recursive-util.c b/dbus/dbus-marshal-recursive-util.c index d43972fd..950724af 100644 --- a/dbus/dbus-marshal-recursive-util.c +++ b/dbus/dbus-marshal-recursive-util.c @@ -2396,6 +2396,8 @@ string_from_seed (char *buf, case 2: len -= 2; break; + default: + break; } if (len < 0) len = 0; diff --git a/dbus/dbus-sha.c b/dbus/dbus-sha.c index 343b5d49..eb3b9ece 100644 --- a/dbus/dbus-sha.c +++ b/dbus/dbus-sha.c @@ -718,6 +718,8 @@ get_next_expected_result (DBusString *results, _dbus_string_delete (result, i, 1); --i; /* to offset ++i below */ break; + default: + break; } ++i; diff --git a/dbus/dbus-spawn.c b/dbus/dbus-spawn.c index 655bfe92..670b78de 100644 --- a/dbus/dbus-spawn.c +++ b/dbus/dbus-spawn.c @@ -429,6 +429,9 @@ read_data (DBusBabysitter *sitter, case READ_STATUS_OK: break; + + default: + break; } if (got == 1) @@ -453,6 +456,8 @@ read_data (DBusBabysitter *sitter, return r; case READ_STATUS_OK: break; + default: + break; } if (got == 1) @@ -513,6 +518,8 @@ read_data (DBusBabysitter *sitter, return r; case READ_STATUS_OK: break; + default: + break; } sitter->grandchild_pid = pid; diff --git a/dbus/dbus-sysdeps-util-win.c b/dbus/dbus-sysdeps-util-win.c index eb860f4d..6020aa32 100644 --- a/dbus/dbus-sysdeps-util-win.c +++ b/dbus/dbus-sysdeps-util-win.c @@ -1380,6 +1380,8 @@ _dbus_lm_strerror(int error_number) return "The password does not meet the requirements of the password filter DLLs."; #endif + default: + break; } msg = strerror (error_number); if (msg == NULL) diff --git a/dbus/dbus-sysdeps-win.c b/dbus/dbus-sysdeps-win.c index 77c5b74e..2031a99e 100644 --- a/dbus/dbus-sysdeps-win.c +++ b/dbus/dbus-sysdeps-win.c @@ -2688,6 +2688,8 @@ HANDLE _dbus_global_lock (const char *mutexname) case WAIT_FAILED: case WAIT_TIMEOUT: return 0; + default: + break; } return mutex; @@ -3525,6 +3527,9 @@ _dbus_strerror (int error_number) case WSASYSCALLFAILURE: return "System call failure"; + + default: + break; } msg = strerror (error_number); if (msg == NULL) @@ -3688,6 +3693,7 @@ _dbus_logv (DBusSystemLogSeverity severity, case DBUS_SYSTEM_LOG_WARNING: s = "warning"; break; case DBUS_SYSTEM_LOG_SECURITY: s = "security"; break; case DBUS_SYSTEM_LOG_FATAL: s = "fatal"; break; + default: break; } if (log_flags & DBUS_LOG_FLAGS_SYSTEM_LOG) diff --git a/dbus/dbus-transport-socket.c b/dbus/dbus-transport-socket.c index 88fde42b..eedaac53 100644 --- a/dbus/dbus-transport-socket.c +++ b/dbus/dbus-transport-socket.c @@ -476,6 +476,9 @@ do_authentication (DBusTransport *transport, _dbus_verbose (" %s auth state: authenticated\n", TRANSPORT_SIDE (transport)); break; + + case DBUS_AUTH_STATE_INVALID: + /* fall through */ default: _dbus_assert_not_reached ("invalid auth state"); } diff --git a/dbus/dbus-transport.c b/dbus/dbus-transport.c index 6c6869c2..e72e65ca 100644 --- a/dbus/dbus-transport.c +++ b/dbus/dbus-transport.c @@ -410,6 +410,8 @@ _dbus_transport_open (DBusAddressEntry *entry, _DBUS_ASSERT_ERROR_IS_SET (&tmp_error); goto out; break; + default: + break; } } @@ -746,6 +748,12 @@ _dbus_transport_try_to_authenticate (DBusTransport *transport) case DBUS_AUTH_STATE_AUTHENTICATED: /* leave as maybe_authenticated */ break; + case DBUS_AUTH_STATE_WAITING_FOR_INPUT: + case DBUS_AUTH_STATE_WAITING_FOR_MEMORY: + case DBUS_AUTH_STATE_HAVE_BYTES_TO_SEND: + case DBUS_AUTH_STATE_NEED_DISCONNECT: + case DBUS_AUTH_STATE_INVALID: + /* fall through */ default: maybe_authenticated = FALSE; } diff --git a/test/test-utils-glib.c b/test/test-utils-glib.c index ee286b98..55a32017 100644 --- a/test/test-utils-glib.c +++ b/test/test-utils-glib.c @@ -149,6 +149,8 @@ spawn_dbus_daemon (const gchar *binary, break; + case TEST_USER_ME: + /* fall through */ default: g_assert_not_reached (); } diff --git a/tools/dbus-cleanup-sockets.c b/tools/dbus-cleanup-sockets.c index 1b6709af..ad47d416 100644 --- a/tools/dbus-cleanup-sockets.c +++ b/tools/dbus-cleanup-sockets.c @@ -331,6 +331,9 @@ handle_sockets (SocketEntry **entries, fprintf (stderr, "Bad status from open_socket(), should not happen\n"); exit (1); break; + + default: + break; } if (se->fd >= 0) diff --git a/tools/dbus-launch.c b/tools/dbus-launch.c index 65287af6..7cb8c7cf 100644 --- a/tools/dbus-launch.c +++ b/tools/dbus-launch.c @@ -471,6 +471,8 @@ signal_handler (int sig) case SIGTERM: got_sighup = TRUE; break; + default: + break; } } @@ -709,6 +711,8 @@ babysit (int exit_with_session, strerror (errno)); exit (1); break; + default: + break; } verbose ("Got PID %ld from daemon\n", @@ -1328,6 +1332,8 @@ main (int argc, char **argv) strerror (errno)); exit (1); break; + default: + break; } close (bus_address_to_launcher_pipe[READ_END]); @@ -1347,6 +1353,8 @@ main (int argc, char **argv) strerror (errno)); exit (1); break; + default: + break; } end = NULL; diff --git a/tools/dbus-monitor.c b/tools/dbus-monitor.c index aa28447f..40477f7d 100644 --- a/tools/dbus-monitor.c +++ b/tools/dbus-monitor.c @@ -241,6 +241,8 @@ binary_filter_func (DBusConnection *connection, break; case BINARY_MODE_RAW: + case BINARY_MODE_NOT: + /* fall through */ default: /* nothing special, just the raw message stream */ break; @@ -474,6 +476,8 @@ main (int argc, char *argv[]) case DBUS_BUS_SESSION: where = "session bus"; break; + case DBUS_BUS_STARTER: + /* fall through */ default: where = ""; } @@ -583,6 +587,9 @@ main (int argc, char *argv[]) } } break; + + default: + break; } while (dbus_connection_read_write_dispatch(connection, -1)) diff --git a/tools/dbus-run-session.c b/tools/dbus-run-session.c index 135f5d21..1ff1eeb1 100644 --- a/tools/dbus-run-session.c +++ b/tools/dbus-run-session.c @@ -386,6 +386,9 @@ main (int argc, char **argv) me, strerror (errno)); return 127; break; + + default: + break; } close (bus_address_pipe[PIPE_READ_END]); -- 2.11.0