mirror of
https://github.com/labwc/labwc.git
synced 2025-11-02 09:01:47 -05:00
Prevent 'unused variable' warnings when compiled without asserts
This commit is contained in:
parent
e9552fb661
commit
a5c6b2f83d
4 changed files with 10 additions and 8 deletions
|
|
@ -1411,6 +1411,8 @@ post_processing(void)
|
||||||
if (!libinput_category_get_default()) {
|
if (!libinput_category_get_default()) {
|
||||||
/* So we still allow tap to click by default */
|
/* So we still allow tap to click by default */
|
||||||
struct libinput_category *l = libinput_category_create();
|
struct libinput_category *l = libinput_category_create();
|
||||||
|
/* Prevents unused variable warning when compiled without asserts */
|
||||||
|
(void)l;
|
||||||
assert(l && libinput_category_get_default() == l);
|
assert(l && libinput_category_get_default() == l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -616,6 +616,8 @@ handle_constraint_commit(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
struct seat *seat = wl_container_of(listener, seat, constraint_commit);
|
struct seat *seat = wl_container_of(listener, seat, constraint_commit);
|
||||||
struct wlr_pointer_constraint_v1 *constraint = seat->current_constraint;
|
struct wlr_pointer_constraint_v1 *constraint = seat->current_constraint;
|
||||||
|
/* Prevents unused variable warning when compiled without asserts */
|
||||||
|
(void)constraint;
|
||||||
assert(constraint->surface = data);
|
assert(constraint->surface = data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,6 @@ count_views(struct view *view)
|
||||||
assert(view);
|
assert(view);
|
||||||
|
|
||||||
struct server *server = view->server;
|
struct server *server = view->server;
|
||||||
assert(server);
|
|
||||||
|
|
||||||
struct output *output = view->output;
|
struct output *output = view->output;
|
||||||
if (!output_is_usable(output)) {
|
if (!output_is_usable(output)) {
|
||||||
|
|
@ -107,7 +106,6 @@ build_grid(struct overlap_bitmap *bmp, struct view *view)
|
||||||
assert(view);
|
assert(view);
|
||||||
|
|
||||||
struct server *server = view->server;
|
struct server *server = view->server;
|
||||||
assert(server);
|
|
||||||
|
|
||||||
/* Always start with a fresh bitmap */
|
/* Always start with a fresh bitmap */
|
||||||
destroy_bitmap(bmp);
|
destroy_bitmap(bmp);
|
||||||
|
|
@ -239,7 +237,6 @@ build_overlap(struct overlap_bitmap *bmp, struct view *view)
|
||||||
assert(view);
|
assert(view);
|
||||||
|
|
||||||
struct server *server = view->server;
|
struct server *server = view->server;
|
||||||
assert(server);
|
|
||||||
|
|
||||||
if (bmp->nr_rows < 1 || bmp->nr_cols < 1) {
|
if (bmp->nr_rows < 1 || bmp->nr_cols < 1) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -408,9 +405,6 @@ placement_find_best(struct view *view, struct wlr_box *geometry)
|
||||||
{
|
{
|
||||||
assert(view);
|
assert(view);
|
||||||
|
|
||||||
struct server *server = view->server;
|
|
||||||
assert(server);
|
|
||||||
|
|
||||||
struct border margin = ssd_get_margin(view->ssd);
|
struct border margin = ssd_get_margin(view->ssd);
|
||||||
|
|
||||||
struct output *output = view->output;
|
struct output *output = view->output;
|
||||||
|
|
|
||||||
|
|
@ -628,11 +628,15 @@ seat_set_focus_layer(struct seat *seat, struct wlr_layer_surface_v1 *layer)
|
||||||
static void
|
static void
|
||||||
pressed_surface_destroy(struct wl_listener *listener, void *data)
|
pressed_surface_destroy(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
struct wlr_surface *surface = data;
|
|
||||||
struct seat *seat = wl_container_of(listener, seat,
|
struct seat *seat = wl_container_of(listener, seat,
|
||||||
pressed_surface_destroy);
|
pressed_surface_destroy);
|
||||||
|
|
||||||
assert(surface == seat->pressed.surface);
|
/*
|
||||||
|
* Using data directly prevents 'unused variable'
|
||||||
|
* warning when compiling without asserts
|
||||||
|
*/
|
||||||
|
assert(data == seat->pressed.surface);
|
||||||
|
|
||||||
seat_reset_pressed(seat);
|
seat_reset_pressed(seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue