From 6bf4567d7fcf5f0fa5805c4de24c13c2a7cfbbc9 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 25 Sep 2012 15:36:50 -0700 Subject: [PATCH] Remove variables assigned to but never used. Each of the variables removed here was assigned a value that was never used, the assignment didn't have any useful side effects, and I don't see anything that the variable should have been used for. Found by GCC 4.7. --- lib/gtk-contrib/psppire-sheet.c | 9 +-------- src/data/data-in.c | 3 --- src/language/control/repeat.c | 4 +--- src/language/expressions/evaluate.c | 4 +--- src/language/stats/factor.c | 2 -- src/language/stats/quick-cluster.c | 5 ++--- src/libpspp/range-tower.c | 4 +--- src/output/cairo.c | 2 -- src/ui/gui/customentry.c | 4 +--- src/ui/gui/pspp-sheet-view.c | 19 +------------------ src/ui/gui/psppire-dialog-action-rank.c | 8 ++------ src/ui/gui/psppire-dialog.c | 4 ---- src/ui/gui/psppire-dictview.c | 5 ----- src/ui/gui/psppire-syntax-window.c | 3 --- tests/libpspp/heap-test.c | 16 +--------------- 15 files changed, 11 insertions(+), 81 deletions(-) diff --git a/lib/gtk-contrib/psppire-sheet.c b/lib/gtk-contrib/psppire-sheet.c index 7f4c1fed41..0819bb3174 100644 --- a/lib/gtk-contrib/psppire-sheet.c +++ b/lib/gtk-contrib/psppire-sheet.c @@ -1698,13 +1698,9 @@ psppire_sheet_set_scroll_adjustments (PsppireSheet *sheet, static void psppire_sheet_finalize (GObject *object) { - PsppireSheet *sheet; - g_return_if_fail (object != NULL); g_return_if_fail (PSPPIRE_IS_SHEET (object)); - sheet = PSPPIRE_SHEET (object); - if (G_OBJECT_CLASS (parent_class)->finalize) (*G_OBJECT_CLASS (parent_class)->finalize) (object); } @@ -4141,7 +4137,7 @@ draw_button (PsppireSheet *sheet, GdkWindow *window, GdkRectangle allocation) { GtkShadowType shadow_type; - gint text_width = 0, text_height = 0; + gint text_width = 0; PangoAlignment align = PANGO_ALIGN_LEFT; gboolean rtl ; @@ -4206,9 +4202,6 @@ draw_button (PsppireSheet *sheet, GdkWindow *window, if (button->label_visible) { - text_height = DEFAULT_ROW_HEIGHT - - 2 * COLUMN_TITLES_HEIGHT; - gdk_gc_set_clip_rectangle (GTK_WIDGET (sheet)->style->fg_gc[button->state], &allocation); gdk_gc_set_clip_rectangle (GTK_WIDGET (sheet)->style->white_gc, diff --git a/src/data/data-in.c b/src/data/data-in.c index 14a24fffe2..5d4496cf90 100644 --- a/src/data/data-in.c +++ b/src/data/data-in.c @@ -281,7 +281,6 @@ parse_number (struct data_in *i) struct string tmp; - bool explicit_decimals = false; int save_errno; char *tail; @@ -334,7 +333,6 @@ parse_number (struct data_in *i) /* Decimal point and following digits. */ if (ss_match_byte (&i->input, style->decimal)) { - explicit_decimals = true; ds_put_byte (&tmp, '.'); while (c_isdigit (ss_first (i->input))) ds_put_byte (&tmp, ss_get_byte (&i->input)); @@ -345,7 +343,6 @@ parse_number (struct data_in *i) && !ss_is_empty (i->input) && strchr ("eEdD-+", ss_first (i->input))) { - explicit_decimals = true; ds_put_byte (&tmp, 'e'); if (strchr ("eEdD", ss_first (i->input))) diff --git a/src/language/control/repeat.c b/src/language/control/repeat.c index 4f63ec69ba..72d45c2c2f 100644 --- a/src/language/control/repeat.c +++ b/src/language/control/repeat.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2007, 2009-2011 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2007, 2009-2012 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -249,7 +249,6 @@ parse_commands (struct lexer *lexer, struct hmap *dummies) enum segmenter_mode mode; struct string *outputs; struct string input; - size_t input_len; size_t n_values; char *file_name; int line_number; @@ -272,7 +271,6 @@ parse_commands (struct lexer *lexer, struct hmap *dummies) if (ds_is_empty (&input)) ds_put_byte (&input, '\n'); ds_put_byte (&input, '\0'); - input_len = ds_length (&input); n_values = count_values (dummies); outputs = xmalloc (n_values * sizeof *outputs); diff --git a/src/language/expressions/evaluate.c b/src/language/expressions/evaluate.c index 84236b8c9f..afb742ffea 100644 --- a/src/language/expressions/evaluate.c +++ b/src/language/expressions/evaluate.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006, 2007, 2009, 2010, 2011 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 2007, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -132,7 +132,6 @@ cmd_debug_evaluate (struct lexer *lexer, struct dataset *dsother UNUSED) else if (lex_match (lexer, T_LPAREN)) { struct variable *v; - size_t old_value_cnt; int width; if (!lex_force_id (lexer)) @@ -159,7 +158,6 @@ cmd_debug_evaluate (struct lexer *lexer, struct dataset *dsother UNUSED) d = dataset_dict (ds); } - old_value_cnt = dict_get_next_value_idx (d); v = dict_create_var (d, name, width); if (v == NULL) { diff --git a/src/language/stats/factor.c b/src/language/stats/factor.c index 89c1e2f58a..f393326843 100644 --- a/src/language/stats/factor.c +++ b/src/language/stats/factor.c @@ -813,7 +813,6 @@ static bool run_factor (struct dataset *ds, const struct cmd_factor *factor); int cmd_factor (struct lexer *lexer, struct dataset *ds) { - bool extraction_seen = false; const struct dictionary *dict = dataset_dict (ds); struct cmd_factor factor; @@ -998,7 +997,6 @@ cmd_factor (struct lexer *lexer, struct dataset *ds) } else if (lex_match_id (lexer, "EXTRACTION")) { - extraction_seen = true; lex_match (lexer, T_EQUALS); while (lex_token (lexer) != T_ENDCMD && lex_token (lexer) != T_SLASH) { diff --git a/src/language/stats/quick-cluster.c b/src/language/stats/quick-cluster.c index e6987f4b10..bc66cce795 100644 --- a/src/language/stats/quick-cluster.c +++ b/src/language/stats/quick-cluster.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2011 Free Software Foundation, Inc. + Copyright (C) 2011, 2012 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -390,11 +390,10 @@ static void quick_cluster_show_centers (struct Kmeans *kmeans, bool initial, const struct qc *qc) { struct tab_table *t; - int nc, nr, heading_columns, currow; + int nc, nr, currow; int i, j; nc = qc->ngroups + 1; nr = qc->n_vars + 4; - heading_columns = 1; t = tab_create (nc, nr); tab_headers (t, 0, nc - 1, 0, 1); currow = 0; diff --git a/src/libpspp/range-tower.c b/src/libpspp/range-tower.c index 9d9f8aaa84..a6548e42c1 100644 --- a/src/libpspp/range-tower.c +++ b/src/libpspp/range-tower.c @@ -1,5 +1,5 @@ /* pspp - a program for statistical analysis. - Copyright (C) 2007, 2009, 2011 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2011, 2012 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -741,7 +741,6 @@ range_tower_move (struct range_tower *rt, unsigned long int width) { unsigned long int node_start; - int i; if (width == 0 || old_start == new_start) return; @@ -749,7 +748,6 @@ range_tower_move (struct range_tower *rt, assert (old_start + width - 1 >= old_start); assert (new_start + width - 1 >= new_start); - i = 0; do { struct range_tower_node *node; diff --git a/src/output/cairo.c b/src/output/cairo.c index da5740464e..b786733448 100644 --- a/src/output/cairo.c +++ b/src/output/cairo.c @@ -386,14 +386,12 @@ xr_create (const char *file_name, enum settings_output_devices device_type, struct string_map *o, enum xr_output_type file_type) { enum { MIN_WIDTH = 3, MIN_LENGTH = 3 }; - struct output_driver *d; struct xr_driver *xr; cairo_surface_t *surface; cairo_status_t status; double width_pt, length_pt; xr = xr_allocate (file_name, device_type, o); - d = &xr->driver; width_pt = (xr->width + xr->left_margin + xr->right_margin) / 1000.0; length_pt = (xr->length + xr->top_margin + xr->bottom_margin) / 1000.0; diff --git a/src/ui/gui/customentry.c b/src/ui/gui/customentry.c index b7d0ce2d27..dc5848ec08 100644 --- a/src/ui/gui/customentry.c +++ b/src/ui/gui/customentry.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2005, 2007, 2010, 2011 Free Software Foundation + Copyright (C) 2005, 2007, 2010, 2011, 2012 Free Software Foundation This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -304,12 +304,10 @@ psppire_custom_entry_class_init (PsppireCustomEntryClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class; - GtkEntryClass *entry_class; parent_class = g_type_class_peek_parent (klass); widget_class = (GtkWidgetClass*) klass; - entry_class = (GtkEntryClass*) klass; widget_class->map = psppire_custom_entry_map; widget_class->unmap = psppire_custom_entry_unmap; diff --git a/src/ui/gui/pspp-sheet-view.c b/src/ui/gui/pspp-sheet-view.c index eb7654fab9..c4eec5637c 100644 --- a/src/ui/gui/pspp-sheet-view.c +++ b/src/ui/gui/pspp-sheet-view.c @@ -2303,7 +2303,6 @@ pspp_sheet_view_button_press (GtkWidget *widget, PsppSheetViewColumn *column = NULL; GtkCellRenderer *focus_cell = NULL; gboolean row_double_click = FALSE; - gboolean node_selected; /* Empty tree? */ if (tree_view->priv->row_count == 0) @@ -2325,7 +2324,6 @@ pspp_sheet_view_button_press (GtkWidget *widget, return TRUE; /* select */ - node_selected = pspp_sheet_view_node_is_selected (tree_view, node); pre_val = tree_view->priv->vadjustment->value; path = _pspp_sheet_view_find_path (tree_view, node); @@ -2391,7 +2389,6 @@ pspp_sheet_view_button_press (GtkWidget *widget, tree_view->priv->press_start_node = node; if (tree_view->priv->rubber_banding_enable - //&& !node_selected && (tree_view->priv->selection->type == PSPP_SHEET_SELECTION_MULTIPLE || tree_view->priv->selection->type == PSPP_SHEET_SELECTION_RECTANGLE)) { @@ -3753,7 +3750,6 @@ pspp_sheet_view_bin_expose (GtkWidget *widget, gint new_y; gint y_offset, cell_offset; gint max_height; - gint depth; GdkRectangle background_area; GdkRectangle cell_area; guint flags; @@ -3826,7 +3822,6 @@ pspp_sheet_view_bin_expose (GtkWidget *widget, gtk_tree_model_get_iter (tree_view->priv->model, &iter, path); - depth = gtk_tree_path_get_depth (path); gtk_tree_path_free (path); cursor_path = NULL; @@ -5003,7 +4998,6 @@ validate_row (PsppSheetView *tree_view, gint horizontal_separator; gint vertical_separator; gint focus_line_width; - gboolean retval = FALSE; gboolean draw_vgrid_lines, draw_hgrid_lines; gint focus_pad; gint grid_line_width; @@ -5066,10 +5060,7 @@ validate_row (PsppSheetView *tree_view, } if (tmp_width > column->requested_width) - { - retval = TRUE; - column->requested_width = tmp_width; - } + column->requested_width = tmp_width; } if (draw_hgrid_lines) @@ -8782,7 +8773,6 @@ pspp_sheet_view_set_model (PsppSheetView *tree_view, if (tree_view->priv->model) { gint i; - GtkTreeModelFlags flags; if (tree_view->priv->search_column == -1) { @@ -8816,8 +8806,6 @@ pspp_sheet_view_set_model (PsppSheetView *tree_view, G_CALLBACK (pspp_sheet_view_rows_reordered), tree_view); - flags = gtk_tree_model_get_flags (tree_view->priv->model); - tree_view->priv->row_count = gtk_tree_model_iter_n_children (tree_view->priv->model, NULL); /* FIXME: do I need to do this? pspp_sheet_view_create_buttons (tree_view); */ @@ -11021,7 +11009,6 @@ pspp_sheet_view_create_row_drag_icon (PsppSheetView *tree_view, GdkRectangle background_area; GdkRectangle expose_area; GtkWidget *widget; - gint depth; /* start drawing inside the black outline */ gint x = 1, y = 1; GdkDrawable *drawable; @@ -11036,8 +11023,6 @@ pspp_sheet_view_create_row_drag_icon (PsppSheetView *tree_view, if (!gtk_widget_get_realized (widget)) return NULL; - depth = gtk_tree_path_get_depth (path); - _pspp_sheet_view_find_node (tree_view, path, &node); @@ -12407,12 +12392,10 @@ pspp_sheet_view_set_special_cells (PsppSheetView *tree_view, PsppSheetViewSpecialCells special_cells) { PsppSheetViewPrivate *priv; - GtkWidget *widget; g_return_if_fail (PSPP_IS_SHEET_VIEW (tree_view)); priv = tree_view->priv; - widget = GTK_WIDGET (tree_view); if (priv->special_cells != special_cells) { diff --git a/src/ui/gui/psppire-dialog-action-rank.c b/src/ui/gui/psppire-dialog-action-rank.c index bbf30a61ce..f4d59b7be2 100644 --- a/src/ui/gui/psppire-dialog-action-rank.c +++ b/src/ui/gui/psppire-dialog-action-rank.c @@ -169,14 +169,12 @@ run_types_dialog (GtkButton *b, PsppireDialogActionRank *dar) { PsppireDialogAction *act = PSPPIRE_DIALOG_ACTION (dar); - gint response; - gtk_window_set_transient_for (GTK_WINDOW (dar->types_dialog), GTK_WINDOW (act->dialog)); types_dialog_reset (dar); - response = psppire_dialog_run (PSPPIRE_DIALOG (dar->types_dialog)); + psppire_dialog_run (PSPPIRE_DIALOG (dar->types_dialog)); } static void @@ -184,12 +182,10 @@ run_ties_dialog (GtkButton *b, PsppireDialogActionRank *dar) { PsppireDialogAction *act = PSPPIRE_DIALOG_ACTION (dar); - gint response; - gtk_window_set_transient_for (GTK_WINDOW (dar->ties_dialog), GTK_WINDOW (act->dialog)); - response = psppire_dialog_run (PSPPIRE_DIALOG (dar->ties_dialog)); + psppire_dialog_run (PSPPIRE_DIALOG (dar->ties_dialog)); } static void diff --git a/src/ui/gui/psppire-dialog.c b/src/ui/gui/psppire-dialog.c index 547ff2a4da..ee44512f64 100644 --- a/src/ui/gui/psppire-dialog.c +++ b/src/ui/gui/psppire-dialog.c @@ -89,13 +89,9 @@ static GObjectClass *parent_class = NULL; static void psppire_dialog_finalize (GObject *object) { - PsppireDialog *dialog ; - g_return_if_fail (object != NULL); g_return_if_fail (PSPPIRE_IS_DIALOG (object)); - dialog = PSPPIRE_DIALOG (object); - if (G_OBJECT_CLASS (parent_class)->finalize) G_OBJECT_CLASS (parent_class)->finalize (object); } diff --git a/src/ui/gui/psppire-dictview.c b/src/ui/gui/psppire-dictview.c index 023be7d0cc..5554eb0ade 100644 --- a/src/ui/gui/psppire-dictview.c +++ b/src/ui/gui/psppire-dictview.c @@ -305,12 +305,9 @@ var_description_cell_data_func (GtkTreeViewColumn *col, struct variable *var; GtkTreeIter iter; GtkTreeModel *model; - PsppireDict *dict; dv_get_base_model (top_model, top_iter, &model, &iter); - dict = PSPPIRE_DICT (model); - gtk_tree_model_get (model, &iter, DICT_TVM_COL_VAR, &var, -1); @@ -414,10 +411,8 @@ set_tooltip_for_variable (GtkTreeView *treeview, { const gchar *tip ; GtkTreeModel *m; - PsppireDict *dict; dv_get_base_model (tree_model, NULL, &m, NULL); - dict = PSPPIRE_DICT (m); if ( PSPPIRE_DICT_VIEW (treeview)->prefer_labels ) tip = var_get_name (var); diff --git a/src/ui/gui/psppire-syntax-window.c b/src/ui/gui/psppire-syntax-window.c index c68ad44553..0c05fdc58e 100644 --- a/src/ui/gui/psppire-syntax-window.c +++ b/src/ui/gui/psppire-syntax-window.c @@ -376,7 +376,6 @@ contents_received_callback (GtkClipboard *clipboard, GtkSelectionData *sd, gpointer data) { - gchar *c; PsppireSyntaxWindow *syntax_window = data; if ( sd->length < 0 ) @@ -385,8 +384,6 @@ contents_received_callback (GtkClipboard *clipboard, if ( sd->type != gdk_atom_intern ("UTF8_STRING", FALSE)) return; - c = (gchar *) sd->data; - gtk_text_buffer_insert_at_cursor (GTK_TEXT_BUFFER (syntax_window->buffer), (gchar *) sd->data, sd->length); diff --git a/tests/libpspp/heap-test.c b/tests/libpspp/heap-test.c index d042ab5c38..639bf94002 100644 --- a/tests/libpspp/heap-test.c +++ b/tests/libpspp/heap-test.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2007, 2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2010, 2012 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -524,11 +524,7 @@ test_inc_dec (void) delete[i] = insert[i]; for (i = 0; i < cnt; i++) { - int old_value, old_min, new_min; - old_min = min_int (delete, cnt); - old_value = delete[i]; elements[i].x = delete[i] = rand () % (cnt + 2) - 1; - new_min = min_int (delete, cnt); heap_changed (h, &elements[i].node); check (heap_node_to_element (heap_minimum (h))->x == min_int (delete, cnt)); @@ -595,7 +591,6 @@ test_random_insert_delete (void) if (action == INSERT) { int new_value; - int old_min; new_value = rand () % max_elems; values[cnt] = new_value; @@ -603,20 +598,13 @@ test_random_insert_delete (void) heap_insert (h, &elements[cnt].node); - old_min = min_int (values, cnt); - cnt++; } else if (action == DELETE) { int del_idx; - int del_value; - int old_min, new_min; - - old_min = min_int (values, cnt); del_idx = rand () % cnt; - del_value = values[del_idx]; heap_delete (h, &elements[del_idx].node); cnt--; @@ -626,8 +614,6 @@ test_random_insert_delete (void) elements[del_idx] = elements[cnt]; heap_moved (h, &elements[del_idx].node); } - - new_min = min_int (values, cnt); } else abort (); -- 2.30.2