turn on -Wsign-compare

This commit is contained in:
Leonardo Hernández Hernández 2023-01-11 12:13:53 -06:00 committed by Leonardo Hernández Hernández
parent 337d6ba3fb
commit 0151bd48dd
Failed to generate hash of commit
3 changed files with 13 additions and 11 deletions

View file

@ -5,7 +5,7 @@ include config.mk
# flags for compiling # flags for compiling
DWLCPPFLAGS = -I. -DWLR_USE_UNSTABLE -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\" $(XWAYLAND) DWLCPPFLAGS = -I. -DWLR_USE_UNSTABLE -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\" $(XWAYLAND)
DWLDEVCFLAGS = -g -pedantic -Wall -Wextra -Wdeclaration-after-statement -Wno-unused-parameter -Wno-sign-compare -Wshadow -Wunused-macros\ DWLDEVCFLAGS = -g -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=strict-prototypes -Werror=implicit -Werror=return-type -Werror=incompatible-pointer-types
# CFLAGS / LDFLAGS # CFLAGS / LDFLAGS

View file

@ -339,10 +339,10 @@ client_set_size(Client *c, uint32_t width, uint32_t height)
return 0; return 0;
} }
#endif #endif
if (width == c->surface.xdg->toplevel->current.width if ((int32_t)width == c->surface.xdg->toplevel->current.width
&& height ==c->surface.xdg->toplevel->current.height) && (int32_t)height == c->surface.xdg->toplevel->current.height)
return 0; return 0;
return wlr_xdg_toplevel_set_size(c->surface.xdg->toplevel, width, height); return wlr_xdg_toplevel_set_size(c->surface.xdg->toplevel, (int32_t)width, (int32_t)height);
} }
static inline void static inline void

16
dwl.c
View file

@ -415,9 +415,9 @@ applybounds(Client *c, struct wlr_box *bbox)
c->geom.x = bbox->x + bbox->width - c->geom.width; c->geom.x = bbox->x + bbox->width - c->geom.width;
if (c->geom.y >= bbox->y + bbox->height) if (c->geom.y >= bbox->y + bbox->height)
c->geom.y = bbox->y + bbox->height - c->geom.height; c->geom.y = bbox->y + bbox->height - c->geom.height;
if (c->geom.x + c->geom.width + 2 * c->bw <= bbox->x) if (c->geom.x + c->geom.width + 2 * (int)c->bw <= bbox->x)
c->geom.x = bbox->x; c->geom.x = bbox->x;
if (c->geom.y + c->geom.height + 2 * c->bw <= bbox->y) if (c->geom.y + c->geom.height + 2 * (int)c->bw <= bbox->y)
c->geom.y = bbox->y; c->geom.y = bbox->y;
} }
@ -426,7 +426,8 @@ applyrules(Client *c)
{ {
/* rule matching */ /* rule matching */
const char *appid, *title; const char *appid, *title;
uint32_t i, newtags = 0; uint32_t newtags = 0;
int i;
const Rule *r; const Rule *r;
Monitor *mon = selmon, *m; Monitor *mon = selmon, *m;
@ -520,7 +521,7 @@ arrangelayers(Monitor *m)
arrangelayer(m, &m->layers[i], &usable_area, 0); arrangelayer(m, &m->layers[i], &usable_area, 0);
/* Find topmost keyboard interactive layer, if such a layer exists */ /* 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(l, &m->layers[layers_above_shell[i]], link) { wl_list_for_each_reverse(l, &m->layers[layers_above_shell[i]], link) {
if (locked || !l->layer_surface->current.keyboard_interactive || !l->mapped) if (locked || !l->layer_surface->current.keyboard_interactive || !l->mapped)
continue; continue;
@ -657,7 +658,7 @@ cleanupmon(struct wl_listener *listener, void *data)
{ {
Monitor *m = wl_container_of(listener, m, destroy); Monitor *m = wl_container_of(listener, m, destroy);
LayerSurface *l, *tmp; LayerSurface *l, *tmp;
int i; size_t i;
/* m->layers[i] are intentionally not unlinked */ /* m->layers[i] are intentionally not unlinked */
for (i = 0; i < LENGTH(m->layers); i++) { for (i = 0; i < LENGTH(m->layers); i++) {
@ -2166,7 +2167,7 @@ setup(void)
struct sigaction sa = {.sa_flags = SA_RESTART, .sa_handler = handlesig}; struct sigaction sa = {.sa_flags = SA_RESTART, .sa_handler = handlesig};
sigemptyset(&sa.sa_mask); sigemptyset(&sa.sa_mask);
for (i = 0; i < LENGTH(sig); i++) for (i = 0; i < (int)LENGTH(sig); i++)
sigaction(sig[i], &sa, NULL); sigaction(sig[i], &sa, NULL);
wlr_log_init(log_level, NULL); wlr_log_init(log_level, NULL);
@ -2454,7 +2455,8 @@ tagmon(const Arg *arg)
void void
tile(Monitor *m) tile(Monitor *m)
{ {
unsigned int i, n = 0, mw, my, ty; unsigned int mw, my, ty;
int i, n = 0;
Client *c; Client *c;
wl_list_for_each(c, &clients, link) wl_list_for_each(c, &clients, link)