diff --git a/callbacks.c b/callbacks.c index d507816..aedd9b5 100644 --- a/callbacks.c +++ b/callbacks.c @@ -11,7 +11,7 @@ #include "utils.h" gboolean -cb_destroy(GtkWidget* widget, gpointer data) +cb_destroy(GtkWidget* UNUSED(widget), gpointer UNUSED(data)) { return TRUE; } @@ -78,7 +78,7 @@ cb_view_vadjustment_value_changed(GtkAdjustment *adjustment, gpointer data) } void -cb_pages_per_row_value_changed(girara_session_t* session, girara_setting_t* setting) +cb_pages_per_row_value_changed(girara_session_t* UNUSED(session), girara_setting_t* setting) { int pages_per_row = setting->value.i; zathura_t* zathura = setting->data; diff --git a/commands.c b/commands.c index be802bd..a8374b8 100644 --- a/commands.c +++ b/commands.c @@ -8,7 +8,8 @@ #include "document.h" bool -cmd_bookmark_create(girara_session_t* session, girara_list_t* argument_list) +cmd_bookmark_create(girara_session_t* UNUSED(session), girara_list_t* + UNUSED(argument_list)) { return true; } @@ -41,13 +42,14 @@ cmd_bookmark_delete(girara_session_t* session, girara_list_t* argument_list) } bool -cmd_bookmark_open(girara_session_t* session, girara_list_t* argument_list) +cmd_bookmark_open(girara_session_t* UNUSED(session), girara_list_t* + UNUSED(argument_list)) { return true; } bool -cmd_close(girara_session_t* session, girara_list_t* argument_list) +cmd_close(girara_session_t* session, girara_list_t* UNUSED(argument_list)) { g_return_val_if_fail(session != NULL, false); g_return_val_if_fail(session->global.data != NULL, false); @@ -63,13 +65,15 @@ cmd_close(girara_session_t* session, girara_list_t* argument_list) } bool -cmd_info(girara_session_t* session, girara_list_t* argument_list) +cmd_info(girara_session_t* UNUSED(session), girara_list_t* + UNUSED(argument_list)) { return true; } bool -cmd_help(girara_session_t* session, girara_list_t* argument_list) +cmd_help(girara_session_t* UNUSED(session), girara_list_t* + UNUSED(argument_list)) { return true; } @@ -102,7 +106,7 @@ cmd_open(girara_session_t* session, girara_list_t* argument_list) } bool -cmd_print(girara_session_t* session, girara_list_t* argument_list) +cmd_print(girara_session_t* session, girara_list_t* UNUSED(argument_list)) { g_return_val_if_fail(session != NULL, false); g_return_val_if_fail(session->global.data != NULL, false); diff --git a/config.mk b/config.mk index 789b5ba..3363edc 100644 --- a/config.mk +++ b/config.mk @@ -25,7 +25,7 @@ INCS = ${GIRARA_INC} ${GTK_INC} $(SQLITE_INC) LIBS = ${GIRARA_LIB} ${GTK_LIB} $(SQLITE_LIB) -lpthread -lm # flags -CFLAGS += -std=c99 -pedantic -Wall -Wno-format-zero-length $(INCS) +CFLAGS += -std=c99 -pedantic -Wall -Wno-format-zero-length -Wextra $(INCS) # debug DFLAGS = -g diff --git a/document.c b/document.c index 930f677..326e006 100644 --- a/document.c +++ b/document.c @@ -376,7 +376,7 @@ zathura_document_attachments_get(zathura_document_t* document) } bool -zathura_document_attachments_free(zathura_list_t* list) +zathura_document_attachments_free(zathura_list_t* UNUSED(list)) { return false; } @@ -461,7 +461,7 @@ zathura_page_links_get(zathura_page_t* page) } bool -zathura_page_links_free(zathura_list_t* list) +zathura_page_links_free(zathura_list_t* UNUSED(list)) { return false; } @@ -482,7 +482,7 @@ zathura_page_form_fields_get(zathura_page_t* page) } bool -zathura_page_form_fields_free(zathura_list_t* list) +zathura_page_form_fields_free(zathura_list_t* UNUSED(list)) { return false; } diff --git a/print.c b/print.c index 74a0da4..a9dd536 100644 --- a/print.c +++ b/print.c @@ -41,13 +41,15 @@ print(zathura_t* zathura) } void -cb_print_begin(GtkPrintOperation* print_operation, GtkPrintContext* context, zathura_t* zathura) +cb_print_begin(GtkPrintOperation* UNUSED(print_operation), GtkPrintContext* + UNUSED(context), zathura_t* UNUSED(zathura)) { } void -cb_print_draw_page(GtkPrintOperation* print_operation, GtkPrintContext* context, gint page_number, zathura_t* zathura) +cb_print_draw_page(GtkPrintOperation* UNUSED(print_operation), GtkPrintContext* + context, gint page_number, zathura_t* zathura) { cairo_t* cairo = gtk_print_context_get_cairo_context(context); diff --git a/render.c b/render.c index 1d3912c..e6831e9 100644 --- a/render.c +++ b/render.c @@ -279,7 +279,8 @@ render_all(zathura_t* zathura) } gboolean -page_expose_event(GtkWidget* widget, GdkEventExpose* event, gpointer data) +page_expose_event(GtkWidget* UNUSED(widget), GdkEventExpose* UNUSED(event), + gpointer data) { zathura_page_t* page = data; if (page == NULL) { diff --git a/shortcuts.c b/shortcuts.c index 6512bd8..c650b69 100644 --- a/shortcuts.c +++ b/shortcuts.c @@ -11,7 +11,8 @@ #include "utils.h" bool -sc_abort(girara_session_t* session, girara_argument_t* argument, unsigned int t) +sc_abort(girara_session_t* session, girara_argument_t* UNUSED(argument), + unsigned int UNUSED(t)) { g_return_val_if_fail(session != NULL, false); @@ -21,7 +22,8 @@ sc_abort(girara_session_t* session, girara_argument_t* argument, unsigned int t) } bool -sc_adjust_window(girara_session_t* session, girara_argument_t* argument, unsigned int t) +sc_adjust_window(girara_session_t* session, girara_argument_t* UNUSED(argument), + unsigned int UNUSED(t)) { g_return_val_if_fail(session != NULL, false); @@ -29,7 +31,8 @@ sc_adjust_window(girara_session_t* session, girara_argument_t* argument, unsigne } bool -sc_change_mode(girara_session_t* session, girara_argument_t* argument, unsigned int t) +sc_change_mode(girara_session_t* session, girara_argument_t* argument, unsigned + int UNUSED(t)) { g_return_val_if_fail(session != NULL, false); @@ -39,7 +42,8 @@ sc_change_mode(girara_session_t* session, girara_argument_t* argument, unsigned } bool -sc_focus_inputbar(girara_session_t* session, girara_argument_t* argument, unsigned int t) +sc_focus_inputbar(girara_session_t* session, girara_argument_t* argument, + unsigned int UNUSED(t)) { g_return_val_if_fail(session != NULL, false); @@ -61,7 +65,8 @@ sc_focus_inputbar(girara_session_t* session, girara_argument_t* argument, unsign } bool -sc_follow(girara_session_t* session, girara_argument_t* argument, unsigned int t) +sc_follow(girara_session_t* session, girara_argument_t* UNUSED(argument), + unsigned int UNUSED(t)) { g_return_val_if_fail(session != NULL, false); @@ -97,7 +102,8 @@ sc_goto(girara_session_t* session, girara_argument_t* argument, unsigned int t) } bool -sc_navigate(girara_session_t* session, girara_argument_t* argument, unsigned int t) +sc_navigate(girara_session_t* session, girara_argument_t* argument, unsigned int + UNUSED(t)) { g_return_val_if_fail(session != NULL, false); g_return_val_if_fail(session->global.data != NULL, false); @@ -120,7 +126,8 @@ sc_navigate(girara_session_t* session, girara_argument_t* argument, unsigned int } bool -sc_recolor(girara_session_t* session, girara_argument_t* argument, unsigned int t) +sc_recolor(girara_session_t* session, girara_argument_t* UNUSED(argument), + unsigned int UNUSED(t)) { g_return_val_if_fail(session != NULL, false); g_return_val_if_fail(session->global.data != NULL, false); @@ -133,7 +140,8 @@ sc_recolor(girara_session_t* session, girara_argument_t* argument, unsigned int } bool -sc_reload(girara_session_t* session, girara_argument_t* argument, unsigned int t) +sc_reload(girara_session_t* session, girara_argument_t* UNUSED(argument), + unsigned int UNUSED(t)) { g_return_val_if_fail(session != NULL, false); @@ -141,7 +149,8 @@ sc_reload(girara_session_t* session, girara_argument_t* argument, unsigned int t } bool -sc_rotate(girara_session_t* session, girara_argument_t* argument, unsigned int t) +sc_rotate(girara_session_t* session, girara_argument_t* UNUSED(argument), + unsigned int UNUSED(t)) { g_return_val_if_fail(session != NULL, false); g_return_val_if_fail(session->global.data != NULL, false); @@ -158,7 +167,8 @@ sc_rotate(girara_session_t* session, girara_argument_t* argument, unsigned int t } bool -sc_scroll(girara_session_t* session, girara_argument_t* argument, unsigned int t) +sc_scroll(girara_session_t* session, girara_argument_t* argument, unsigned int + UNUSED(t)) { g_return_val_if_fail(session != NULL, false); g_return_val_if_fail(session->global.data != NULL, false); @@ -218,7 +228,8 @@ sc_scroll(girara_session_t* session, girara_argument_t* argument, unsigned int t } bool -sc_search(girara_session_t* session, girara_argument_t* argument, unsigned int t) +sc_search(girara_session_t* session, girara_argument_t* argument, unsigned int + UNUSED(t)) { g_return_val_if_fail(session != NULL, false); g_return_val_if_fail(session->global.data != NULL, false); @@ -230,7 +241,8 @@ sc_search(girara_session_t* session, girara_argument_t* argument, unsigned int t } bool -sc_navigate_index(girara_session_t* session, girara_argument_t* argument, unsigned int t) +sc_navigate_index(girara_session_t* session, girara_argument_t* argument, + unsigned int UNUSED(t)) { g_return_val_if_fail(session != NULL, false); g_return_val_if_fail(session->global.data != NULL, false); @@ -242,7 +254,8 @@ sc_navigate_index(girara_session_t* session, girara_argument_t* argument, unsign } bool -sc_toggle_index(girara_session_t* session, girara_argument_t* argument, unsigned int t) +sc_toggle_index(girara_session_t* session, girara_argument_t* argument, unsigned + int UNUSED(t)) { g_return_val_if_fail(session != NULL, false); g_return_val_if_fail(session->global.data != NULL, false); @@ -332,7 +345,8 @@ error_ret: } bool -sc_toggle_fullscreen(girara_session_t* session, girara_argument_t* argument, unsigned int t) +sc_toggle_fullscreen(girara_session_t* session, girara_argument_t* + UNUSED(argument), unsigned int UNUSED(t)) { g_return_val_if_fail(session != NULL, false); @@ -350,7 +364,8 @@ sc_toggle_fullscreen(girara_session_t* session, girara_argument_t* argument, uns } bool -sc_quit(girara_session_t* session, girara_argument_t* argument, unsigned int t) +sc_quit(girara_session_t* session, girara_argument_t* UNUSED(argument), unsigned + int UNUSED(t)) { g_return_val_if_fail(session != NULL, false); @@ -365,7 +380,8 @@ sc_quit(girara_session_t* session, girara_argument_t* argument, unsigned int t) } bool -sc_zoom(girara_session_t* session, girara_argument_t* argument, unsigned int t) +sc_zoom(girara_session_t* session, girara_argument_t* argument, unsigned int + UNUSED(t)) { g_return_val_if_fail(session != NULL, false); g_return_val_if_fail(session->global.data != NULL, false); diff --git a/utils.c b/utils.c index 40e5412..45bd735 100644 --- a/utils.c +++ b/utils.c @@ -154,7 +154,8 @@ execute_command(char* const argv[], char** output) } void -document_index_build(GtkTreeModel* model, GtkTreeIter* parent, girara_tree_node_t* tree) +document_index_build(GtkTreeModel* UNUSED(model), GtkTreeIter* UNUSED(parent), + girara_tree_node_t* UNUSED(tree)) { /*girara_list_t* list = girara_node_get_children(tree);*/ /*girara_list_iterator_t* it = girara_list_iterator(list);*/ diff --git a/zathura.c b/zathura.c index 8347a88..583f478 100644 --- a/zathura.c +++ b/zathura.c @@ -36,7 +36,7 @@ zathura_init(int argc, char* argv[]) { "config-dir", 'c', 0, G_OPTION_ARG_FILENAME, &config_dir, "Path to the config directory", "path" }, { "data-dir", 'd', 0, G_OPTION_ARG_FILENAME, &data_dir, "Path to the data directory", "path" }, { "plugins-dir", 'p', 0, G_OPTION_ARG_STRING, &plugin_path, "Path to the directories containing plugins", "path" }, - { NULL } + { NULL, '\0', 0, 0, NULL, NULL, NULL } }; GOptionContext* context = g_option_context_new(" [file] [password]"); @@ -315,7 +315,7 @@ document_open(zathura_t* zathura, const char* path, const char* password) } /* create blank pages */ - for (int page_id = 0; page_id < document->number_of_pages; page_id++) { + for (unsigned int page_id = 0; page_id < document->number_of_pages; page_id++) { zathura_page_t* page = document->pages[page_id]; gtk_widget_realize(page->event_box); } diff --git a/zathura.h b/zathura.h index d81bfc1..d3583ec 100644 --- a/zathura.h +++ b/zathura.h @@ -6,6 +6,15 @@ #include #include +#ifdef UNUSED +#elif defined(__GNUC__) +# define UNUSED(x) UNUSED_ ## x __attribute__((unused)) +#elif defined(__LCINT__) +# define UNUSED(x) /*@unused@*/ x +#else +# define UNUSED(x) x +#endif + enum { NEXT, PREVIOUS, LEFT, RIGHT, UP, DOWN, BOTTOM, TOP, HIDE, HIGHLIGHT, DELETE_LAST_WORD, DELETE_LAST_CHAR, DEFAULT, ERROR, WARNING, NEXT_GROUP, PREVIOUS_GROUP, ZOOM_IN, ZOOM_OUT, ZOOM_ORIGINAL, ZOOM_SPECIFIC, FORWARD,