Fix some compiler warnings (-Wextra)

This commit is contained in:
Alex Kotov 2021-11-18 23:50:43 +05:00
parent 9f45c282b1
commit 32b5519371
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
3 changed files with 23 additions and 23 deletions

View File

@ -992,7 +992,7 @@ isuniquegeom(XineramaScreenInfo *unique, size_t n, XineramaScreenInfo *info)
#endif /* ENABLE_XINERAMA */
void
killclient(const Arg *arg)
killclient(__attribute__((unused)) const Arg *arg)
{
if (!selmon->sel)
return;
@ -1132,7 +1132,7 @@ manage(Window w, XWindowAttributes *wa)
}
void
movemouse(const Arg *arg)
movemouse(__attribute__((unused)) const Arg *arg)
{
Client *const c = selmon->sel;
if (c == NULL) return;
@ -1214,7 +1214,7 @@ movemouse(const Arg *arg)
// TODO: this function really needs to be refactored
void
nametag(const Arg *arg) {
nametag(__attribute__((unused)) const Arg *arg) {
char name[TAGS_CUSTOM_NAME_SIZE];
if (!menu_run(name, TAGS_CUSTOM_NAME_SIZE, "Tag name")) return;
@ -1294,7 +1294,7 @@ pop(Client *c)
}
void
quit(const Arg *arg)
quit(__attribute__((unused)) const Arg *arg)
{
running = 0;
}
@ -1350,7 +1350,7 @@ resizeclient(Client *c, int x, int y, int w, int h, int bw)
}
void
resizemouse(const Arg *arg)
resizemouse(__attribute__((unused)) const Arg *arg)
{
Client *const c = selmon->sel;
if (c == NULL) return;
@ -1631,7 +1631,6 @@ setmfact(const Arg *arg)
bool
setup(void)
{
int i;
XSetWindowAttributes wa;
/* clean up any zombies immediately */
@ -1659,7 +1658,7 @@ setup(void)
cursor[CurMove] = drw_cur_create(drw, XC_fleur);
/* init appearance */
scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
for (i = 0; i < LENGTH(colors); i++)
for (unsigned int i = 0; i < LENGTH(colors); i++)
scheme[i] = drw_scm_create(drw, colors[i], 3);
/* init system tray */
updatesystray();
@ -1760,7 +1759,7 @@ showhide(Client *c)
}
void
sigchld(int unused)
sigchld(__attribute__((unused)) int unused)
{
if (signal(SIGCHLD, sigchld) == SIG_ERR)
die("can't install SIGCHLD handler:");
@ -1802,7 +1801,7 @@ tagmon(const Arg *arg)
}
void
togglefloating(const Arg *arg)
togglefloating(__attribute__((unused)) const Arg *arg)
{
if (!selmon->sel) return;
@ -1849,7 +1848,7 @@ toggleview(const Arg *arg)
if (newtagset) {
selmon->tagset[selmon->seltags] = newtagset;
if (newtagset == ~0) {
if (newtagset == ~0u) {
selmon->pertag->prevtag = selmon->pertag->curtag;
selmon->pertag->curtag = 0;
}
@ -2028,13 +2027,13 @@ updategeom(void)
void
updatenumlockmask(void)
{
unsigned int i, j;
unsigned int i;
XModifierKeymap *modmap;
numlockmask = 0;
modmap = XGetModifierMapping(dpy);
for (i = 0; i < 8; i++)
for (j = 0; j < modmap->max_keypermod; j++)
for (int j = 0; j < modmap->max_keypermod; j++)
if (modmap->modifiermap[i * modmap->max_keypermod + j]
== XKeysymToKeycode(dpy, XK_Num_Lock))
numlockmask = (1 << i);
@ -2158,7 +2157,7 @@ view(const Arg *arg)
selmon->tagset[selmon->seltags] = new_tagset;
selmon->pertag->prevtag = selmon->pertag->curtag;
if (arg->ui == ~0) {
if (arg->ui == ~0u) {
selmon->pertag->curtag = 0;
} else {
int i = 0;
@ -2257,7 +2256,7 @@ wintomon(Window w)
}
void
zoom(const Arg *arg)
zoom(__attribute__((unused)) const Arg *arg)
{
Client *c = selmon->sel;

View File

@ -27,12 +27,12 @@ removesystrayicon(Client *i)
Monitor *
systraytomon(Monitor *m) {
Monitor *t;
int i, n;
if(!systraypinning) {
if(!m)
return selmon;
return m == selmon ? m : NULL;
}
unsigned int i, n;
for(n = 1, t = mons; t && t->next; n++, t = t->next) ;
for(i = 1, t = mons; t && t->next && i < systraypinning; i++, t = t->next) ;
if(systraypinningfailfirst && n < systraypinning)

View File

@ -4,8 +4,7 @@
/* There's no way to check accesses to destroyed windows, thus those cases are
* ignored (especially on UnmapNotify's). Other types of errors call Xlibs
* default error handler, which may call exit. */
int
xerror(Display *dpy, XErrorEvent *ee)
int xerror(Display *const dpy, XErrorEvent *const ee)
{
if (ee->error_code == BadWindow
|| (ee->request_code == X_SetInputFocus && ee->error_code == BadMatch)
@ -30,17 +29,19 @@ xerror(Display *dpy, XErrorEvent *ee)
return xerrorxlib(dpy, ee); /* may call exit */
}
int
xerrordummy(Display *dpy, XErrorEvent *ee)
{
int xerrordummy(
__attribute__((unused)) Display *const dpy,
__attribute__((unused)) XErrorEvent *const ee
) {
return 0;
}
/* Startup Error handler to check if another window manager
* is already running. */
int
xerrorstart(Display *dpy, XErrorEvent *ee)
{
int xerrorstart(
__attribute__((unused)) Display *const dpy,
__attribute__((unused)) XErrorEvent *const ee
) {
die("polytreewm: another window manager is already running");
return -1;
}