mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-22 13:33:56 +03:00
Drop the text argument from assert_not_reached()
In general we almost never hit those asserts in production code, so users see them very rarely, if ever. But either way, we just need something that users can pass to the developers. We have quite a few of those asserts, and some have fairly nice messages, but many are like "WTF?" or "???" or "unexpected something". The error that is printed includes the file location, and function name. In almost all functions there's at most one assert, so the function name alone is enough to identify the failure for a developer. So we don't get much extra from the message, and we might just as well drop them. Dropping them makes our code a tiny bit smaller, and most importantly, improves development experience by making it easy to insert such an assert in the code without thinking how to phrase the argument.
This commit is contained in:
parent
c7cfde640d
commit
04499a70fb
@ -53,7 +53,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (optind < argc)
|
||||
|
@ -453,7 +453,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (optind == argc)
|
||||
|
@ -2366,7 +2366,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option code.");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (arg_scope == UNIT_FILE_GLOBAL &&
|
||||
|
@ -188,7 +188,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (isempty(emoji) || streq(emoji, "auto"))
|
||||
|
@ -495,7 +495,7 @@ static int run(int argc, char *argv[]) {
|
||||
return log_device_error_errno(device, r, "Failed to write %s: %m", saved);
|
||||
|
||||
} else
|
||||
assert_not_reached("Unknown verb.");
|
||||
assert_not_reached();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ int uname_architecture(void) {
|
||||
if (streq(arch_map[i].machine, u.machine))
|
||||
return cached = arch_map[i].arch;
|
||||
|
||||
assert_not_reached("Couldn't identify architecture. You need to patch systemd.");
|
||||
assert_not_reached();
|
||||
return _ARCHITECTURE_INVALID;
|
||||
}
|
||||
|
||||
|
@ -401,7 +401,7 @@ static struct hashmap_base_entry* bucket_at_virtual(HashmapBase *h, struct swap_
|
||||
if (idx < _IDX_SWAP_END)
|
||||
return &bucket_at_swap(swap, idx)->p.b;
|
||||
|
||||
assert_not_reached("Invalid index");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
static dib_raw_t* dib_raw_ptr(HashmapBase *h) {
|
||||
@ -513,7 +513,7 @@ static void* entry_value(HashmapBase *h, struct hashmap_base_entry *e) {
|
||||
return (void*) e->key;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown hashmap type");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1747,7 +1747,7 @@ HashmapBase* _hashmap_copy(HashmapBase *h HASHMAP_DEBUG_PARAMS) {
|
||||
r = set_merge((Set*)copy, (Set*)h);
|
||||
break;
|
||||
default:
|
||||
assert_not_reached("Unknown hashmap type");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (r < 0)
|
||||
|
@ -794,7 +794,7 @@ int in_addr_prefix_from_string_auto_internal(
|
||||
k = 0;
|
||||
break;
|
||||
default:
|
||||
assert_not_reached("Invalid prefixlen mode");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (ret_family)
|
||||
|
@ -863,12 +863,11 @@ _noreturn_ void log_assert_failed(
|
||||
}
|
||||
|
||||
_noreturn_ void log_assert_failed_unreachable(
|
||||
const char *text,
|
||||
const char *file,
|
||||
int line,
|
||||
const char *func) {
|
||||
log_assert(LOG_CRIT, text, file, line, func,
|
||||
"Code should not be reached '%s' at %s:%u, function %s(). Aborting.");
|
||||
log_assert(LOG_CRIT, "Code should not be reached", file, line, func,
|
||||
"%s at %s:%u, function %s(). Aborting.");
|
||||
abort();
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,6 @@ _noreturn_ void log_assert_failed(
|
||||
const char *func);
|
||||
|
||||
_noreturn_ void log_assert_failed_unreachable(
|
||||
const char *text,
|
||||
const char *file,
|
||||
int line,
|
||||
const char *func);
|
||||
|
@ -282,8 +282,8 @@ static inline int __coverity_check_and_return__(int condition) {
|
||||
#define assert(expr) assert_message_se(expr, #expr)
|
||||
#endif
|
||||
|
||||
#define assert_not_reached(t) \
|
||||
log_assert_failed_unreachable(t, PROJECT_FILE, __LINE__, __PRETTY_FUNCTION__)
|
||||
#define assert_not_reached() \
|
||||
log_assert_failed_unreachable(PROJECT_FILE, __LINE__, __PRETTY_FUNCTION__)
|
||||
|
||||
#define assert_return(expr, r) \
|
||||
do { \
|
||||
|
@ -347,7 +347,7 @@ static int acquire_config_dirs(UnitFileScope scope, char **persistent, char **ru
|
||||
return 0;
|
||||
|
||||
default:
|
||||
assert_not_reached("Hmm, unexpected scope value.");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (!a || !b)
|
||||
@ -405,7 +405,7 @@ static int acquire_control_dirs(UnitFileScope scope, char **persistent, char **r
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
default:
|
||||
assert_not_reached("Hmm, unexpected scope value.");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
*persistent = TAKE_PTR(a);
|
||||
@ -657,7 +657,7 @@ int lookup_paths_init(
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Hmm, unexpected scope?");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (!add)
|
||||
@ -807,7 +807,7 @@ char **generator_binary_paths(UnitFileScope scope) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Hmm, unexpected scope.");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (!add)
|
||||
|
@ -245,7 +245,7 @@ struct cmsghdr* cmsg_find(struct msghdr *mh, int level, int type, socklen_t leng
|
||||
_len = sizeof(struct sockaddr_vm); \
|
||||
break; \
|
||||
default: \
|
||||
assert_not_reached("invalid socket family"); \
|
||||
assert_not_reached(); \
|
||||
} \
|
||||
_len; \
|
||||
})
|
||||
|
@ -58,7 +58,7 @@ do { \
|
||||
(void) va_arg(ap, long double); \
|
||||
break; \
|
||||
default: \
|
||||
assert_not_reached("Unknown format string argument."); \
|
||||
assert_not_reached(); \
|
||||
} \
|
||||
} \
|
||||
} while (false)
|
||||
|
@ -174,7 +174,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if ((arg_unregister || arg_cat_config) && argc > optind)
|
||||
|
@ -89,7 +89,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown option");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -67,7 +67,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown option");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -1228,7 +1228,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown option");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -147,7 +147,7 @@ static int parse_xml_annotation(Context *context, uint64_t *flags) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Bad state");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ static int acquire_bus(bool set_monitor, sd_bus **ret) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Hmm, unknown transport type.");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
if (r < 0)
|
||||
@ -718,7 +718,7 @@ static int format_cmdline(sd_bus_message *m, FILE *f, bool needs_space) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown basic type.");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
needs_space = true;
|
||||
@ -1957,7 +1957,7 @@ static int json_transform_one(sd_bus_message *m, JsonVariant **ret) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unexpected element type");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
*ret = TAKE_PTR(v);
|
||||
@ -2525,7 +2525,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -141,7 +141,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (arg_machine && arg_show_unit != SHOW_UNIT_NONE)
|
||||
|
@ -885,7 +885,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (optind == argc - 1)
|
||||
|
@ -65,7 +65,7 @@ static int property_get_listen(
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown socket type");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
r = sd_bus_message_append(reply, "(ss)", socket_port_type_to_string(p), a);
|
||||
|
@ -253,7 +253,7 @@ static int pick_uid(char **suggested_paths, const char *name, uid_t *ret_uid) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("unknown phase");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
/* Make sure whatever we picked here actually is in the right range */
|
||||
|
@ -146,7 +146,7 @@ void emergency_action(
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown emergency action");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -544,7 +544,7 @@ static int setup_input(
|
||||
}
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown input type");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
@ -730,7 +730,7 @@ static int setup_output(
|
||||
}
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown error type");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
@ -923,7 +923,7 @@ static int ask_for_confirmation(const char *vc, Unit *u, const char *cmdline) {
|
||||
r = CONFIRM_EXECUTE;
|
||||
break;
|
||||
default:
|
||||
assert_not_reached("Unhandled choice");
|
||||
assert_not_reached();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -407,7 +407,7 @@ bool job_type_is_redundant(JobType a, UnitActiveState b) {
|
||||
return true;
|
||||
|
||||
default:
|
||||
assert_not_reached("Invalid job type");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
@ -781,7 +781,7 @@ static int job_perform_on_unit(Job **j) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Invalid job type");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
/* Log if the job still exists and the start/stop/reload function actually did something. Note that this means
|
||||
@ -849,7 +849,7 @@ int job_run_and_invalidate(Job *j) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown job type");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (j) {
|
||||
|
@ -258,7 +258,7 @@ _noreturn_ static void crash(int sig) {
|
||||
pid = raw_getpid();
|
||||
(void) kill(pid, sig); /* raise() would kill the parent */
|
||||
|
||||
assert_not_reached("We shouldn't be here...");
|
||||
assert_not_reached();
|
||||
_exit(EXIT_EXCEPTION);
|
||||
} else {
|
||||
siginfo_t status;
|
||||
@ -1081,7 +1081,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return 0;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option code.");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (optind < argc && getpid_cached() != 1)
|
||||
@ -2047,7 +2047,7 @@ static int invoke_main_loop(
|
||||
}
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown or unexpected manager objective.");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1223,7 +1223,7 @@ static int mount_stop(Unit *u) {
|
||||
return 0;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unexpected state.");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1383,7 +1383,7 @@ static void mount_sigchld_event(Unit *u, pid_t pid, int code, int status) {
|
||||
else if (code == CLD_DUMPED)
|
||||
f = MOUNT_FAILURE_CORE_DUMP;
|
||||
else
|
||||
assert_not_reached("Unknown code");
|
||||
assert_not_reached();
|
||||
|
||||
if (IN_SET(m->state, MOUNT_REMOUNTING, MOUNT_REMOUNTING_SIGKILL, MOUNT_REMOUNTING_SIGTERM))
|
||||
mount_set_reload_result(m, f);
|
||||
@ -1465,7 +1465,7 @@ static void mount_sigchld_event(Unit *u, pid_t pid, int code, int status) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Uh, control process died at wrong time.");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
/* Notify clients about changed exit status */
|
||||
@ -1541,7 +1541,7 @@ static int mount_dispatch_timer(sd_event_source *source, usec_t usec, void *user
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Timeout at wrong time.");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -570,7 +570,7 @@ static int append_protect_home(MountEntry **p, ProtectHome protect_home, bool ig
|
||||
return append_static_mounts(p, protect_home_yes_table, ELEMENTSOF(protect_home_yes_table), ignore_protect);
|
||||
|
||||
default:
|
||||
assert_not_reached("Unexpected ProtectHome= value");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
@ -592,7 +592,7 @@ static int append_protect_system(MountEntry **p, ProtectSystem protect_system, b
|
||||
return append_static_mounts(p, protect_system_full_table, ELEMENTSOF(protect_system_full_table), ignore_protect);
|
||||
|
||||
default:
|
||||
assert_not_reached("Unexpected ProtectSystem= value");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1359,7 +1359,7 @@ static int apply_one_mount(
|
||||
return mount_overlay(m);
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown mode");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
assert(what);
|
||||
|
@ -562,7 +562,7 @@ static int scope_dispatch_timer(sd_event_source *source, usec_t usec, void *user
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Timeout at wrong time.");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1683,7 +1683,7 @@ static bool service_shall_restart(Service *s, const char **reason) {
|
||||
return IN_SET(s->result, SERVICE_FAILURE_SIGNAL, SERVICE_FAILURE_CORE_DUMP);
|
||||
|
||||
default:
|
||||
assert_not_reached("unknown restart setting");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2157,7 +2157,7 @@ static void service_enter_start(Service *s) {
|
||||
service_set_main_pid(s, pid);
|
||||
service_set_state(s, SERVICE_START);
|
||||
} else
|
||||
assert_not_reached("Unknown service type");
|
||||
assert_not_reached();
|
||||
|
||||
return;
|
||||
|
||||
@ -2780,7 +2780,7 @@ int service_deserialize_exec_command(
|
||||
return -ENOMEM;
|
||||
break;
|
||||
default:
|
||||
assert_not_reached("Logic error in exec command deserialization");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
@ -3392,7 +3392,7 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
|
||||
else if (code == CLD_DUMPED)
|
||||
f = SERVICE_FAILURE_CORE_DUMP;
|
||||
else
|
||||
assert_not_reached("Unknown code");
|
||||
assert_not_reached();
|
||||
|
||||
if (s->main_pid == pid) {
|
||||
/* Clean up the exec_fd event source. We want to do this here, not later in
|
||||
@ -3523,7 +3523,7 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Uh, main process died at wrong time.");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
@ -3701,7 +3701,7 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Uh, control process died at wrong time.");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
} else /* Neither control nor main PID? If so, don't notify about anything */
|
||||
@ -3756,7 +3756,7 @@ static int service_dispatch_timer(sd_event_source *source, usec_t usec, void *us
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("unknown timeout mode");
|
||||
assert_not_reached();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -3796,7 +3796,7 @@ static int service_dispatch_timer(sd_event_source *source, usec_t usec, void *us
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("unknown timeout mode");
|
||||
assert_not_reached();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -3857,7 +3857,7 @@ static int service_dispatch_timer(sd_event_source *source, usec_t usec, void *us
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("unknown timeout mode");
|
||||
assert_not_reached();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -3912,7 +3912,7 @@ static int service_dispatch_timer(sd_event_source *source, usec_t usec, void *us
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Timeout at wrong time.");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -433,7 +433,7 @@ static void peer_address_hash_func(const SocketPeer *s, struct siphash *state) {
|
||||
else if (s->peer.sa.sa_family == AF_VSOCK)
|
||||
siphash24_compress(&s->peer.vm.svm_cid, sizeof(s->peer.vm.svm_cid), state);
|
||||
else
|
||||
assert_not_reached("Unknown address family.");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
static int peer_address_compare_func(const SocketPeer *x, const SocketPeer *y) {
|
||||
@ -451,7 +451,7 @@ static int peer_address_compare_func(const SocketPeer *x, const SocketPeer *y) {
|
||||
case AF_VSOCK:
|
||||
return CMP(x->peer.vm.svm_cid, y->peer.vm.svm_cid);
|
||||
}
|
||||
assert_not_reached("Black sheep in the family!");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
DEFINE_PRIVATE_HASH_OPS(peer_address_hash_ops, SocketPeer, peer_address_hash_func, peer_address_compare_func);
|
||||
@ -558,7 +558,7 @@ _const_ static const char* listen_lookup(int family, int type) {
|
||||
else if (type == SOCK_SEQPACKET)
|
||||
return "ListenSequentialPacket";
|
||||
|
||||
assert_not_reached("Unknown socket type");
|
||||
assert_not_reached();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -914,7 +914,7 @@ static int instance_from_socket(int fd, unsigned nr, char **instance) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled socket type.");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
*instance = r;
|
||||
@ -1724,7 +1724,7 @@ static int socket_open_fds(Socket *orig_s) {
|
||||
break;
|
||||
}
|
||||
default:
|
||||
assert_not_reached("Unknown port type");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
@ -3071,7 +3071,7 @@ static void socket_sigchld_event(Unit *u, pid_t pid, int code, int status) {
|
||||
else if (code == CLD_DUMPED)
|
||||
f = SOCKET_FAILURE_CORE_DUMP;
|
||||
else
|
||||
assert_not_reached("Unknown sigchld code");
|
||||
assert_not_reached();
|
||||
|
||||
if (s->control_command) {
|
||||
exec_status_exit(&s->control_command->exec_status, &s->exec_context, pid, code, status);
|
||||
@ -3149,7 +3149,7 @@ static void socket_sigchld_event(Unit *u, pid_t pid, int code, int status) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Uh, control process died at wrong time.");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
@ -3226,7 +3226,7 @@ static int socket_dispatch_timer(sd_event_source *source, usec_t usec, void *use
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Timeout at wrong time.");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -979,7 +979,7 @@ static int swap_stop(Unit *u) {
|
||||
return 0;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unexpected state.");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1073,7 +1073,7 @@ static void swap_sigchld_event(Unit *u, pid_t pid, int code, int status) {
|
||||
else if (code == CLD_DUMPED)
|
||||
f = SWAP_FAILURE_CORE_DUMP;
|
||||
else
|
||||
assert_not_reached("Unknown code");
|
||||
assert_not_reached();
|
||||
|
||||
if (s->result == SWAP_SUCCESS)
|
||||
s->result = f;
|
||||
@ -1118,7 +1118,7 @@ static void swap_sigchld_event(Unit *u, pid_t pid, int code, int status) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Uh, control process died at wrong time.");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
/* Notify clients about changed exit status */
|
||||
@ -1169,7 +1169,7 @@ static int swap_dispatch_timer(sd_event_source *source, usec_t usec, void *userd
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Timeout at wrong time.");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -473,7 +473,7 @@ static void timer_enter_waiting(Timer *t, bool time_change) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown timer base");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
v->next_elapse = usec_add(usec_shift_clock(base, CLOCK_MONOTONIC, TIMER_MONOTONIC_CLOCK(t)), v->value);
|
||||
@ -797,7 +797,7 @@ static void timer_trigger_notify(Unit *u, Unit *other) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown timer state");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -418,7 +418,7 @@ bool unit_may_gc(Unit *u) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown garbage collection mode");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (u->cgroup_path) {
|
||||
@ -2591,7 +2591,7 @@ static bool unit_process_job(Job *j, UnitActiveState ns, UnitNotifyFlags flags)
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Job type unknown");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return unexpected;
|
||||
@ -2983,7 +2983,7 @@ bool unit_job_is_applicable(Unit *u, JobType j) {
|
||||
return unit_can_reload(u) && unit_can_start(u);
|
||||
|
||||
default:
|
||||
assert_not_reached("Invalid job type");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
@ -4459,7 +4459,7 @@ static int operation_to_signal(const KillContext *c, KillOperation k, bool *note
|
||||
return c->watchdog_signal;
|
||||
|
||||
default:
|
||||
assert_not_reached("KillOperation unknown");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -331,7 +331,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (arg_since != USEC_INFINITY && arg_until != USEC_INFINITY &&
|
||||
|
@ -232,7 +232,7 @@ static int transcode(
|
||||
return r;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unexpected transcoding mode");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
@ -761,7 +761,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -367,7 +367,7 @@ int wipe_slots(struct crypt_device *cd,
|
||||
|
||||
break;
|
||||
default:
|
||||
assert_not_reached("Unexpected wipe scope");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
/* Then add all slots that match a token type */
|
||||
|
@ -358,7 +358,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -625,7 +625,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -109,7 +109,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (optind < argc)
|
||||
|
@ -287,7 +287,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
}
|
||||
@ -344,7 +344,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown action.");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return 1;
|
||||
@ -818,7 +818,7 @@ static int run(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown action.");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return r;
|
||||
|
@ -119,7 +119,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (optind >= argc)
|
||||
|
@ -1299,7 +1299,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
/* We check if the specified locale strings are valid down here, so that we can take --root= into
|
||||
|
@ -3463,7 +3463,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -957,7 +957,7 @@ static int home_on_worker_process(sd_event_source *s, const siginfo_t *si, void
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unexpected state after worker exited");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -597,7 +597,7 @@ static int manager_acquire_uid(
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("unknown phase");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
other = hashmap_get(m->homes_by_uid, UID_TO_PTR(candidate));
|
||||
|
@ -141,7 +141,7 @@ int home_create_directory_or_subvolume(UserRecord *h, UserRecord **ret_home) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("unexpected storage");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
temporary = TAKE_PTR(d); /* Needs to be destroyed now */
|
||||
|
@ -791,7 +791,7 @@ static int home_activate(UserRecord *h, UserRecord **ret_home) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("unexpected type");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
/* Note that the returned object might either be a reference to an updated version of the existing
|
||||
@ -1305,7 +1305,7 @@ static int home_remove(UserRecord *h) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("unknown storage type");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (hd) {
|
||||
@ -1370,7 +1370,7 @@ static int home_validate_update(UserRecord *h, HomeSetup *setup) {
|
||||
}
|
||||
|
||||
default:
|
||||
assert_not_reached("unexpected storage type");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return has_mount; /* return true if the home record is already active */
|
||||
|
@ -544,7 +544,7 @@ int user_record_test_image_path(UserRecord *h) {
|
||||
return -ENOTDIR;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unexpected record type");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -620,7 +620,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -98,7 +98,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown option");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -226,7 +226,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -261,7 +261,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -190,7 +190,7 @@ int import_uncompress(ImportCompress *c, const void *data, size_t size, ImportCo
|
||||
#endif
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown compression");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -290,7 +290,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -278,7 +278,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -431,7 +431,7 @@ static int transfer_start(Transfer *t) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unexpected transfer type");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
switch (t->type) {
|
||||
|
@ -421,7 +421,7 @@ static size_t pull_job_write_callback(void *contents, size_t size, size_t nmemb,
|
||||
goto fail;
|
||||
|
||||
default:
|
||||
assert_not_reached("Impossible state.");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return sz;
|
||||
|
@ -222,7 +222,7 @@ static void raw_pull_report_progress(RawPull *i, RawProgress p) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown progress state");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
sd_notifyf(false, "X_IMPORT_PROGRESS=%u", percent);
|
||||
|
@ -187,7 +187,7 @@ static void tar_pull_report_progress(TarPull *i, TarProgress p) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown progress state");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
sd_notifyf(false, "X_IMPORT_PROGRESS=%u", percent);
|
||||
|
@ -321,7 +321,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -992,7 +992,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (optind < argc)
|
||||
|
@ -1003,7 +1003,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown option code.");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (optind < argc)
|
||||
|
@ -58,7 +58,7 @@ static int open_output(RemoteServer *s, Writer *w, const char* host) {
|
||||
}
|
||||
|
||||
default:
|
||||
assert_not_reached("what?");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
r = journal_file_open_reliably(filename,
|
||||
@ -110,7 +110,7 @@ int journal_remote_get_writer(RemoteServer *s, const char *host, Writer **writer
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("what split mode?");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
w = hashmap_get(s->writers, key);
|
||||
@ -323,7 +323,7 @@ int journal_remote_server_init(
|
||||
else if (split_mode == JOURNAL_WRITE_SPLIT_HOST)
|
||||
s->output = REMOTE_JOURNAL_PATH;
|
||||
else
|
||||
assert_not_reached("bad split mode");
|
||||
assert_not_reached();
|
||||
|
||||
r = sd_event_default(&s->events);
|
||||
if (r < 0)
|
||||
|
@ -229,10 +229,10 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) {
|
||||
return pos;
|
||||
|
||||
default:
|
||||
assert_not_reached("WTF?");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
assert_not_reached("WTF?");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
static void check_update_watchdog(Uploader *u) {
|
||||
|
@ -779,7 +779,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
argv[optind - 1]);
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option code.");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (!arg_url)
|
||||
|
@ -115,7 +115,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -1046,7 +1046,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (arg_follow && !arg_no_tail && !arg_since && arg_lines == ARG_LINES_DEFAULT)
|
||||
@ -2229,7 +2229,7 @@ int main(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown action");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (arg_directory)
|
||||
@ -2314,7 +2314,7 @@ int main(int argc, char *argv[]) {
|
||||
case ACTION_FLUSH:
|
||||
case ACTION_SYNC:
|
||||
case ACTION_ROTATE:
|
||||
assert_not_reached("Unexpected action.");
|
||||
assert_not_reached();
|
||||
|
||||
case ACTION_PRINT_HEADER:
|
||||
journal_print_header(j);
|
||||
@ -2380,7 +2380,7 @@ int main(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown action");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (arg_boot_offset != 0 &&
|
||||
|
@ -449,7 +449,7 @@ static int stdout_stream_line(StdoutStream *s, char *p, LineBreak line_break) {
|
||||
return stdout_stream_log(s, orig, line_break);
|
||||
}
|
||||
|
||||
assert_not_reached("Unknown stream state");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
static int stdout_stream_found(
|
||||
|
@ -1308,7 +1308,7 @@ static int client_timeout_resend(
|
||||
goto error;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled choice");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
r = event_reset_time(client->event, &client->timeout_resend,
|
||||
@ -1896,7 +1896,7 @@ static int client_handle_message(sd_dhcp_client *client, DHCPMessage *message, i
|
||||
r = -EINVAL;
|
||||
goto error;
|
||||
default:
|
||||
assert_not_reached("invalid state");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
error:
|
||||
|
@ -293,7 +293,7 @@ static int ipv4acd_on_timeout(sd_event_source *s, uint64_t usec, void *userdata)
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Invalid state.");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -409,7 +409,7 @@ static int ipv4acd_on_packet(
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Invalid state.");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -360,7 +360,7 @@ void ipv4ll_on_acd(sd_ipv4acd *acd, int event, void *userdata) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Invalid IPv4ACD event.");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -30,7 +30,7 @@ static void acd_handler(sd_ipv4acd *acd, int event, void *userdata) {
|
||||
log_error("the client was stopped");
|
||||
break;
|
||||
default:
|
||||
assert_not_reached("invalid ACD event");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ static be32_t xid;
|
||||
static sd_event_source *test_hangcheck;
|
||||
|
||||
static int test_dhcp_hangcheck(sd_event_source *s, uint64_t usec, void *userdata) {
|
||||
assert_not_reached("Test case should have completed in 2 seconds");
|
||||
assert_not_reached();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -560,10 +560,8 @@ static int test_advertise_option(sd_event *e) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int test_hangcheck(sd_event_source *s, uint64_t usec, void *userdata) {
|
||||
assert_not_reached("Test case should have completed in 2 seconds");
|
||||
|
||||
return 0;
|
||||
static int test_check_completed_in_2_seconds(sd_event_source *s, uint64_t usec, void *userdata) {
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
static void test_client_solicit_cb(sd_dhcp6_client *client, int event,
|
||||
@ -861,14 +859,8 @@ static int test_client_verify_information_request(DHCP6Message *information_requ
|
||||
break;
|
||||
|
||||
case SD_DHCP6_OPTION_IA_NA:
|
||||
assert_not_reached("IA TA option must not be present");
|
||||
|
||||
break;
|
||||
|
||||
case SD_DHCP6_OPTION_SERVERID:
|
||||
assert_not_reached("Server ID option must not be present");
|
||||
|
||||
break;
|
||||
assert_not_reached();
|
||||
|
||||
case SD_DHCP6_OPTION_ELAPSED_TIME:
|
||||
assert_se(!found_elapsed_time);
|
||||
@ -965,7 +957,7 @@ static int test_client_solicit(sd_event *e) {
|
||||
|
||||
assert_se(sd_event_add_time_relative(e, &hangcheck, clock_boottime_or_monotonic(),
|
||||
2 * USEC_PER_SEC, 0,
|
||||
test_hangcheck, NULL) >= 0);
|
||||
test_check_completed_in_2_seconds, NULL) >= 0);
|
||||
|
||||
assert_se(sd_dhcp6_client_set_local_address(client, &address) >= 0);
|
||||
|
||||
|
@ -38,7 +38,7 @@ static void ll_handler(sd_ipv4ll *ll, int event, void *userdata) {
|
||||
log_error("the client was stopped with address %s", strna(address));
|
||||
break;
|
||||
default:
|
||||
assert_not_reached("invalid LL event");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -259,7 +259,7 @@ _public_ int sd_bus_message_dump(sd_bus_message *m, FILE *f, uint64_t flags) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown basic type.");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ int bus_gvariant_get_size(const char *signature) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown signature type");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
p += n;
|
||||
@ -164,7 +164,7 @@ int bus_gvariant_get_alignment(const char *signature) {
|
||||
}
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown signature type");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (a < 0)
|
||||
@ -229,7 +229,7 @@ int bus_gvariant_is_fixed_size(const char *signature) {
|
||||
}
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown signature type");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
p += n;
|
||||
@ -270,7 +270,7 @@ size_t bus_gvariant_read_word_le(void *p, size_t sz) {
|
||||
else if (sz == 8)
|
||||
return le64toh(x.u64);
|
||||
|
||||
assert_not_reached("unknown word width");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
void bus_gvariant_write_word_le(void *p, size_t sz, size_t value) {
|
||||
@ -293,7 +293,7 @@ void bus_gvariant_write_word_le(void *p, size_t sz, size_t value) {
|
||||
else if (sz == 8)
|
||||
x.u64 = htole64((uint64_t) value);
|
||||
else
|
||||
assert_not_reached("unknown word width");
|
||||
assert_not_reached();
|
||||
|
||||
memcpy(p, &x, sz);
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ static bool value_node_test(
|
||||
return false;
|
||||
|
||||
default:
|
||||
assert_not_reached("Invalid node type");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
@ -234,7 +234,7 @@ static bool value_node_same(
|
||||
return streq(node->value.str, value_str);
|
||||
|
||||
default:
|
||||
assert_not_reached("Invalid node type");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
@ -375,7 +375,7 @@ int bus_match_run(
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown match type.");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (BUS_MATCH_CAN_HASH(node->type)) {
|
||||
|
@ -2275,7 +2275,7 @@ _public_ int sd_bus_message_close_container(sd_bus_message *m) {
|
||||
else if (IN_SET(c->enclosing, SD_BUS_TYPE_STRUCT, SD_BUS_TYPE_DICT_ENTRY))
|
||||
r = bus_message_close_struct(m, c, true);
|
||||
else
|
||||
assert_not_reached("Unknown container type");
|
||||
assert_not_reached();
|
||||
|
||||
free(c->signature);
|
||||
free(c->offsets);
|
||||
@ -3247,7 +3247,7 @@ static int container_next_item(sd_bus_message *m, struct bus_container *c, size_
|
||||
} else if (c->enclosing == SD_BUS_TYPE_VARIANT)
|
||||
goto end;
|
||||
else
|
||||
assert_not_reached("Unknown container type");
|
||||
assert_not_reached();
|
||||
|
||||
return 0;
|
||||
|
||||
@ -3460,7 +3460,7 @@ _public_ int sd_bus_message_read_basic(sd_bus_message *m, char type, void *p) {
|
||||
}
|
||||
|
||||
default:
|
||||
assert_not_reached("unexpected type");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
@ -3575,7 +3575,7 @@ _public_ int sd_bus_message_read_basic(sd_bus_message *m, char type, void *p) {
|
||||
}
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown basic type...");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ void bus_slot_disconnect(sd_bus_slot *slot, bool unref) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Wut? Unknown slot type?");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
bus = slot->bus;
|
||||
|
@ -2545,7 +2545,7 @@ _public_ int sd_bus_get_events(sd_bus *bus) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown state");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return flags;
|
||||
@ -2604,7 +2604,7 @@ _public_ int sd_bus_get_timeout(sd_bus *bus, uint64_t *timeout_usec) {
|
||||
return 0;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown or unexpected stat");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
@ -3063,7 +3063,7 @@ static int bus_exit_now(sd_bus *bus) {
|
||||
else
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
assert_not_reached("exit() didn't exit?");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
static int process_closing_reply_callback(sd_bus *bus, struct reply_callback *c) {
|
||||
@ -3234,7 +3234,7 @@ static int bus_process_internal(sd_bus *bus, sd_bus_message **ret) {
|
||||
return process_closing(bus, ret);
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown state");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (ERRNO_IS_DISCONNECT(r)) {
|
||||
|
@ -57,7 +57,7 @@ static void server(sd_bus *b, size_t *result) {
|
||||
return;
|
||||
|
||||
} else if (!sd_bus_message_is_signal(m, NULL, NULL))
|
||||
assert_not_reached("Unknown method");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
OBJECT_PATH_FOREACH_PREFIX(prefix, "/") {
|
||||
log_info("<%s>", prefix);
|
||||
assert_not_reached("???");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
r = 0;
|
||||
|
@ -639,7 +639,7 @@ int device_read_uevent_file(sd_device *device) {
|
||||
|
||||
break;
|
||||
default:
|
||||
assert_not_reached("Invalid state when parsing uevent file");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (major) {
|
||||
|
@ -915,7 +915,7 @@ static void source_disconnect(sd_event_source *s) {
|
||||
}
|
||||
|
||||
default:
|
||||
assert_not_reached("Wut? I shouldn't exist.");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (s->pending)
|
||||
@ -2407,7 +2407,7 @@ static int event_source_offline(
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Wut? I shouldn't exist.");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
/* Always reshuffle time prioq, as the ratelimited flag may be changed. */
|
||||
@ -2495,7 +2495,7 @@ static int event_source_online(
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Wut? I shouldn't exist.");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
s->enabled = enabled;
|
||||
@ -3569,7 +3569,7 @@ static int source_dispatch(sd_event_source *s) {
|
||||
case SOURCE_WATCHDOG:
|
||||
case _SOURCE_EVENT_SOURCE_TYPE_MAX:
|
||||
case _SOURCE_EVENT_SOURCE_TYPE_INVALID:
|
||||
assert_not_reached("Wut? I shouldn't exist.");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
s->dispatching = false;
|
||||
@ -3929,7 +3929,7 @@ static int process_epoll(sd_event *e, usec_t timeout, int64_t threshold, int64_t
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unexpected event source type");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
break;
|
||||
@ -3953,7 +3953,7 @@ static int process_epoll(sd_event *e, usec_t timeout, int64_t threshold, int64_t
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Invalid wake-up pointer");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
if (r < 0)
|
||||
|
@ -55,7 +55,7 @@ static int io_handler(sd_event_source *s, int fd, uint32_t revents, void *userda
|
||||
else
|
||||
assert_se(sd_event_source_set_enabled(s, SD_EVENT_OFF) >= 0);
|
||||
} else
|
||||
assert_not_reached("Yuck!");
|
||||
assert_not_reached();
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -170,7 +170,7 @@ static int time_handler(sd_event_source *s, uint64_t usec, void *userdata) {
|
||||
got_c = true;
|
||||
}
|
||||
} else
|
||||
assert_not_reached("Huh?");
|
||||
assert_not_reached();
|
||||
|
||||
return 2;
|
||||
}
|
||||
@ -452,7 +452,7 @@ static int inotify_handler(sd_event_source *s, const struct inotify_event *ev, v
|
||||
log_info("inotify-handler <%s>: delete of %s", description, ev->name);
|
||||
assert_se(streq(ev->name, "sub"));
|
||||
} else
|
||||
assert_not_reached("unexpected inotify event");
|
||||
assert_not_reached();
|
||||
|
||||
maybe_exit(s, c);
|
||||
return 1;
|
||||
@ -470,7 +470,7 @@ static int delete_self_handler(sd_event_source *s, const struct inotify_event *e
|
||||
} else if (ev->mask & IN_IGNORED) {
|
||||
log_info("delete-self-handler: ignore");
|
||||
} else
|
||||
assert_not_reached("unexpected inotify event (delete-self)");
|
||||
assert_not_reached();
|
||||
|
||||
maybe_exit(s, c);
|
||||
return 1;
|
||||
|
@ -190,7 +190,7 @@ static bool same_field(const void *_a, size_t s, const void *_b, size_t t) {
|
||||
return true;
|
||||
}
|
||||
|
||||
assert_not_reached("\"=\" not found");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
static Match *match_new(Match *p, MatchType t) {
|
||||
|
@ -68,7 +68,7 @@ static char* make_buf(size_t count, const char *type) {
|
||||
random_bytes(buf + 8*step, step);
|
||||
memzero(buf + 9*step, step);
|
||||
} else
|
||||
assert_not_reached("here");
|
||||
assert_not_reached();
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
@ -1163,7 +1163,7 @@ int sd_netlink_message_enter_container(sd_netlink_message *m, unsigned short typ
|
||||
break;
|
||||
}
|
||||
default:
|
||||
assert_not_reached("sd-netlink: invalid type system union type");
|
||||
assert_not_reached();
|
||||
}
|
||||
} else
|
||||
return -EINVAL;
|
||||
|
@ -92,7 +92,7 @@ void netlink_slot_disconnect(sd_netlink_slot *slot, bool unref) {
|
||||
|
||||
break;
|
||||
default:
|
||||
assert_not_reached("Wut? Unknown slot type?");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
slot->type = _NETLINK_SLOT_INVALID;
|
||||
|
@ -288,7 +288,7 @@ int sd_rtnl_message_new_nexthop(sd_netlink *rtnl, sd_netlink_message **ret,
|
||||
assert_return(IN_SET(nh_family, AF_UNSPEC, AF_INET, AF_INET6), -EINVAL);
|
||||
break;
|
||||
default:
|
||||
assert_not_reached("Invalid message type.");
|
||||
assert_not_reached();
|
||||
}
|
||||
assert_return(ret, -EINVAL);
|
||||
|
||||
|
@ -397,7 +397,7 @@ static int handle_request(int out_fd, const Packet *packet, size_t length) {
|
||||
return -ECONNRESET;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unknown request");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -661,7 +661,7 @@ static int complete_query(sd_resolve *resolve, sd_resolve_query *q) {
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Cannot complete unknown query type");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
resolve->current = NULL;
|
||||
|
@ -99,7 +99,7 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
if (r < 0) {
|
||||
log_error_errno(r, "sd_resolve_wait(): %m");
|
||||
assert_not_reached("sd_resolve_wait() failed");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -445,7 +445,7 @@ static int parse_args(int argc, char *argv[], const char **syspath, const char *
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option code.");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -691,7 +691,7 @@ int find_language_fallback(const char *lang, char **language) {
|
||||
}
|
||||
}
|
||||
|
||||
assert_not_reached("should not be here");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
int x11_convert_to_vconsole(Context *c) {
|
||||
|
@ -293,7 +293,7 @@ static int list_x11_keymaps(int argc, char **argv, void *userdata) {
|
||||
else if (streq(argv[0], "list-x11-keymap-options"))
|
||||
look_for = OPTIONS;
|
||||
else
|
||||
assert_not_reached("Wrong parameter");
|
||||
assert_not_reached();
|
||||
|
||||
for (;;) {
|
||||
_cleanup_free_ char *line = NULL;
|
||||
@ -474,7 +474,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -256,7 +256,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
assert_not_reached("Unhandled option");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (arg_action == ACTION_INHIBIT && optind == argc)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user