Fix missing prototypes

i3 will now compile with no warnings when -Wmissing-prototypes is used.
This commit is contained in:
Orestis Floros 2018-04-21 02:28:31 +03:00
parent 2a9522dda4
commit a65914f338
No known key found for this signature in database
GPG Key ID: E9AD9F32E401E38F
11 changed files with 42 additions and 42 deletions

View File

@ -35,7 +35,7 @@ install:
script: script:
- docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/check-safe-wrappers.sh - docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/check-safe-wrappers.sh
- docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/check-formatting.sh - docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/check-formatting.sh
- docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 -e CC ${BASENAME} /bin/sh -c 'autoreconf -fi && mkdir -p build && cd build && (../configure || (cat config.log; false)) && make -j CFLAGS="-Wformat -Wformat-security -Wextra -Wno-unused-parameter -Wstrict-prototypes -Werror"' - docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 -e CC ${BASENAME} /bin/sh -c 'autoreconf -fi && mkdir -p build && cd build && (../configure || (cat config.log; false)) && make -j CFLAGS="-Wformat -Wformat-security -Wextra -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Werror"'
- docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/check-spelling.pl - docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/check-spelling.pl
- docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 -e CC ${BASENAME} ./travis/run-tests.sh - docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 -e CC ${BASENAME} ./travis/run-tests.sh
- ./travis/skip-pkg.sh || docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/debian-build.sh deb/debian-amd64/DIST - ./travis/skip-pkg.sh || docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/debian-build.sh deb/debian-amd64/DIST

View File

@ -133,7 +133,7 @@ finish:
* Stop and free() the stdin- and SIGCHLD-watchers * Stop and free() the stdin- and SIGCHLD-watchers
* *
*/ */
void cleanup(void) { static void cleanup(void) {
if (stdin_io != NULL) { if (stdin_io != NULL) {
ev_io_stop(main_loop, stdin_io); ev_io_stop(main_loop, stdin_io);
FREE(stdin_io); FREE(stdin_io);
@ -400,7 +400,7 @@ static bool read_json_input(unsigned char *input, int length) {
* in statusline * in statusline
* *
*/ */
void stdin_io_cb(struct ev_loop *loop, ev_io *watcher, int revents) { static void stdin_io_cb(struct ev_loop *loop, ev_io *watcher, int revents) {
int rec; int rec;
unsigned char *buffer = get_buffer(watcher, &rec); unsigned char *buffer = get_buffer(watcher, &rec);
if (buffer == NULL) if (buffer == NULL)
@ -420,7 +420,7 @@ void stdin_io_cb(struct ev_loop *loop, ev_io *watcher, int revents) {
* whether this is JSON or plain text * whether this is JSON or plain text
* *
*/ */
void stdin_io_first_line_cb(struct ev_loop *loop, ev_io *watcher, int revents) { static void stdin_io_first_line_cb(struct ev_loop *loop, ev_io *watcher, int revents) {
int rec; int rec;
unsigned char *buffer = get_buffer(watcher, &rec); unsigned char *buffer = get_buffer(watcher, &rec);
if (buffer == NULL) if (buffer == NULL)
@ -457,7 +457,7 @@ void stdin_io_first_line_cb(struct ev_loop *loop, ev_io *watcher, int revents) {
* anymore * anymore
* *
*/ */
void child_sig_cb(struct ev_loop *loop, ev_child *watcher, int revents) { static void child_sig_cb(struct ev_loop *loop, ev_child *watcher, int revents) {
int exit_status = WEXITSTATUS(watcher->rstatus); int exit_status = WEXITSTATUS(watcher->rstatus);
ELOG("Child (pid: %d) unexpectedly exited with status %d\n", ELOG("Child (pid: %d) unexpectedly exited with status %d\n",
@ -477,7 +477,7 @@ void child_sig_cb(struct ev_loop *loop, ev_child *watcher, int revents) {
draw_bars(false); draw_bars(false);
} }
void child_write_output(void) { static void child_write_output(void) {
if (child.click_events) { if (child.click_events) {
const unsigned char *output; const unsigned char *output;
size_t size; size_t size;
@ -580,7 +580,7 @@ void start_child(char *command) {
atexit(kill_child_at_exit); atexit(kill_child_at_exit);
} }
void child_click_events_initialize(void) { static void child_click_events_initialize(void) {
if (!child.click_events_init) { if (!child.click_events_init) {
yajl_gen_array_open(gen); yajl_gen_array_open(gen);
child_write_output(); child_write_output();
@ -588,7 +588,7 @@ void child_click_events_initialize(void) {
} }
} }
void child_click_events_key(const char *key) { static void child_click_events_key(const char *key) {
yajl_gen_string(gen, (const unsigned char *)key, strlen(key)); yajl_gen_string(gen, (const unsigned char *)key, strlen(key));
} }

View File

@ -34,7 +34,7 @@ typedef void (*handler_t)(char *);
* Since i3 does not give us much feedback on commands, we do not much * Since i3 does not give us much feedback on commands, we do not much
* *
*/ */
void got_command_reply(char *reply) { static void got_command_reply(char *reply) {
/* TODO: Error handling for command replies */ /* TODO: Error handling for command replies */
} }
@ -42,7 +42,7 @@ void got_command_reply(char *reply) {
* Called, when we get a reply with workspaces data * Called, when we get a reply with workspaces data
* *
*/ */
void got_workspace_reply(char *reply) { static void got_workspace_reply(char *reply) {
DLOG("Got workspace data!\n"); DLOG("Got workspace data!\n");
parse_workspaces_json(reply); parse_workspaces_json(reply);
draw_bars(false); draw_bars(false);
@ -53,7 +53,7 @@ void got_workspace_reply(char *reply) {
* Since i3 does not give us much feedback on commands, we do not much * Since i3 does not give us much feedback on commands, we do not much
* *
*/ */
void got_subscribe_reply(char *reply) { static void got_subscribe_reply(char *reply) {
DLOG("Got subscribe reply: %s\n", reply); DLOG("Got subscribe reply: %s\n", reply);
/* TODO: Error handling for subscribe commands */ /* TODO: Error handling for subscribe commands */
} }
@ -62,7 +62,7 @@ void got_subscribe_reply(char *reply) {
* Called, when we get a reply with outputs data * Called, when we get a reply with outputs data
* *
*/ */
void got_output_reply(char *reply) { static void got_output_reply(char *reply) {
DLOG("Clearing old output configuration...\n"); DLOG("Clearing old output configuration...\n");
free_outputs(); free_outputs();
@ -87,7 +87,7 @@ void got_output_reply(char *reply) {
* Called when we get the configuration for our bar instance * Called when we get the configuration for our bar instance
* *
*/ */
void got_bar_config(char *reply) { static void got_bar_config(char *reply) {
DLOG("Received bar config \"%s\"\n", reply); DLOG("Received bar config \"%s\"\n", reply);
/* We initiate the main function by requesting infos about the outputs and /* We initiate the main function by requesting infos about the outputs and
* workspaces. Everything else (creating the bars, showing the right workspace- * workspaces. Everything else (creating the bars, showing the right workspace-
@ -132,7 +132,7 @@ handler_t reply_handlers[] = {
* Called, when a workspace event arrives (i.e. the user changed the workspace) * Called, when a workspace event arrives (i.e. the user changed the workspace)
* *
*/ */
void got_workspace_event(char *event) { static void got_workspace_event(char *event) {
DLOG("Got workspace event!\n"); DLOG("Got workspace event!\n");
i3_send_msg(I3_IPC_MESSAGE_TYPE_GET_WORKSPACES, NULL); i3_send_msg(I3_IPC_MESSAGE_TYPE_GET_WORKSPACES, NULL);
} }
@ -141,7 +141,7 @@ void got_workspace_event(char *event) {
* Called, when an output event arrives (i.e. the screen configuration changed) * Called, when an output event arrives (i.e. the screen configuration changed)
* *
*/ */
void got_output_event(char *event) { static void got_output_event(char *event) {
DLOG("Got output event!\n"); DLOG("Got output event!\n");
i3_send_msg(I3_IPC_MESSAGE_TYPE_GET_OUTPUTS, NULL); i3_send_msg(I3_IPC_MESSAGE_TYPE_GET_OUTPUTS, NULL);
if (!config.disable_ws) { if (!config.disable_ws) {
@ -153,7 +153,7 @@ void got_output_event(char *event) {
* Called, when a mode event arrives (i3 changed binding mode). * Called, when a mode event arrives (i3 changed binding mode).
* *
*/ */
void got_mode_event(char *event) { static void got_mode_event(char *event) {
DLOG("Got mode event!\n"); DLOG("Got mode event!\n");
parse_mode_json(event); parse_mode_json(event);
draw_bars(false); draw_bars(false);
@ -163,7 +163,7 @@ void got_mode_event(char *event) {
* Called, when a barconfig_update event arrives (i.e. i3 changed the bar hidden_state or mode) * Called, when a barconfig_update event arrives (i.e. i3 changed the bar hidden_state or mode)
* *
*/ */
void got_bar_config_update(char *event) { static void got_bar_config_update(char *event) {
/* check whether this affect this bar instance by checking the bar_id */ /* check whether this affect this bar instance by checking the bar_id */
char *expected_id; char *expected_id;
sasprintf(&expected_id, "\"id\":\"%s\"", config.bar_id); sasprintf(&expected_id, "\"id\":\"%s\"", config.bar_id);
@ -213,7 +213,7 @@ handler_t event_handlers[] = {
* Called, when we get a message from i3 * Called, when we get a message from i3
* *
*/ */
void got_data(struct ev_loop *loop, ev_io *watcher, int events) { static void got_data(struct ev_loop *loop, ev_io *watcher, int events) {
DLOG("Got data!\n"); DLOG("Got data!\n");
int fd = watcher->fd; int fd = watcher->fd;

View File

@ -44,7 +44,7 @@ void debuglog(char *fmt, ...) {
* Glob path, i.e. expand ~ * Glob path, i.e. expand ~
* *
*/ */
char *expand_path(char *path) { static char *expand_path(char *path) {
static glob_t globbuf; static glob_t globbuf;
if (glob(path, GLOB_NOCHECK | GLOB_TILDE, NULL, &globbuf) < 0) { if (glob(path, GLOB_NOCHECK | GLOB_TILDE, NULL, &globbuf) < 0) {
ELOG("glob() failed\n"); ELOG("glob() failed\n");
@ -55,7 +55,7 @@ char *expand_path(char *path) {
return result; return result;
} }
void print_usage(char *elf_name) { static void print_usage(char *elf_name) {
printf("Usage: %s -b bar_id [-s sock_path] [-h] [-v]\n", elf_name); printf("Usage: %s -b bar_id [-s sock_path] [-h] [-v]\n", elf_name);
printf("\n"); printf("\n");
printf("-b, --bar_id <bar_id>\tBar ID for which to get the configuration\n"); printf("-b, --bar_id <bar_id>\tBar ID for which to get the configuration\n");
@ -76,7 +76,7 @@ void print_usage(char *elf_name) {
* in main() with that * in main() with that
* *
*/ */
void sig_cb(struct ev_loop *loop, ev_signal *watcher, int revents) { static void sig_cb(struct ev_loop *loop, ev_signal *watcher, int revents) {
switch (watcher->signum) { switch (watcher->signum) {
case SIGTERM: case SIGTERM:
DLOG("Got a SIGTERM, stopping\n"); DLOG("Got a SIGTERM, stopping\n");

View File

@ -146,13 +146,13 @@ int _xcb_request_failed(xcb_void_cookie_t cookie, char *err_msg, int line) {
return 0; return 0;
} }
uint32_t get_sep_offset(struct status_block *block) { static uint32_t get_sep_offset(struct status_block *block) {
if (!block->no_separator && block->sep_block_width > 0) if (!block->no_separator && block->sep_block_width > 0)
return block->sep_block_width / 2 + block->sep_block_width % 2; return block->sep_block_width / 2 + block->sep_block_width % 2;
return 0; return 0;
} }
int get_tray_width(struct tc_head *trayclients) { static int get_tray_width(struct tc_head *trayclients) {
trayclient *trayclient; trayclient *trayclient;
int tray_width = 0; int tray_width = 0;
TAILQ_FOREACH_REVERSE(trayclient, trayclients, tc_head, tailq) { TAILQ_FOREACH_REVERSE(trayclient, trayclients, tc_head, tailq) {
@ -193,7 +193,7 @@ static void draw_separator(i3_output *output, uint32_t x, struct status_block *b
} }
} }
uint32_t predict_statusline_length(bool use_short_text) { static uint32_t predict_statusline_length(bool use_short_text) {
uint32_t width = 0; uint32_t width = 0;
struct status_block *block; struct status_block *block;
@ -245,7 +245,7 @@ uint32_t predict_statusline_length(bool use_short_text) {
/* /*
* Redraws the statusline to the output's statusline_buffer * Redraws the statusline to the output's statusline_buffer
*/ */
void draw_statusline(i3_output *output, uint32_t clip_left, bool use_focus_colors, bool use_short_text) { static void draw_statusline(i3_output *output, uint32_t clip_left, bool use_focus_colors, bool use_short_text) {
struct status_block *block; struct status_block *block;
color_t bar_color = (use_focus_colors ? colors.focus_bar_bg : colors.bar_bg); color_t bar_color = (use_focus_colors ? colors.focus_bar_bg : colors.bar_bg);
@ -330,7 +330,7 @@ void draw_statusline(i3_output *output, uint32_t clip_left, bool use_focus_color
* Hides all bars (unmaps them) * Hides all bars (unmaps them)
* *
*/ */
void hide_bars(void) { static void hide_bars(void) {
if ((config.hide_on_modifier == M_DOCK) || (config.hidden_state == S_SHOW && config.hide_on_modifier == M_HIDE)) { if ((config.hide_on_modifier == M_DOCK) || (config.hidden_state == S_SHOW && config.hide_on_modifier == M_HIDE)) {
return; return;
} }
@ -349,7 +349,7 @@ void hide_bars(void) {
* Unhides all bars (maps them) * Unhides all bars (maps them)
* *
*/ */
void unhide_bars(void) { static void unhide_bars(void) {
if (config.hide_on_modifier != M_HIDE) { if (config.hide_on_modifier != M_HIDE) {
return; return;
} }
@ -457,7 +457,7 @@ static bool execute_custom_command(xcb_keycode_t input_code, bool event_is_relea
* wheel was used and change the workspace appropriately * wheel was used and change the workspace appropriately
* *
*/ */
void handle_button(xcb_button_press_event_t *event) { static void handle_button(xcb_button_press_event_t *event) {
/* Determine, which bar was clicked */ /* Determine, which bar was clicked */
i3_output *walk; i3_output *walk;
xcb_window_t bar = event->event; xcb_window_t bar = event->event;
@ -1080,7 +1080,7 @@ static void handle_resize_request(xcb_resize_request_event_t *event) {
* events from X11, handle them, then flush our outgoing queue. * events from X11, handle them, then flush our outgoing queue.
* *
*/ */
void xcb_prep_cb(struct ev_loop *loop, ev_prepare *watcher, int revents) { static void xcb_prep_cb(struct ev_loop *loop, ev_prepare *watcher, int revents) {
xcb_generic_event_t *event; xcb_generic_event_t *event;
if (xcb_connection_has_error(xcb_connection)) { if (xcb_connection_has_error(xcb_connection)) {
@ -1177,7 +1177,7 @@ void xcb_prep_cb(struct ev_loop *loop, ev_prepare *watcher, int revents) {
* are triggered * are triggered
* *
*/ */
void xcb_io_cb(struct ev_loop *loop, ev_io *watcher, int revents) { static void xcb_io_cb(struct ev_loop *loop, ev_io *watcher, int revents) {
} }
/* /*
@ -1248,7 +1248,7 @@ char *init_xcb_early(void) {
* in xcb. * in xcb.
* *
*/ */
void register_xkb_keyevents(void) { static void register_xkb_keyevents(void) {
const xcb_query_extension_reply_t *extreply; const xcb_query_extension_reply_t *extreply;
extreply = xcb_get_extension_data(conn, &xcb_xkb_id); extreply = xcb_get_extension_data(conn, &xcb_xkb_id);
if (!extreply->present) { if (!extreply->present) {
@ -1272,7 +1272,7 @@ void register_xkb_keyevents(void) {
* Deregister from xkb keyevents. * Deregister from xkb keyevents.
* *
*/ */
void deregister_xkb_keyevents(void) { static void deregister_xkb_keyevents(void) {
xcb_xkb_select_events(conn, xcb_xkb_select_events(conn,
XCB_XKB_ID_USE_CORE_KBD, XCB_XKB_ID_USE_CORE_KBD,
0, 0,
@ -1338,7 +1338,7 @@ static void send_tray_clientmessage(void) {
* atom. Afterwards, tray clients will send ClientMessages to our window. * atom. Afterwards, tray clients will send ClientMessages to our window.
* *
*/ */
void init_tray(void) { static void init_tray(void) {
DLOG("Initializing system tray functionality\n"); DLOG("Initializing system tray functionality\n");
/* request the tray manager atom for the X11 display we are running on */ /* request the tray manager atom for the X11 display we are running on */
char atomname[strlen("_NET_SYSTEM_TRAY_S") + 11]; char atomname[strlen("_NET_SYSTEM_TRAY_S") + 11];
@ -1567,7 +1567,7 @@ void destroy_window(i3_output *output) {
/* Strut partial tells i3 where to reserve space for i3bar. This is determined /* Strut partial tells i3 where to reserve space for i3bar. This is determined
* by the `position` bar config directive. */ * by the `position` bar config directive. */
xcb_void_cookie_t config_strut_partial(i3_output *output) { static xcb_void_cookie_t config_strut_partial(i3_output *output) {
/* A local struct to save the strut_partial property */ /* A local struct to save the strut_partial property */
struct { struct {
uint32_t left; uint32_t left;

View File

@ -2034,7 +2034,7 @@ void cmd_rename_workspace(I3_CMD, const char *old_name, const char *new_name) {
* Implementation of 'bar mode dock|hide|invisible|toggle [<bar_id>]' * Implementation of 'bar mode dock|hide|invisible|toggle [<bar_id>]'
* *
*/ */
bool cmd_bar_mode(const char *bar_mode, const char *bar_id) { static bool cmd_bar_mode(const char *bar_mode, const char *bar_id) {
int mode = M_DOCK; int mode = M_DOCK;
bool toggle = false; bool toggle = false;
if (strcmp(bar_mode, "dock") == 0) if (strcmp(bar_mode, "dock") == 0)
@ -2079,7 +2079,7 @@ bool cmd_bar_mode(const char *bar_mode, const char *bar_id) {
* Implementation of 'bar hidden_state hide|show|toggle [<bar_id>]' * Implementation of 'bar hidden_state hide|show|toggle [<bar_id>]'
* *
*/ */
bool cmd_bar_hidden_state(const char *bar_hidden_state, const char *bar_id) { static bool cmd_bar_hidden_state(const char *bar_hidden_state, const char *bar_id) {
int hidden_state = S_SHOW; int hidden_state = S_SHOW;
bool toggle = false; bool toggle = false;
if (strcmp(bar_hidden_state, "hide") == 0) if (strcmp(bar_hidden_state, "hide") == 0)

View File

@ -949,8 +949,8 @@ static void handle_client_message(xcb_client_message_event_t *event) {
} }
} }
bool handle_window_type(void *data, xcb_connection_t *conn, uint8_t state, xcb_window_t window, static bool handle_window_type(void *data, xcb_connection_t *conn, uint8_t state, xcb_window_t window,
xcb_atom_t atom, xcb_get_property_reply_t *reply) { xcb_atom_t atom, xcb_get_property_reply_t *reply) {
Con *con; Con *con;
if ((con = con_by_window_id(window)) == NULL || con->window == NULL) if ((con = con_by_window_id(window)) == NULL || con->window == NULL)
return false; return false;

View File

@ -299,7 +299,7 @@ static void sighandler_handle_key_press(xcb_key_press_event_t *event) {
} }
} }
void handle_signal(int sig, siginfo_t *info, void *data) { static void handle_signal(int sig, siginfo_t *info, void *data) {
DLOG("i3 crashed. SIG: %d\n", sig); DLOG("i3 crashed. SIG: %d\n", sig);
struct sigaction action; struct sigaction action;

View File

@ -217,7 +217,7 @@ static char **add_argument(char **original, char *opt_char, char *opt_arg, char
#define y(x, ...) yajl_gen_##x(gen, ##__VA_ARGS__) #define y(x, ...) yajl_gen_##x(gen, ##__VA_ARGS__)
#define ystr(str) yajl_gen_string(gen, (unsigned char *)str, strlen(str)) #define ystr(str) yajl_gen_string(gen, (unsigned char *)str, strlen(str))
char *store_restart_layout(void) { static char *store_restart_layout(void) {
setlocale(LC_NUMERIC, "C"); setlocale(LC_NUMERIC, "C");
yajl_gen gen = yajl_gen_alloc(NULL); yajl_gen gen = yajl_gen_alloc(NULL);

View File

@ -308,7 +308,7 @@ bool workspace_is_visible(Con *ws) {
* XXX: we need to clean up all this recursive walking code. * XXX: we need to clean up all this recursive walking code.
* *
*/ */
Con *_get_sticky(Con *con, const char *sticky_group, Con *exclude) { static Con *_get_sticky(Con *con, const char *sticky_group, Con *exclude) {
Con *current; Con *current;
TAILQ_FOREACH(current, &(con->nodes_head), nodes) { TAILQ_FOREACH(current, &(con->nodes_head), nodes) {

View File

@ -34,7 +34,7 @@ static void read_server_x11_packet_cb(EV_P_ ev_io *w, int revents);
static char *sun_path = NULL; static char *sun_path = NULL;
void cleanup_socket(void) { static void cleanup_socket(void) {
if (sun_path != NULL) { if (sun_path != NULL) {
unlink(sun_path); unlink(sun_path);
free(sun_path); free(sun_path);