Resolve warnings caused by -Wextra

This commit is contained in:
Moritz Lipp 2011-09-21 00:46:03 +02:00
parent e20f425128
commit a6268788c0
10 changed files with 67 additions and 34 deletions

View file

@ -11,7 +11,7 @@
#include "utils.h" #include "utils.h"
gboolean gboolean
cb_destroy(GtkWidget* widget, gpointer data) cb_destroy(GtkWidget* UNUSED(widget), gpointer UNUSED(data))
{ {
return TRUE; return TRUE;
} }
@ -78,7 +78,7 @@ cb_view_vadjustment_value_changed(GtkAdjustment *adjustment, gpointer data)
} }
void 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; int pages_per_row = setting->value.i;
zathura_t* zathura = setting->data; zathura_t* zathura = setting->data;

View file

@ -8,7 +8,8 @@
#include "document.h" #include "document.h"
bool 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; return true;
} }
@ -41,13 +42,14 @@ cmd_bookmark_delete(girara_session_t* session, girara_list_t* argument_list)
} }
bool 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; return true;
} }
bool 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 != NULL, false);
g_return_val_if_fail(session->global.data != 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 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; return true;
} }
bool 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; return true;
} }
@ -102,7 +106,7 @@ cmd_open(girara_session_t* session, girara_list_t* argument_list)
} }
bool 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 != NULL, false);
g_return_val_if_fail(session->global.data != NULL, false); g_return_val_if_fail(session->global.data != NULL, false);

View file

@ -25,7 +25,7 @@ INCS = ${GIRARA_INC} ${GTK_INC} $(SQLITE_INC)
LIBS = ${GIRARA_LIB} ${GTK_LIB} $(SQLITE_LIB) -lpthread -lm LIBS = ${GIRARA_LIB} ${GTK_LIB} $(SQLITE_LIB) -lpthread -lm
# flags # flags
CFLAGS += -std=c99 -pedantic -Wall -Wno-format-zero-length $(INCS) CFLAGS += -std=c99 -pedantic -Wall -Wno-format-zero-length -Wextra $(INCS)
# debug # debug
DFLAGS = -g DFLAGS = -g

View file

@ -376,7 +376,7 @@ zathura_document_attachments_get(zathura_document_t* document)
} }
bool bool
zathura_document_attachments_free(zathura_list_t* list) zathura_document_attachments_free(zathura_list_t* UNUSED(list))
{ {
return false; return false;
} }
@ -461,7 +461,7 @@ zathura_page_links_get(zathura_page_t* page)
} }
bool bool
zathura_page_links_free(zathura_list_t* list) zathura_page_links_free(zathura_list_t* UNUSED(list))
{ {
return false; return false;
} }
@ -482,7 +482,7 @@ zathura_page_form_fields_get(zathura_page_t* page)
} }
bool bool
zathura_page_form_fields_free(zathura_list_t* list) zathura_page_form_fields_free(zathura_list_t* UNUSED(list))
{ {
return false; return false;
} }

View file

@ -41,13 +41,15 @@ print(zathura_t* zathura)
} }
void 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 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); cairo_t* cairo = gtk_print_context_get_cairo_context(context);

View file

@ -279,7 +279,8 @@ render_all(zathura_t* zathura)
} }
gboolean 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; zathura_page_t* page = data;
if (page == NULL) { if (page == NULL) {

View file

@ -11,7 +11,8 @@
#include "utils.h" #include "utils.h"
bool 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); 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 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); 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 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); 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 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); 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 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); 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 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 != NULL, false);
g_return_val_if_fail(session->global.data != 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 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 != NULL, false);
g_return_val_if_fail(session->global.data != 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 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); 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 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 != NULL, false);
g_return_val_if_fail(session->global.data != 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 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 != NULL, false);
g_return_val_if_fail(session->global.data != 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 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 != NULL, false);
g_return_val_if_fail(session->global.data != 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 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 != NULL, false);
g_return_val_if_fail(session->global.data != 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 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 != NULL, false);
g_return_val_if_fail(session->global.data != NULL, false); g_return_val_if_fail(session->global.data != NULL, false);
@ -332,7 +345,8 @@ error_ret:
} }
bool 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); 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 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); 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 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 != NULL, false);
g_return_val_if_fail(session->global.data != NULL, false); g_return_val_if_fail(session->global.data != NULL, false);

View file

@ -154,7 +154,8 @@ execute_command(char* const argv[], char** output)
} }
void 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_t* list = girara_node_get_children(tree);*/
/*girara_list_iterator_t* it = girara_list_iterator(list);*/ /*girara_list_iterator_t* it = girara_list_iterator(list);*/

View file

@ -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" }, { "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" }, { "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" }, { "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]"); 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 */ /* 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]; zathura_page_t* page = document->pages[page_id];
gtk_widget_realize(page->event_box); gtk_widget_realize(page->event_box);
} }

View file

@ -6,6 +6,15 @@
#include <stdbool.h> #include <stdbool.h>
#include <girara.h> #include <girara.h>
#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, enum { NEXT, PREVIOUS, LEFT, RIGHT, UP, DOWN, BOTTOM, TOP, HIDE, HIGHLIGHT,
DELETE_LAST_WORD, DELETE_LAST_CHAR, DEFAULT, ERROR, WARNING, NEXT_GROUP, DELETE_LAST_WORD, DELETE_LAST_CHAR, DEFAULT, ERROR, WARNING, NEXT_GROUP,
PREVIOUS_GROUP, ZOOM_IN, ZOOM_OUT, ZOOM_ORIGINAL, ZOOM_SPECIFIC, FORWARD, PREVIOUS_GROUP, ZOOM_IN, ZOOM_OUT, ZOOM_ORIGINAL, ZOOM_SPECIFIC, FORWARD,