Fix clang -Wextra except -Wunused-parameter.

Cleared all warnings that occur when passing
CFLAGS="-Wall -Wextra -Wno-unused-parameter" to make using clang 3.3 on
Linux x86-64.
This commit is contained in:
Peter Boström 2013-12-25 20:01:37 +01:00 committed by Michael Stapelberg
parent ac74a63662
commit 9c15b9504e
23 changed files with 35 additions and 35 deletions

View File

@ -299,7 +299,7 @@ static char *rewrite_binding(const char *input) {
/* The "<=" operator is intentional: We also handle the terminating 0-byte /* The "<=" operator is intentional: We also handle the terminating 0-byte
* explicitly by looking for an 'end' token. */ * explicitly by looking for an 'end' token. */
while ((walk - input) <= len) { while ((size_t)(walk - input) <= len) {
/* Skip whitespace before every token, newlines are relevant since they /* Skip whitespace before every token, newlines are relevant since they
* separate configuration directives. */ * separate configuration directives. */
while ((*walk == ' ' || *walk == '\t') && *walk != '\0') while ((*walk == ' ' || *walk == '\t') && *walk != '\0')

View File

@ -135,7 +135,7 @@ yajl_callbacks reply_callbacks = {
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
socket_path = getenv("I3SOCK"); socket_path = getenv("I3SOCK");
int o, option_index = 0; int o, option_index = 0;
int message_type = I3_IPC_MESSAGE_TYPE_COMMAND; uint32_t message_type = I3_IPC_MESSAGE_TYPE_COMMAND;
char *payload = NULL; char *payload = NULL;
bool quiet = false; bool quiet = false;

View File

@ -467,7 +467,7 @@ int main(int argc, char *argv[]) {
uint32_t top_end_x; uint32_t top_end_x;
uint32_t bottom_start_x; uint32_t bottom_start_x;
uint32_t bottom_end_x; uint32_t bottom_end_x;
} __attribute__((__packed__)) strut_partial = {0,}; } __attribute__((__packed__)) strut_partial = {};
strut_partial.top = font.height + 6; strut_partial.top = font.height + 6;
strut_partial.top_start_x = 0; strut_partial.top_start_x = 0;

View File

@ -28,7 +28,7 @@
#include "common.h" #include "common.h"
/* Global variables for child_*() */ /* Global variables for child_*() */
i3bar_child child = { 0 }; i3bar_child child = {};
/* stdin- and sigchild-watchers */ /* stdin- and sigchild-watchers */
ev_io *stdin_io; ev_io *stdin_io;

View File

@ -417,7 +417,7 @@ void handle_button(xcb_button_press_event_t *event) {
const size_t len = namelen + strlen("workspace \"\"") + 1; const size_t len = namelen + strlen("workspace \"\"") + 1;
char *buffer = scalloc(len+num_quotes); char *buffer = scalloc(len+num_quotes);
strncpy(buffer, "workspace \"", strlen("workspace \"")); strncpy(buffer, "workspace \"", strlen("workspace \""));
int inpos, outpos; size_t inpos, outpos;
for (inpos = 0, outpos = strlen("workspace \""); for (inpos = 0, outpos = strlen("workspace \"");
inpos < namelen; inpos < namelen;
inpos++, outpos++) { inpos++, outpos++) {
@ -1524,7 +1524,7 @@ void reconfig_windows(bool redraw_bars) {
uint32_t top_end_x; uint32_t top_end_x;
uint32_t bottom_start_x; uint32_t bottom_start_x;
uint32_t bottom_end_x; uint32_t bottom_end_x;
} __attribute__((__packed__)) strut_partial = {0,}; } __attribute__((__packed__)) strut_partial = {};
switch (config.position) { switch (config.position) {
case POS_NONE: case POS_NONE:
break; break;
@ -1717,7 +1717,7 @@ void draw_bars(bool unhide) {
outputs_walk->bargc, outputs_walk->bargc,
MAX(0, (int16_t)(statusline_width - outputs_walk->rect.w + 4)), 0, MAX(0, (int16_t)(statusline_width - outputs_walk->rect.w + 4)), 0,
MAX(0, (int16_t)(outputs_walk->rect.w - statusline_width - traypx - 4)), 3, MAX(0, (int16_t)(outputs_walk->rect.w - statusline_width - traypx - 4)), 3,
MIN(outputs_walk->rect.w - traypx - 4, statusline_width), font.height + 2); MIN(outputs_walk->rect.w - traypx - 4, (int)statusline_width), font.height + 2);
} }
if (!config.disable_ws) { if (!config.disable_ws) {

View File

@ -84,7 +84,7 @@ Output *get_output_by_name(const char *name);
* if there is no output which contains these coordinates. * if there is no output which contains these coordinates.
* *
*/ */
Output *get_output_containing(int x, int y); Output *get_output_containing(unsigned int x, unsigned int y);
/* /*
* In contained_by_output, we check if any active output contains part of the container. * In contained_by_output, we check if any active output contains part of the container.

View File

@ -30,7 +30,7 @@ char *get_exe_path(const char *argv0) {
#endif #endif
ssize_t linksize; ssize_t linksize;
while ((linksize = readlink(exepath, destpath, destpath_size)) == destpath_size) { while ((linksize = readlink(exepath, destpath, destpath_size)) == (ssize_t)destpath_size) {
destpath_size = destpath_size * 2; destpath_size = destpath_size * 2;
destpath = srealloc(destpath, destpath_size); destpath = srealloc(destpath, destpath_size);
} }

View File

@ -33,7 +33,7 @@ int ipc_send_message(int sockfd, const uint32_t message_size,
.type = message_type .type = message_type
}; };
int sent_bytes = 0; size_t sent_bytes = 0;
int n = 0; int n = 0;
/* This first loop is basically unnecessary. No operating system has /* This first loop is basically unnecessary. No operating system has

View File

@ -28,7 +28,7 @@ void run_assignments(i3Window *window) {
continue; continue;
bool skip = false; bool skip = false;
for (int c = 0; c < window->nr_assignments; c++) { for (uint32_t c = 0; c < window->nr_assignments; c++) {
if (window->ran_assignments[c] != current) if (window->ran_assignments[c] != current)
continue; continue;

View File

@ -147,15 +147,15 @@ static bool tiling_resize(Con *con, xcb_button_press_event_t *event, const click
return tiling_resize_for_border(con, BORDER_TOP, event); return tiling_resize_for_border(con, BORDER_TOP, event);
} }
if (event->event_x >= 0 && event->event_x <= bsr.x && if (event->event_x >= 0 && event->event_x <= (int32_t)bsr.x &&
event->event_y >= bsr.y && event->event_y <= con->rect.height + bsr.height) event->event_y >= (int32_t)bsr.y && event->event_y <= (int32_t)(con->rect.height + bsr.height))
return tiling_resize_for_border(con, BORDER_LEFT, event); return tiling_resize_for_border(con, BORDER_LEFT, event);
if (event->event_x >= (con->window_rect.x + con->window_rect.width) && if (event->event_x >= (int32_t)(con->window_rect.x + con->window_rect.width) &&
event->event_y >= bsr.y && event->event_y <= con->rect.height + bsr.height) event->event_y >= (int32_t)bsr.y && event->event_y <= (int32_t)(con->rect.height + bsr.height))
return tiling_resize_for_border(con, BORDER_RIGHT, event); return tiling_resize_for_border(con, BORDER_RIGHT, event);
if (event->event_y >= (con->window_rect.y + con->window_rect.height)) if (event->event_y >= (int32_t)(con->window_rect.y + con->window_rect.height))
return tiling_resize_for_border(con, BORDER_BOTTOM, event); return tiling_resize_for_border(con, BORDER_BOTTOM, event);
return false; return false;

View File

@ -232,7 +232,7 @@ struct CommandResult *parse_command(const char *input) {
/* The "<=" operator is intentional: We also handle the terminating 0-byte /* The "<=" operator is intentional: We also handle the terminating 0-byte
* explicitly by looking for an 'end' token. */ * explicitly by looking for an 'end' token. */
while ((walk - input) <= len) { while ((size_t)(walk - input) <= len) {
/* skip whitespace and newlines before every token */ /* skip whitespace and newlines before every token */
while ((*walk == ' ' || *walk == '\t' || while ((*walk == ' ' || *walk == '\t' ||
*walk == '\r' || *walk == '\n') && *walk != '\0') *walk == '\r' || *walk == '\n') && *walk != '\0')

View File

@ -175,7 +175,7 @@ void grab_all_keys(xcb_connection_t *conn, bool bind_mode_switch) {
} }
xcb_keycode_t *walk = bind->translated_to; xcb_keycode_t *walk = bind->translated_to;
for (int i = 0; i < bind->number_keycodes; i++) for (uint32_t i = 0; i < bind->number_keycodes; i++)
grab_keycode_for_binding(conn, bind, *walk++); grab_keycode_for_binding(conn, bind, *walk++);
} }
} }

View File

@ -159,7 +159,7 @@ static const char *get_string(const char *identifier) {
return NULL; return NULL;
} }
static const long get_long(const char *identifier) { static long get_long(const char *identifier) {
for (int c = 0; c < 10; c++) { for (int c = 0; c < 10; c++) {
if (stack[c].identifier == NULL) if (stack[c].identifier == NULL)
break; break;
@ -346,7 +346,7 @@ struct ConfigResult *parse_config(const char *input, struct context *context) {
/* The "<=" operator is intentional: We also handle the terminating 0-byte /* The "<=" operator is intentional: We also handle the terminating 0-byte
* explicitly by looking for an 'end' token. */ * explicitly by looking for an 'end' token. */
while ((walk - input) <= len) { while ((size_t)(walk - input) <= len) {
/* Skip whitespace before every token, newlines are relevant since they /* Skip whitespace before every token, newlines are relevant since they
* separate configuration directives. */ * separate configuration directives. */
while ((*walk == ' ' || *walk == '\t') && *walk != '\0') while ((*walk == ' ' || *walk == '\t') && *walk != '\0')
@ -585,7 +585,7 @@ struct ConfigResult *parse_config(const char *input, struct context *context) {
y(map_close); y(map_close);
/* Skip the rest of this line, but continue parsing. */ /* Skip the rest of this line, but continue parsing. */
while ((walk - input) <= len && *walk != '\n') while ((size_t)(walk - input) <= len && *walk != '\n')
walk++; walk++;
free(position); free(position);

View File

@ -135,7 +135,7 @@ void display_running_version(void) {
sasprintf(&exepath, "/proc/%d/exe", getpid()); sasprintf(&exepath, "/proc/%d/exe", getpid());
while ((linksize = readlink(exepath, destpath, destpath_size)) == destpath_size) { while ((linksize = readlink(exepath, destpath, destpath_size)) == (ssize_t)destpath_size) {
destpath_size = destpath_size * 2; destpath_size = destpath_size * 2;
destpath = srealloc(destpath, destpath_size); destpath = srealloc(destpath, destpath_size);
} }
@ -151,7 +151,7 @@ void display_running_version(void) {
free(exepath); free(exepath);
sasprintf(&exepath, "/proc/%s/exe", pid_from_atom); sasprintf(&exepath, "/proc/%s/exe", pid_from_atom);
while ((linksize = readlink(exepath, destpath, destpath_size)) == destpath_size) { while ((linksize = readlink(exepath, destpath, destpath_size)) == (ssize_t)destpath_size) {
destpath_size = destpath_size * 2; destpath_size = destpath_size * 2;
destpath = srealloc(destpath, destpath_size); destpath = srealloc(destpath, destpath_size);
} }

View File

@ -18,7 +18,7 @@ static int num_screens;
* Looks in outputs for the Output whose start coordinates are x, y * Looks in outputs for the Output whose start coordinates are x, y
* *
*/ */
static Output *get_screen_at(int x, int y) { static Output *get_screen_at(unsigned int x, unsigned int y) {
Output *output; Output *output;
TAILQ_FOREACH(output, &outputs, outputs) TAILQ_FOREACH(output, &outputs, outputs)
if (output->rect.x == x && output->rect.y == y) if (output->rect.x == x && output->rect.y == y)

View File

@ -535,12 +535,12 @@ void floating_resize_window(Con *con, const bool proportional,
* a bitmask of the nearest borders (BORDER_LEFT, BORDER_RIGHT, ) */ * a bitmask of the nearest borders (BORDER_LEFT, BORDER_RIGHT, ) */
border_t corner = 0; border_t corner = 0;
if (event->event_x <= (con->rect.width / 2)) if (event->event_x <= (int16_t)(con->rect.width / 2))
corner |= BORDER_LEFT; corner |= BORDER_LEFT;
else corner |= BORDER_RIGHT; else corner |= BORDER_RIGHT;
int cursor = 0; int cursor = 0;
if (event->event_y <= (con->rect.height / 2)) { if (event->event_y <= (int16_t)(con->rect.height / 2)) {
corner |= BORDER_TOP; corner |= BORDER_TOP;
cursor = (corner & BORDER_LEFT) ? cursor = (corner & BORDER_LEFT) ?
XCURSOR_CURSOR_TOP_LEFT_CORNER : XCURSOR_CURSOR_TOP_RIGHT_CORNER; XCURSOR_CURSOR_TOP_LEFT_CORNER : XCURSOR_CURSOR_TOP_RIGHT_CORNER;

View File

@ -1034,7 +1034,7 @@ static void property_notify(uint8_t state, xcb_window_t window, xcb_atom_t atom)
struct property_handler_t *handler = NULL; struct property_handler_t *handler = NULL;
xcb_get_property_reply_t *propr = NULL; xcb_get_property_reply_t *propr = NULL;
for (int c = 0; c < sizeof(property_handlers) / sizeof(struct property_handler_t); c++) { for (size_t c = 0; c < sizeof(property_handlers) / sizeof(struct property_handler_t); c++) {
if (property_handlers[c].atom != atom) if (property_handlers[c].atom != atom)
continue; continue;

View File

@ -250,7 +250,7 @@ static void vlog(const bool print, const char *fmt, va_list args) {
/* If there is no space for the current message in the ringbuffer, we /* If there is no space for the current message in the ringbuffer, we
* need to wrap and write to the beginning again. */ * need to wrap and write to the beginning again. */
if (len >= (logbuffer_size - (logwalk - logbuffer))) { if (len >= (size_t)(logbuffer_size - (logwalk - logbuffer))) {
loglastwrap = logwalk; loglastwrap = logwalk;
logwalk = logbuffer + sizeof(i3_shmlog_header); logwalk = logbuffer + sizeof(i3_shmlog_header);
store_log_markers(); store_log_markers();

View File

@ -252,7 +252,7 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
cwindow->dock = W_DOCK_BOTTOM; cwindow->dock = W_DOCK_BOTTOM;
} else { } else {
DLOG("Ignoring invalid reserved edges (_NET_WM_STRUT_PARTIAL), using position as fallback:\n"); DLOG("Ignoring invalid reserved edges (_NET_WM_STRUT_PARTIAL), using position as fallback:\n");
if (geom->y < (search_at->rect.height / 2)) { if (geom->y < (int16_t)(search_at->rect.height / 2)) {
DLOG("geom->y = %d < rect.height / 2 = %d, it is a top dock client\n", DLOG("geom->y = %d < rect.height / 2 = %d, it is a top dock client\n",
geom->y, (search_at->rect.height / 2)); geom->y, (search_at->rect.height / 2));
cwindow->dock = W_DOCK_TOP; cwindow->dock = W_DOCK_TOP;

View File

@ -77,7 +77,7 @@ Output *get_first_output(void) {
* if there is no output which contains these coordinates. * if there is no output which contains these coordinates.
* *
*/ */
Output *get_output_containing(int x, int y) { Output *get_output_containing(unsigned int x, unsigned int y) {
Output *output; Output *output;
TAILQ_FOREACH(output, &outputs, outputs) { TAILQ_FOREACH(output, &outputs, outputs) {
if (!output->active) if (!output->active)

View File

@ -224,7 +224,7 @@ char *store_restart_layout(void) {
return NULL; return NULL;
} }
int written = 0; size_t written = 0;
while (written < length) { while (written < length) {
int n = write(fd, payload + written, length - written); int n = write(fd, payload + written, length - written);
/* TODO: correct error-handling */ /* TODO: correct error-handling */
@ -242,9 +242,9 @@ char *store_restart_layout(void) {
} }
written += n; written += n;
#if YAJL_MAJOR >= 2 #if YAJL_MAJOR >= 2
printf("written: %d of %zd\n", written, length); DLOG("written: %zd of %zd\n", written, length);
#else #else
printf("written: %d of %d\n", written, length); DLOG("written: %d of %d\n", written, length);
#endif #endif
} }
close(fd); close(fd);

View File

@ -32,7 +32,7 @@ void window_update_class(i3Window *win, xcb_get_property_reply_t *prop, bool bef
FREE(win->class_class); FREE(win->class_class);
win->class_instance = sstrdup(new_class); win->class_instance = sstrdup(new_class);
if ((strlen(new_class) + 1) < xcb_get_property_value_length(prop)) if ((strlen(new_class) + 1) < (size_t)xcb_get_property_value_length(prop))
win->class_class = sstrdup(new_class + strlen(new_class) + 1); win->class_class = sstrdup(new_class + strlen(new_class) + 1);
else win->class_class = NULL; else win->class_class = NULL;
LOG("WM_CLASS changed to %s (instance), %s (class)\n", LOG("WM_CLASS changed to %s (instance), %s (class)\n",

View File

@ -22,7 +22,7 @@ static int num_screens;
* Looks in outputs for the Output whose start coordinates are x, y * Looks in outputs for the Output whose start coordinates are x, y
* *
*/ */
static Output *get_screen_at(int x, int y) { static Output *get_screen_at(unsigned int x, unsigned int y) {
Output *output; Output *output;
TAILQ_FOREACH(output, &outputs, outputs) TAILQ_FOREACH(output, &outputs, outputs)
if (output->rect.x == x && output->rect.y == y) if (output->rect.x == x && output->rect.y == y)