From b6e33e5399915379af1ad74a5c3ed54795c9a7fd Mon Sep 17 00:00:00 2001 From: Nick Schermer Date: Fri, 9 Jan 2009 22:54:40 +0100 Subject: [PATCH] Implement 'full' debug-level and fix according warnings --- katze/katze-net.c | 4 ++-- katze/katze-throbber.c | 10 +++++----- katze/katze-utils.c | 2 +- midori/gjs.c | 12 ++++++------ midori/gtkiconentry.c | 2 -- midori/main.c | 34 +++++++++++++++++----------------- midori/midori-app.c | 6 +++--- midori/midori-browser.c | 22 +++++++++++----------- midori/midori-extension.c | 2 +- midori/midori-locationaction.c | 10 +++++----- midori/midori-locationentry.c | 2 +- midori/midori-panel.c | 1 + midori/midori-preferences.c | 8 ++++---- midori/midori-searchaction.c | 2 +- midori/midori-view.c | 5 +++-- midori/sokoke.c | 2 +- panels/midori-addons.c | 2 +- wscript | 26 ++++++++++++++++++++------ 18 files changed, 83 insertions(+), 69 deletions(-) diff --git a/katze/katze-net.c b/katze/katze-net.c index ee45cfd8..363ad9d1 100644 --- a/katze/katze-net.c +++ b/katze/katze-net.c @@ -239,7 +239,7 @@ katze_net_finished_cb (SoupMessage* msg, } #endif -gboolean +static gboolean katze_net_local_cb (KatzeNetPriv* priv) { KatzeNetRequest* request; @@ -288,7 +288,7 @@ katze_net_local_cb (KatzeNetPriv* priv) return FALSE; } -gboolean +static gboolean katze_net_default_cb (KatzeNetPriv* priv) { KatzeNetRequest* request; diff --git a/katze/katze-throbber.c b/katze/katze-throbber.c index 68b61bb1..faaea53a 100644 --- a/katze/katze-throbber.c +++ b/katze/katze-throbber.c @@ -885,17 +885,17 @@ katze_throbber_expose_event (GtkWidget* widget, if (G_LIKELY (cols > 0 && rows > 0)) { - gint index; + gint idx; guint x, y; katze_throbber_aligned_coords (widget, &ax, &ay); - index = throbber->index % (cols * rows); + idx = throbber->index % (cols * rows); if (G_LIKELY (throbber->timer_id >= 0)) - index = MAX (index, 1); + idx = MAX (idx, 1); - x = (index % cols) * throbber->width; - y = (index / cols) * throbber->height; + x = (idx % cols) * throbber->width; + y = (idx / cols) * throbber->height; gdk_draw_pixbuf (event->window, NULL, throbber->pixbuf, x, y, ax, ay, diff --git a/katze/katze-utils.c b/katze/katze-utils.c index ff7a9a8b..fa685d03 100644 --- a/katze/katze-utils.c +++ b/katze/katze-utils.c @@ -335,7 +335,7 @@ katze_property_proxy (gpointer object, } else if (type == G_TYPE_PARAM_ENUM) { - gint i; + guint i; GEnumClass* enum_class = G_ENUM_CLASS ( g_type_class_ref (pspec->value_type)); gint value = katze_object_get_enum (object, property); diff --git a/midori/gjs.c b/midori/gjs.c index 057b9e39..372f3de3 100644 --- a/midori/gjs.c +++ b/midori/gjs.c @@ -198,7 +198,7 @@ gjs_value_get_string (GjsValue* value) return value->string; } -void +static void gjs_value_weak_notify_cb (GjsValue* attribute, GjsValue* value) { @@ -542,7 +542,7 @@ _js_class_get_property_names_cb (JSContextRef js_context, guint n; GParamSpec** pspecs = g_object_class_list_properties ( G_OBJECT_GET_CLASS (object), &n); - gint i; + guint i; for (i = 0; i < n; i++) { const gchar* property = g_param_spec_get_name (pspecs[i]); @@ -556,8 +556,8 @@ _js_class_get_property_names_cb (JSContextRef js_context, guint* signals = g_signal_list_ids (type, &n); for (i = 0; i < n; i++) { - const gchar* signal = g_signal_name (signals[i]); - JSStringRef js_signal = JSStringCreateWithUTF8CString (signal); + const gchar* signal_ = g_signal_name (signals[i]); + JSStringRef js_signal = JSStringCreateWithUTF8CString (signal_); JSPropertyNameAccumulatorAddName (js_properties, js_signal); JSStringRelease (js_signal); } @@ -622,7 +622,7 @@ _js_object_call_as_function_cb (JSContextRef js_context, GValue* values = g_new0 (GValue, n_arguments + 1); g_value_init (&values[0], G_OBJECT_TYPE (object)); g_value_set_instance (&values[0], object); - gint i; + guint i; for (i = 0; i < n_arguments; i++) { GValue value = {0, }; @@ -1002,7 +1002,7 @@ _js_module_get_property_cb (JSContextRef js_context, return result; } -JSObjectRef +static JSObjectRef gjs_module_new (JSContextRef js_context, const gchar* namespace) { diff --git a/midori/gtkiconentry.c b/midori/gtkiconentry.c index 428fb216..8e189932 100644 --- a/midori/gtkiconentry.c +++ b/midori/gtkiconentry.c @@ -97,9 +97,7 @@ enum PROP_SENSITIVITY_SECONDARY }; -static void gtk_icon_entry_class_init (GtkIconEntryClass *klass); static void gtk_icon_entry_editable_init (GtkEditableClass *iface); -static void gtk_icon_entry_init (GtkIconEntry *entry); static void gtk_icon_entry_finalize (GObject *obj); static void gtk_icon_entry_dispose (GObject *obj); static void gtk_icon_entry_map (GtkWidget *widget); diff --git a/midori/main.c b/midori/main.c index 9614245a..17e340ca 100644 --- a/midori/main.c +++ b/midori/main.c @@ -65,11 +65,11 @@ stock_items_init (void) { typedef struct { - gchar* stock_id; - gchar* label; + const gchar* stock_id; + const gchar* label; GdkModifierType modifier; guint keyval; - gchar* fallback; + const gchar* fallback; } FatStockItem; GtkIconSource* icon_source; GtkIconSet* icon_set; @@ -143,7 +143,7 @@ settings_new_from_file (const gchar* filename) GParamSpec* pspec; GType type; const gchar* property; - gchar* string; + gchar* str; gint integer; gfloat number; gboolean boolean; @@ -167,11 +167,11 @@ settings_new_from_file (const gchar* filename) property = g_param_spec_get_name (pspec); if (type == G_TYPE_PARAM_STRING) { - string = sokoke_key_file_get_string_default (key_file, + str = sokoke_key_file_get_string_default (key_file, "settings", property, G_PARAM_SPEC_STRING (pspec)->default_value, NULL); - g_object_set (settings, property, string, NULL); - g_free (string); + g_object_set (settings, property, str, NULL); + g_free (str); } else if (type == G_TYPE_PARAM_INT) { @@ -200,17 +200,17 @@ settings_new_from_file (const gchar* filename) g_type_class_ref (pspec->value_type)); GEnumValue* enum_value = g_enum_get_value (enum_class, G_PARAM_SPEC_ENUM (pspec)->default_value); - gchar* string = sokoke_key_file_get_string_default (key_file, + str = sokoke_key_file_get_string_default (key_file, "settings", property, enum_value->value_name, NULL); - enum_value = g_enum_get_value_by_name (enum_class, string); + enum_value = g_enum_get_value_by_name (enum_class, str); if (enum_value) g_object_set (settings, property, enum_value->value, NULL); else g_warning (_("Value '%s' is invalid for %s"), - string, property); + str, property); - g_free (string); + g_free (str); g_type_class_unref (enum_class); } else @@ -243,9 +243,9 @@ settings_save_to_file (MidoriWebSettings* settings, property = g_param_spec_get_name (pspec); if (!(pspec->flags & G_PARAM_WRITABLE)) { - gchar* comment = g_strdup_printf ("# %s", property); - g_key_file_set_string (key_file, "settings", comment, ""); - g_free (comment); + gchar* prop_comment = g_strdup_printf ("# %s", property); + g_key_file_set_string (key_file, "settings", prop_comment, ""); + g_free (prop_comment); continue; } if (type == G_TYPE_PARAM_STRING) @@ -747,7 +747,7 @@ midori_history_add_items (void* data, /* Test whether have the right number of columns */ g_return_val_if_fail (argc % ncols == 0, 1); - for (i = 0; i <= (argc - ncols); i++) + for (i = 0; i < (argc - ncols) + 1; i++) { if (argv[i]) { @@ -2141,11 +2141,11 @@ main (int argc, G_CALLBACK (midori_bookmarks_remove_item_cb), NULL); if (!katze_array_is_empty (bookmarks)) { - guint i, n; + guint n; n = katze_array_get_length (bookmarks); for (i = 0; i < n; i++) { - KatzeItem* item = katze_array_get_nth_item (bookmarks, i); + item = katze_array_get_nth_item (bookmarks, i); if (KATZE_IS_ARRAY (item)) { g_signal_connect_after (item, "add-item", diff --git a/midori/midori-app.c b/midori/midori-app.c index 11a9f895..8ce5d205 100644 --- a/midori/midori-app.c +++ b/midori/midori-app.c @@ -141,7 +141,7 @@ midori_browser_quit_cb (MidoriBrowser* browser, midori_app_quit (app); } -void +static void _midori_app_add_browser (MidoriApp* app, MidoriBrowser* browser) { @@ -164,7 +164,7 @@ _midori_app_add_browser (MidoriApp* app, #endif } -void +static void _midori_app_quit (MidoriApp* app) { gtk_main_quit (); @@ -282,7 +282,7 @@ static UniqueResponse midori_browser_message_received_cb (UniqueApp* instance, UniqueCommand command, UniqueMessageData* message, - guint time, + guint timestamp, MidoriApp* app) { UniqueResponse response; diff --git a/midori/midori-browser.c b/midori/midori-browser.c index d4fb7ea4..5cfe5f55 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -1990,12 +1990,12 @@ _action_location_activate (GtkAction* action, static void _action_location_active_changed (GtkAction* action, - gint index, + gint idx, MidoriBrowser* browser) { const gchar* uri; - if (index > -1) + if (idx > -1) { uri = midori_location_action_get_uri (MIDORI_LOCATION_ACTION (action)); midori_browser_set_current_uri (browser, uri); @@ -2163,16 +2163,16 @@ _action_search_notify_current_item (GtkAction* action, { MidoriSearchAction* search_action; KatzeItem* item; - guint index; + guint idx; search_action = MIDORI_SEARCH_ACTION (action); item = midori_search_action_get_current_item (search_action); if (item) - index = katze_array_get_item_index (browser->search_engines, item); + idx = katze_array_get_item_index (browser->search_engines, item); else - index = 0; + idx = 0; - g_object_set (browser->settings, "last-web-search", index, NULL); + g_object_set (browser->settings, "last-web-search", idx, NULL); } static void @@ -2827,23 +2827,23 @@ static const gchar* license = static void _action_about_activate_link (GtkAboutDialog* about, - const gchar* link, + const gchar* uri, gpointer user_data) { MidoriBrowser* browser; gint n; browser = MIDORI_BROWSER (user_data); - n = midori_browser_add_uri (browser, link); + n = midori_browser_add_uri (browser, uri); midori_browser_set_current_page (browser, n); } static void _action_about_activate_email (GtkAboutDialog* about, - const gchar* link, + const gchar* uri, gpointer user_data) { - gchar* command = g_strconcat ("xdg-open ", link, NULL); + gchar* command = g_strconcat ("xdg-open ", uri, NULL); g_spawn_command_line_async (command, NULL); g_free (command); } @@ -4070,7 +4070,7 @@ midori_browser_init (MidoriBrowser* browser) gtk_tool_button_set_label (GTK_TOOL_BUTTON (toolitem), _("Close Findbar")); g_signal_connect (toolitem, "clicked", G_CALLBACK (midori_browser_find_button_close_clicked_cb), browser); - #ifdef HAVE_OSX + #if HAVE_OSX gtk_toolbar_insert (GTK_TOOLBAR (browser->find), toolitem, 0); #else gtk_toolbar_insert (GTK_TOOLBAR (browser->find), toolitem, -1); diff --git a/midori/midori-extension.c b/midori/midori-extension.c index 04228bd1..dc540754 100644 --- a/midori/midori-extension.c +++ b/midori/midori-extension.c @@ -140,7 +140,7 @@ midori_extension_class_init (MidoriExtensionClass* class) g_type_class_add_private (class, sizeof (MidoriExtensionPrivate)); } -void +static void midori_extension_activate_cb (MidoriExtension* extension, MidoriApp* app) { diff --git a/midori/midori-locationaction.c b/midori/midori-locationaction.c index 7fcf7867..631cfc74 100644 --- a/midori/midori-locationaction.c +++ b/midori/midori-locationaction.c @@ -894,7 +894,7 @@ midori_location_action_prepend_item (MidoriLocationAction* location_action, GtkTreeModel* filter_model; GtkTreeModel* model; GtkTreeIter iter; - GtkTreeIter index; + GtkTreeIter idx; gint n; gint visits = 0; @@ -904,17 +904,17 @@ midori_location_action_prepend_item (MidoriLocationAction* location_action, if (midori_location_action_iter_insert (location_action, item->uri, &iter, 0)) { - gtk_tree_model_get_iter_first (model, &index); + gtk_tree_model_get_iter_first (model, &idx); gtk_tree_model_get (model, &iter, VISITS_COL, &visits, -1); - gtk_list_store_move_before (GTK_LIST_STORE (model), &iter, &index); + gtk_list_store_move_before (GTK_LIST_STORE (model), &iter, &idx); } n = gtk_tree_model_iter_n_children (filter_model, NULL); if (n > MAX_ITEMS) { - gtk_tree_model_iter_nth_child (model, &index, NULL, n - 1); + gtk_tree_model_iter_nth_child (model, &idx, NULL, n - 1); gtk_list_store_set (GTK_LIST_STORE (model), - &index, VISIBLE_COL, FALSE, -1); + &idx, VISIBLE_COL, FALSE, -1); } /* Only increment the visits when we add the uri */ diff --git a/midori/midori-locationentry.c b/midori/midori-locationentry.c index eceb4b56..92a34277 100644 --- a/midori/midori-locationentry.c +++ b/midori/midori-locationentry.c @@ -134,7 +134,7 @@ _gtk_entry_effective_inner_border (GtkEntry *entry, *border = default_inner_border; } -void +static void gtk_entry_borders (GtkEntry* entry, gint* xborder, gint* yborder, diff --git a/midori/midori-panel.c b/midori/midori-panel.c index 4129d825..160266b9 100644 --- a/midori/midori-panel.c +++ b/midori/midori-panel.c @@ -595,6 +595,7 @@ typedef struct GtkAlignmentClass parent_class; } MidoriDummyViewableClass; +GType midori_dummy_viewable_get_type (void) G_GNUC_CONST; #define MIDORI_TYPE_DUMMY_VIEWABLE (midori_dummy_viewable_get_type ()) #define MIDORI_DUMMY_VIEWABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ MIDORI_TYPE_DUMMY_VIEWABLE, MidoriDummyViewable)) diff --git a/midori/midori-preferences.c b/midori/midori-preferences.c index 0d1b4fe6..8ac296ed 100644 --- a/midori/midori-preferences.c +++ b/midori/midori-preferences.c @@ -235,7 +235,7 @@ midori_preferences_notify_identify_as_cb (MidoriWebSettings* settings, } #endif -#ifdef HAVE_OSX +#if HAVE_OSX static void midori_preferences_help_clicked_cb (GtkWidget* button, GtkDialog* dialog) @@ -260,7 +260,7 @@ midori_preferences_add_toolbutton (GtkWidget* toolbar, const gchar* label, GtkWidget* page) { -#ifdef HAVE_OSX +#if HAVE_OSX *toolbutton = GTK_WIDGET (*toolbutton ? gtk_radio_tool_button_new_from_widget ( GTK_RADIO_TOOL_BUTTON (*toolbutton)) : gtk_radio_tool_button_new (NULL)); gtk_tool_button_set_label (GTK_TOOL_BUTTON (*toolbutton), label); @@ -316,7 +316,7 @@ midori_preferences_set_settings (MidoriPreferences* preferences, preferences->notebook = gtk_notebook_new (); gtk_container_set_border_width (GTK_CONTAINER (preferences->notebook), 6); - #ifdef HAVE_OSX + #if HAVE_OSX gtk_notebook_set_show_tabs (GTK_NOTEBOOK (preferences->notebook), FALSE); gtk_notebook_set_show_border (GTK_NOTEBOOK (preferences->notebook), FALSE); toolbar = gtk_toolbar_new (); @@ -607,7 +607,7 @@ midori_preferences_set_settings (MidoriPreferences* preferences, g_object_unref (sizegroup); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (preferences)->vbox), preferences->notebook, FALSE, FALSE, 4); - #ifdef HAVE_OSX + #if HAVE_OSX GtkWidget* icon; hbox = gtk_hbox_new (FALSE, 0); button = gtk_button_new (); diff --git a/midori/midori-searchaction.c b/midori/midori-searchaction.c index 6a9d21c4..d9852d4f 100644 --- a/midori/midori-searchaction.c +++ b/midori/midori-searchaction.c @@ -1144,7 +1144,7 @@ midori_search_action_get_dialog (MidoriSearchAction* search_action) gtk_widget_set_sensitive (button, FALSE); gtk_box_pack_end (GTK_BOX (vbox), button, FALSE, FALSE, 0); - #ifdef HAVE_OSX + #if HAVE_OSX GtkWidget* icon; hbox = gtk_hbox_new (FALSE, 0); button = gtk_button_new (); diff --git a/midori/midori-view.c b/midori/midori-view.c index bd114f78..b85c79c9 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -692,7 +692,7 @@ gtk_widget_button_press_event_cb (WebKitWebView* web_view, case 1: if (!link_uri) return FALSE; - #ifdef HAVE_OSX + #if HAVE_OSX /* FIXME: Test for Command key */ if (0) #else @@ -1891,8 +1891,9 @@ midori_view_tab_label_parent_set (GtkWidget* tab_label, { GtkWidget* parent; + /* FIXME: Disconnect orientation notification if (old_parent) - /* FIXME: Disconnect orientation notification */; + ; */ if (!(parent = gtk_widget_get_parent (tab_label))) return; diff --git a/midori/sokoke.c b/midori/sokoke.c index 67b7d465..84903b3a 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -251,7 +251,7 @@ typedef enum static SokokeDesktop sokoke_get_desktop (void) { - #ifdef HAVE_OSX + #if HAVE_OSX return SOKOKE_DESKTOP_OSX; #else static SokokeDesktop desktop = SOKOKE_DESKTOP_UNTESTED; diff --git a/panels/midori-addons.c b/panels/midori-addons.c index 8cc55172..67823f6c 100644 --- a/panels/midori-addons.c +++ b/panels/midori-addons.c @@ -308,7 +308,7 @@ _addons_get_files (MidoriAddons* addons) return files; } -GtkTreePath* +static GtkTreePath* _treeview_first_selected_path (GtkTreeView *treeview) { GtkTreeSelection* selection; diff --git a/wscript b/wscript index a1565052..3469c4b9 100644 --- a/wscript +++ b/wscript @@ -141,8 +141,7 @@ def configure (conf): check_pkg ('libxml-2.0', '2.6') conf.check (header_name='unistd.h') - if sys.platform == 'darwin': - conf.define ('HAVE_OSX', 1) + conf.define ('HAVE_OSX', int(sys.platform == 'darwin')) if conf.find_program ('rsvg-convert', var='RSVG_CONVERT'): icons = 'yes' @@ -162,11 +161,26 @@ def configure (conf): conf.write_config_header ('config.h') conf.env.append_value ('CCFLAGS', '-DHAVE_CONFIG_H') debug_level = Options.options.debug_level - if debug_level != '': + if debug_level != 'no': compiler = conf.env['CC_NAME'] if compiler == 'gcc': if debug_level == 'debug': conf.env.append_value ('CCFLAGS', '-Wall -O0 -g') + elif debug_level == 'full': + # -Wdeclaration-after-statement + # -Wmissing-declarations -Wmissing-prototypes + # -Wwrite-strings + conf.env.append_value ('CCFLAGS', + '-Wall -Wextra -O1 -g ' + '-Waggregate-return -Wno-unused-parameter ' + '-Wno-missing-field-initializers ' + '-Wunsafe-loop-optimizations ' + '-Wredundant-decls -Wmissing-noreturn ' + '-Wshadow -Wpointer-arith -Wcast-align ' + '-Winline -Wformat-security ' + '-Winit-self -Wmissing-include-dirs -Wundef ' + '-Wmissing-format-attribute -Wnested-externs ' + '-DG_ENABLE_DEBUG') else: conf.env.append_value ('CCFLAGS', '-O2') else: @@ -207,9 +221,9 @@ def set_options (opt): opt.tool_options ('compiler_cc') opt.get_option_group ('--check-c-compiler').add_option('-d', '--debug-level', - action = 'store', default = '', - help = 'Specify the debugging level. [\'debug\', \'release\']', - choices = ['', 'debug', 'release'], dest = 'debug_level') + action = 'store', default = 'debug', + help = 'Specify the debugging level. [\'no\', \'debug\', \'full\']', + choices = ['no', 'debug', 'full'], dest = 'debug_level') opt.tool_options ('gnu_dirs') opt.parser.remove_option ('--oldincludedir') opt.parser.remove_option ('--htmldir') -- 2.39.5