convert -Wno-sign-compare to -Werror=sign-compare

This commit is contained in:
Leonardo Hernández Hernández 2023-01-11 12:13:53 -06:00
parent cf9c5745e5
commit b0dcc7167b
No known key found for this signature in database
GPG Key ID: E538897EE11B9624
3 changed files with 18 additions and 15 deletions

View File

@ -5,8 +5,8 @@ include config.mk
# flags for compiling
DWLCPPFLAGS = -I. -DWLR_USE_UNSTABLE -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\" $(XWAYLAND)
DWLDEVCFLAGS = -pedantic -Wall -Wextra -Wdeclaration-after-statement -Wno-unused-parameter -Wno-sign-compare -Wshadow -Wunused-macros\
-Werror=strict-prototypes -Werror=implicit -Werror=return-type -Werror=incompatible-pointer-types
DWLDEVCFLAGS = -pedantic -Wall -Wextra -Wdeclaration-after-statement -Wno-unused-parameter -Wshadow -Wunused-macros\
-Werror=strict-prototypes -Werror=implicit -Werror=return-type -Werror=incompatible-pointer-types -Werror=sign-compare
# CFLAGS / LDFLAGS
PKGS = wlroots wayland-server xkbcommon libinput $(XLIBS)

View File

@ -336,8 +336,10 @@ client_set_fullscreen(Client *c, int fullscreen)
}
static inline uint32_t
client_set_size(Client *c, uint32_t width, uint32_t height)
client_set_size(Client *c, int32_t width, int32_t height)
{
if (width < 0 || height < 0)
return 0;
#ifdef XWAYLAND
if (client_is_x11(c)) {
wlr_xwayland_surface_configure(c->surface.xwayland,
@ -346,7 +348,7 @@ client_set_size(Client *c, uint32_t width, uint32_t height)
}
#endif
if (width == c->surface.xdg->toplevel->current.width
&& height ==c->surface.xdg->toplevel->current.height)
&& height == c->surface.xdg->toplevel->current.height)
return 0;
return wlr_xdg_toplevel_set_size(c->surface.xdg->toplevel, width, height);
}

23
dwl.c
View File

@ -185,7 +185,7 @@ struct Monitor {
unsigned int sellt;
unsigned int tagset[2];
double mfact;
int nmaster;
unsigned int nmaster;
};
typedef struct {
@ -421,19 +421,19 @@ applybounds(Client *c, struct wlr_box *bbox)
c->geom.height = MAX(min.height + (2 * (int)c->bw), c->geom.height);
/* Some clients set them max size to INT_MAX, which does not violates
* the protocol but its innecesary, they can set them max size to zero. */
if (max.width > 0 && !(2 * c->bw > INT_MAX - max.width)) /* Checks for overflow */
c->geom.width = MIN(max.width + (2 * c->bw), c->geom.width);
if (max.height > 0 && !(2 * c->bw > INT_MAX - max.height)) /* Checks for overflow */
c->geom.height = MIN(max.height + (2 * c->bw), c->geom.height);
if (max.width > 0 && !((signed)(2 * c->bw) > INT_MAX - max.width)) /* Checks for overflow */
c->geom.width = MIN((signed)(max.width + (2 * c->bw)), c->geom.width);
if (max.height > 0 && !((signed)(2 * c->bw) > INT_MAX - max.height)) /* Checks for overflow */
c->geom.height = MIN((signed)(max.height + (2 * c->bw)), c->geom.height);
}
if (c->geom.x >= bbox->x + bbox->width)
c->geom.x = bbox->x + bbox->width - c->geom.width;
if (c->geom.y >= bbox->y + bbox->height)
c->geom.y = bbox->y + bbox->height - c->geom.height;
if (c->geom.x + c->geom.width + 2 * c->bw <= bbox->x)
if ((signed)(c->geom.x + c->geom.width + 2 * c->bw) <= bbox->x)
c->geom.x = bbox->x;
if (c->geom.y + c->geom.height + 2 * c->bw <= bbox->y)
if ((signed)(c->geom.y + c->geom.height + 2 * c->bw) <= bbox->y)
c->geom.y = bbox->y;
}
@ -442,7 +442,8 @@ applyrules(Client *c)
{
/* rule matching */
const char *appid, *title;
unsigned int i, newtags = 0;
unsigned int newtags = 0;
int i;
const Rule *r;
Monitor *mon = selmon, *m;
@ -532,7 +533,7 @@ arrangelayers(Monitor *m)
arrangelayer(m, &m->layers[i], &usable_area, 0);
/* Find topmost keyboard interactive layer, if such a layer exists */
for (i = 0; i < LENGTH(layers_above_shell); i++) {
for (i = 0; i < (int)LENGTH(layers_above_shell); i++) {
wl_list_for_each_reverse(layersurface,
&m->layers[layers_above_shell[i]], link) {
if (!locked && layersurface->layer_surface->current.keyboard_interactive
@ -765,8 +766,8 @@ commitnotify(struct wl_listener *listener, void *data)
struct wlr_box box = {0};
client_get_geometry(c, &box);
if (c->mon && !wlr_box_empty(&box) && (box.width != c->geom.width - 2 * c->bw
|| box.height != c->geom.height - 2 * c->bw))
if (c->mon && !wlr_box_empty(&box) && (box.width != (signed)(c->geom.width - 2 * c->bw)
|| box.height != (signed)(c->geom.height - 2 * c->bw)))
c->isfloating ? resize(c, c->geom, 1) : arrange(c->mon);
/* mark a pending resize as completed */