]> git.mdlowis.com Git - proto/labwc.git/commitdiff
Prevent 'unused variable' warnings when compiled without asserts
authorConsolatis <35009135+Consolatis@users.noreply.github.com>
Sat, 10 Feb 2024 17:02:30 +0000 (18:02 +0100)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Sat, 10 Feb 2024 18:22:12 +0000 (19:22 +0100)
src/config/rcxml.c
src/input/cursor.c
src/placement.c
src/seat.c

index 768579d55d3cb3267ea14716c793cde1b70b5186..61784e1326461d8056b5558ed755cffbefb08cf3 100644 (file)
@@ -1411,6 +1411,8 @@ post_processing(void)
        if (!libinput_category_get_default()) {
                /* So we still allow tap to click by default */
                struct libinput_category *l = libinput_category_create();
+               /* Prevents unused variable warning when compiled without asserts */
+               (void)l;
                assert(l && libinput_category_get_default() == l);
        }
 
index c1cfdd75bc34c0fc68a9384a9a3c2ff0cb6403be..b06a9ca40ef8f6a27ec0a5797659f71f69022590 100644 (file)
@@ -616,6 +616,8 @@ handle_constraint_commit(struct wl_listener *listener, void *data)
 {
        struct seat *seat = wl_container_of(listener, seat, constraint_commit);
        struct wlr_pointer_constraint_v1 *constraint = seat->current_constraint;
+       /* Prevents unused variable warning when compiled without asserts */
+       (void)constraint;
        assert(constraint->surface = data);
 }
 
index 0f964706b34fc4d159872a5ad8f7c7e00309983e..1429f513c3bfad84f661a6e29a4448041b031d32 100644 (file)
@@ -47,7 +47,6 @@ count_views(struct view *view)
        assert(view);
 
        struct server *server = view->server;
-       assert(server);
 
        struct output *output = view->output;
        if (!output_is_usable(output)) {
@@ -107,7 +106,6 @@ build_grid(struct overlap_bitmap *bmp, struct view *view)
        assert(view);
 
        struct server *server = view->server;
-       assert(server);
 
        /* Always start with a fresh bitmap */
        destroy_bitmap(bmp);
@@ -239,7 +237,6 @@ build_overlap(struct overlap_bitmap *bmp, struct view *view)
        assert(view);
 
        struct server *server = view->server;
-       assert(server);
 
        if (bmp->nr_rows < 1 || bmp->nr_cols < 1) {
                return;
@@ -408,9 +405,6 @@ placement_find_best(struct view *view, struct wlr_box *geometry)
 {
        assert(view);
 
-       struct server *server = view->server;
-       assert(server);
-
        struct border margin = ssd_get_margin(view->ssd);
 
        struct output *output = view->output;
index e574d291cdbd3662ee6101e99daffb52cdc06897..52b1b5d0ed3b3a46caf695870f0391ba00c6693d 100644 (file)
@@ -628,11 +628,15 @@ seat_set_focus_layer(struct seat *seat, struct wlr_layer_surface_v1 *layer)
 static void
 pressed_surface_destroy(struct wl_listener *listener, void *data)
 {
-       struct wlr_surface *surface = data;
        struct seat *seat = wl_container_of(listener, seat,
                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);
 }