From 1ec56844387ed910b7e87bae186b58cc22cc317a Mon Sep 17 00:00:00 2001 From: Craig Barnes Date: Tue, 9 Feb 2021 13:52:33 +0000 Subject: Convert some uses of xassert(false) to BUG("some error message") --- input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'input.c') diff --git a/input.c b/input.c index 79368270..ad3934b6 100644 --- a/input.c +++ b/input.c @@ -209,7 +209,7 @@ execute_binding(struct seat *seat, struct terminal *term, break; default: - xassert(false); + BUG("Unhandled action type"); success = false; break; } -- cgit v1.3 From 2f81a1d07c3828391bf1b5656a9143aaf3822089 Mon Sep 17 00:00:00 2001 From: Craig Barnes Date: Tue, 9 Feb 2021 15:16:19 +0000 Subject: Convert some more uses of xassert(false) to BUG("...") --- input.c | 4 ++-- render.c | 2 +- search.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'input.c') diff --git a/input.c b/input.c index ad3934b6..944f1336 100644 --- a/input.c +++ b/input.c @@ -325,7 +325,7 @@ execute_binding(struct seat *seat, struct terminal *term, return true; case BIND_ACTION_COUNT: - xassert(false); + BUG("Invalid action type"); return false; } @@ -1150,7 +1150,7 @@ xcursor_for_csd_border(struct terminal *term, int x, int y) else if (term->active_surface == TERM_SURF_BORDER_TOP) return XCURSOR_TOP_SIDE; else if (term->active_surface == TERM_SURF_BORDER_BOTTOM) return XCURSOR_BOTTOM_SIDE; else { - xassert(false); + BUG("Unreachable"); return NULL; } } diff --git a/render.c b/render.c index 99869c2c..8cf7f29a 100644 --- a/render.c +++ b/render.c @@ -1669,7 +1669,7 @@ render_csd_button(struct terminal *term, enum csd_surface surf_idx) break; default: - xassert(false); + BUG("unhandled surface type: %u", (unsigned)surf_idx); break; } diff --git a/search.c b/search.c index 4fde8a92..d7939219 100644 --- a/search.c +++ b/search.c @@ -785,11 +785,11 @@ execute_binding(struct seat *seat, struct terminal *term, return true; case BIND_ACTION_SEARCH_COUNT: - xassert(false); + BUG("Invalid action type"); return true; } - xassert(false); + BUG("Unhandled action type"); return false; } -- cgit v1.3 From 3c86af52c2a3e9352a88e969392575e55c3b6f74 Mon Sep 17 00:00:00 2001 From: Craig Barnes Date: Wed, 10 Feb 2021 09:01:51 +0000 Subject: Convert all but 2 remaining uses of xassert(false) to BUG("...") --- fdm.c | 8 ++------ input.c | 4 ++-- render.c | 4 ++-- selection.c | 13 ++++++------- 4 files changed, 12 insertions(+), 17 deletions(-) (limited to 'input.c') diff --git a/fdm.c b/fdm.c index ef956450..34d0fbff 100644 --- a/fdm.c +++ b/fdm.c @@ -105,16 +105,12 @@ fdm_add(struct fdm *fdm, int fd, int events, fdm_handler_t handler, void *data) #if defined(_DEBUG) int flags = fcntl(fd, F_GETFL); if (!(flags & O_NONBLOCK)) { - LOG_ERR("FD=%d is in blocking mode", fd); - xassert(false); - return false; + BUG("FD=%d is in blocking mode", fd); } tll_foreach(fdm->fds, it) { if (it->item->fd == fd) { - LOG_ERR("FD=%d already registered", fd); - xassert(false); - return false; + BUG("FD=%d already registered", fd); } } #endif diff --git a/input.c b/input.c index 944f1336..64ab2065 100644 --- a/input.c +++ b/input.c @@ -1225,7 +1225,7 @@ wl_pointer_enter(void *data, struct wl_pointer *wl_pointer, break; case TERM_SURF_NONE: - xassert(false); + BUG("Invalid surface type"); break; } } @@ -1806,7 +1806,7 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer, } case TERM_SURF_NONE: - xassert(false); + BUG("Invalid surface type"); break; } diff --git a/render.c b/render.c index 8cf7f29a..026f176f 100644 --- a/render.c +++ b/render.c @@ -1642,7 +1642,7 @@ render_csd_button(struct terminal *term, enum csd_surface surf_idx) break; default: - xassert(false); + BUG("unhandled surface type: %u", (unsigned)surf_idx); break; } @@ -1878,7 +1878,7 @@ render_scrollback_position(struct terminal *term) int surf_top = 0; switch (term->conf->scrollback.indicator.position) { case SCROLLBACK_INDICATOR_POSITION_NONE: - xassert(false); + BUG("Invalid scrollback indicator position type"); return; case SCROLLBACK_INDICATOR_POSITION_FIXED: diff --git a/selection.c b/selection.c index 90c6c392..cb625541 100644 --- a/selection.c +++ b/selection.c @@ -195,11 +195,10 @@ foreach_selected( return; case SELECTION_NONE: - xassert(false); - return; + break; } - xassert(false); + BUG("Invalid selection kind"); } static bool @@ -426,7 +425,7 @@ selection_start(struct terminal *term, int col, int row, break; case SELECTION_NONE: - xassert(false); + BUG("Invalid selection kind"); break; } @@ -728,7 +727,7 @@ selection_update(struct terminal *term, int col, int row) break; case SELECTION_NONE: - xassert(false); + BUG("Invalid selection kind"); break; } @@ -861,7 +860,7 @@ selection_extend_normal(struct terminal *term, int col, int row, case SELECTION_BLOCK: case SELECTION_NONE: - xassert(false); + BUG("Invalid selection kind in this context"); break; } @@ -963,7 +962,7 @@ selection_extend(struct seat *seat, struct terminal *term, switch (term->selection.kind) { case SELECTION_NONE: - xassert(false); + BUG("Invalid selection kind"); return; case SELECTION_CHAR_WISE: -- cgit v1.3