[gcalctool] Enable maximum warnings and fix warnings



commit 26cfd3860e4e989ba1d6ef14b53ab618d3fee2ae
Author: Robert Ancell <robert ancell gmail com>
Date:   Fri Jul 2 10:07:23 2010 +1000

    Enable maximum warnings and fix warnings

 configure.ac             |    2 +-
 src/Makefile.am          |    3 ++-
 src/currency.h           |    2 +-
 src/gcalccmd.c           |    2 +-
 src/gcalctool.c          |    2 +-
 src/math-buttons.c       |   28 ++++++++++++++++++++++++++--
 src/math-buttons.h       |    2 +-
 src/math-display.h       |    4 ++--
 src/math-equation.h      |    4 ++--
 src/math-preferences.c   |    6 ++++++
 src/math-preferences.h   |    2 +-
 src/math-variables.h     |    4 +++-
 src/math-window.h        |    2 +-
 src/mp-equation-parser.y |    2 +-
 src/mp.c                 |    2 +-
 src/mp.h                 |    4 ++--
 src/unittest.c           |    8 ++++----
 src/unittest.h           |    2 +-
 18 files changed, 57 insertions(+), 24 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 9b30bb0..97a7ef9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -13,7 +13,7 @@ AM_PROG_CC_STDC
 AC_HEADER_STDC
 
 GLIB_GSETTINGS
-GNOME_COMPILE_WARNINGS(yes)
+GNOME_COMPILE_WARNINGS(maximum)
 
 dnl ###########################################################################
 dnl Dependencies
diff --git a/src/Makefile.am b/src/Makefile.am
index 4255bd7..32188dd 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,7 +4,8 @@ INCLUDES = \
 	-DUI_DIR=\""$(datadir)/gcalctool"\" \
 	-DVERSION=\""$(VERSION)"\" \
 	-DLOCALE_DIR=\""$(localedir)"\" \
-    -DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" \
+	-DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" \
+	$(WARN_CFLAGS) \
 	$(GCALCTOOL_CFLAGS)
 
 gcalctool_SOURCES = \
diff --git a/src/currency.h b/src/currency.h
index 1ea08c5..02cbfd8 100644
--- a/src/currency.h
+++ b/src/currency.h
@@ -62,6 +62,6 @@ gboolean currency_convert(const MPNumber *from_amount,
                           MPNumber *to_amount);
 
 /* Frees up all allocated resources */
-void currency_free_resources();
+void currency_free_resources(void);
 
 #endif /* CURRENCY_H */
diff --git a/src/gcalccmd.c b/src/gcalccmd.c
index 88a9dc6..9af9a58 100644
--- a/src/gcalccmd.c
+++ b/src/gcalccmd.c
@@ -55,7 +55,7 @@ solve(const char *equation)
 
 
 /* Adjust user input equation string before solving it. */
-void
+static void
 str_adjust(char *str)
 {
     int i, j = 0;
diff --git a/src/gcalctool.c b/src/gcalctool.c
index 8eeb285..9eaa77e 100644
--- a/src/gcalctool.c
+++ b/src/gcalctool.c
@@ -115,7 +115,7 @@ usage(const gchar *progname, gboolean show_application, gboolean show_gtk)
 }
 
 
-void
+static void
 get_options(int argc, char *argv[])
 {
     int i;
diff --git a/src/math-buttons.c b/src/math-buttons.c
index 0ea8a36..3351ae6 100644
--- a/src/math-buttons.c
+++ b/src/math-buttons.c
@@ -527,7 +527,6 @@ static void
 update_currency_label(MathButtons *buttons)
 {
     MPNumber x, value;
-    int source_index, target_index;
     char *label;
 
     if (!buttons->priv->currency_label)
@@ -557,7 +556,7 @@ update_currency_label(MathButtons *buttons)
                                 target_symbol, output_text);
     }
     else
-        label = g_strdup_printf("");
+        label = g_strdup("");
 
     gtk_label_set_text(GTK_LABEL(buttons->priv->currency_label), label);
     g_free(label);
@@ -1076,6 +1075,7 @@ math_buttons_get_programming_base(MathButtons *buttons)
 }
 
 
+void exponent_cb(GtkWidget *widget, MathButtons *buttons);
 G_MODULE_EXPORT
 void
 exponent_cb(GtkWidget *widget, MathButtons *buttons)
@@ -1084,6 +1084,7 @@ exponent_cb(GtkWidget *widget, MathButtons *buttons)
 }
 
 
+void subtract_cb(GtkWidget *widget, MathButtons *buttons);
 G_MODULE_EXPORT
 void
 subtract_cb(GtkWidget *widget, MathButtons *buttons)
@@ -1092,6 +1093,7 @@ subtract_cb(GtkWidget *widget, MathButtons *buttons)
 }
 
 
+void button_cb(GtkWidget *widget, MathButtons *buttons);
 G_MODULE_EXPORT
 void
 button_cb(GtkWidget *widget, MathButtons *buttons)
@@ -1100,6 +1102,7 @@ button_cb(GtkWidget *widget, MathButtons *buttons)
 }
 
 
+void solve_cb(GtkWidget *widget, MathButtons *buttons);
 G_MODULE_EXPORT
 void
 solve_cb(GtkWidget *widget, MathButtons *buttons)
@@ -1108,6 +1111,7 @@ solve_cb(GtkWidget *widget, MathButtons *buttons)
 }
 
 
+void clear_cb(GtkWidget *widget, MathButtons *buttons);
 G_MODULE_EXPORT
 void
 clear_cb(GtkWidget *widget, MathButtons *buttons)
@@ -1116,6 +1120,7 @@ clear_cb(GtkWidget *widget, MathButtons *buttons)
 }
 
 
+void delete_cb(GtkWidget *widget, MathButtons *buttons);
 G_MODULE_EXPORT
 void
 delete_cb(GtkWidget *widget, MathButtons *buttons)
@@ -1124,6 +1129,7 @@ delete_cb(GtkWidget *widget, MathButtons *buttons)
 }
 
 
+void undo_cb(GtkWidget *widget, MathButtons *buttons);
 G_MODULE_EXPORT
 void
 undo_cb(GtkWidget *widget, MathButtons *buttons)
@@ -1235,6 +1241,7 @@ store_menu_cb(GtkMenuItem *menu, MathButtons *buttons)
 }
 
 
+void store_cb(GtkWidget *widget, MathButtons *buttons);
 G_MODULE_EXPORT
 void
 store_cb(GtkWidget *widget, MathButtons *buttons)
@@ -1280,6 +1287,7 @@ recall_menu_cb(GtkMenuItem *menu, MathButtons *buttons)
 }
 
 
+void recall_cb(GtkWidget *widget, MathButtons *buttons);
 G_MODULE_EXPORT
 void
 recall_cb(GtkWidget *widget, MathButtons *buttons)
@@ -1320,6 +1328,7 @@ recall_cb(GtkWidget *widget, MathButtons *buttons)
 }
 
 
+void shift_left_cb(GtkWidget *widget, MathButtons *buttons);
 G_MODULE_EXPORT
 void
 shift_left_cb(GtkWidget *widget, MathButtons *buttons)
@@ -1363,6 +1372,7 @@ shift_left_cb(GtkWidget *widget, MathButtons *buttons)
 }
 
 
+void shift_right_cb(GtkWidget *widget, MathButtons *buttons);
 G_MODULE_EXPORT
 void
 shift_right_cb(GtkWidget *widget, MathButtons *buttons)
@@ -1413,6 +1423,7 @@ insert_function_cb(GtkWidget *widget, MathButtons *buttons)
 }
 
 
+void function_cb(GtkWidget *widget, MathButtons *buttons);
 G_MODULE_EXPORT
 void
 function_cb(GtkWidget *widget, MathButtons *buttons)
@@ -1459,6 +1470,7 @@ function_cb(GtkWidget *widget, MathButtons *buttons)
 }
 
 
+void factorize_cb(GtkWidget *widget, MathButtons *buttons);
 G_MODULE_EXPORT
 void
 factorize_cb(GtkWidget *widget, MathButtons *buttons)
@@ -1467,6 +1479,7 @@ factorize_cb(GtkWidget *widget, MathButtons *buttons)
 }
 
 
+void digit_cb(GtkWidget *widget, MathButtons *buttons);
 G_MODULE_EXPORT
 void
 digit_cb(GtkWidget *widget, MathButtons *buttons)
@@ -1475,6 +1488,7 @@ digit_cb(GtkWidget *widget, MathButtons *buttons)
 }
 
 
+void numeric_point_cb(GtkWidget *widget, MathButtons *buttons);
 G_MODULE_EXPORT
 void
 numeric_point_cb(GtkWidget *widget, MathButtons *buttons)
@@ -1484,6 +1498,7 @@ numeric_point_cb(GtkWidget *widget, MathButtons *buttons)
 
 
 
+void finc_cb(GtkWidget *widget, MathButtons *buttons);
 G_MODULE_EXPORT
 void
 finc_cb(GtkWidget *widget, MathButtons *buttons)
@@ -1496,6 +1511,7 @@ finc_cb(GtkWidget *widget, MathButtons *buttons)
 }
 
 
+void insert_character_code_cb(GtkWidget *widget, MathButtons *buttons);
 G_MODULE_EXPORT
 void
 insert_character_code_cb(GtkWidget *widget, MathButtons *buttons)
@@ -1504,6 +1520,7 @@ insert_character_code_cb(GtkWidget *widget, MathButtons *buttons)
 }
 
 
+void finc_activate_cb(GtkWidget *widget, MathButtons *buttons);
 G_MODULE_EXPORT
 void
 finc_activate_cb(GtkWidget *widget, MathButtons *buttons)
@@ -1530,6 +1547,7 @@ finc_activate_cb(GtkWidget *widget, MathButtons *buttons)
 }
 
 
+void finc_response_cb(GtkWidget *widget, gint response_id, MathButtons *buttons);
 G_MODULE_EXPORT
 void
 finc_response_cb(GtkWidget *widget, gint response_id, MathButtons *buttons)
@@ -1558,6 +1576,7 @@ finc_response_cb(GtkWidget *widget, gint response_id, MathButtons *buttons)
 }
 
 
+void character_code_dialog_response_cb(GtkWidget *dialog, gint response_id, MathButtons *buttons);
 G_MODULE_EXPORT
 void
 character_code_dialog_response_cb(GtkWidget *dialog, gint response_id, MathButtons *buttons)
@@ -1588,6 +1607,7 @@ character_code_dialog_response_cb(GtkWidget *dialog, gint response_id, MathButto
 }
 
 
+void character_code_dialog_activate_cb(GtkWidget *entry, MathButtons *buttons);
 G_MODULE_EXPORT
 void
 character_code_dialog_activate_cb(GtkWidget *entry, MathButtons *buttons)
@@ -1596,6 +1616,7 @@ character_code_dialog_activate_cb(GtkWidget *entry, MathButtons *buttons)
 }
 
 
+gboolean character_code_dialog_delete_cb(GtkWidget *dialog, GdkEvent *event, MathButtons *buttons);
 G_MODULE_EXPORT
 gboolean
 character_code_dialog_delete_cb(GtkWidget *dialog, GdkEvent *event, MathButtons *buttons)
@@ -1605,6 +1626,7 @@ character_code_dialog_delete_cb(GtkWidget *dialog, GdkEvent *event, MathButtons
 }
 
 
+gboolean bit_toggle_cb(GtkWidget *event_box, GdkEventButton *event, MathButtons *buttons);
 G_MODULE_EXPORT
 gboolean
 bit_toggle_cb(GtkWidget *event_box, GdkEventButton *event, MathButtons *buttons)
@@ -1615,6 +1637,7 @@ bit_toggle_cb(GtkWidget *event_box, GdkEventButton *event, MathButtons *buttons)
 
 
 
+void set_superscript_cb(GtkWidget *widget, MathButtons *buttons);
 G_MODULE_EXPORT
 void
 set_superscript_cb(GtkWidget *widget, MathButtons *buttons)
@@ -1626,6 +1649,7 @@ set_superscript_cb(GtkWidget *widget, MathButtons *buttons)
 }
 
 
+void set_subscript_cb(GtkWidget *widget, MathButtons *buttons);
 G_MODULE_EXPORT
 void
 set_subscript_cb(GtkWidget *widget, MathButtons *buttons)
diff --git a/src/math-buttons.h b/src/math-buttons.h
index a7f7c08..7e85e33 100644
--- a/src/math-buttons.h
+++ b/src/math-buttons.h
@@ -47,7 +47,7 @@ typedef enum {
     PROGRAMMING
 } ButtonMode;
 
-GType math_buttons_get_type();
+GType math_buttons_get_type(void);
 
 MathButtons *math_buttons_new(MathEquation *equation);
 
diff --git a/src/math-display.h b/src/math-display.h
index 67e2aba..0a0b9fc 100644
--- a/src/math-display.h
+++ b/src/math-display.h
@@ -41,8 +41,8 @@ typedef struct
     GtkVBoxClass parent_class;
 } MathDisplayClass;
 
-GType math_display_get_type();
-MathDisplay *math_display_new();
+GType math_display_get_type(void);
+MathDisplay *math_display_new(void);
 MathDisplay *math_display_new_with_equation(MathEquation *equation);
 MathEquation *math_display_get_equation(MathDisplay *display);
 
diff --git a/src/math-equation.h b/src/math-equation.h
index c903922..e1c5f45 100644
--- a/src/math-equation.h
+++ b/src/math-equation.h
@@ -55,8 +55,8 @@ typedef enum {
     SUBSCRIPT
 } NumberMode;
 
-GType math_equation_get_type();
-MathEquation *math_equation_new();
+GType math_equation_get_type(void);
+MathEquation *math_equation_new(void);
 
 MathVariables *math_equation_get_variables(MathEquation *equation);
 
diff --git a/src/math-preferences.c b/src/math-preferences.c
index 4441ffc..c846523 100644
--- a/src/math-preferences.c
+++ b/src/math-preferences.c
@@ -61,6 +61,7 @@ preferences_dialog_delete_cb(GtkWidget *widget, GdkEvent *event)
 }
 
 
+void number_format_combobox_changed_cb(GtkWidget *combo, MathPreferencesDialog *dialog);
 G_MODULE_EXPORT
 void
 number_format_combobox_changed_cb(GtkWidget *combo, MathPreferencesDialog *dialog)
@@ -76,6 +77,7 @@ number_format_combobox_changed_cb(GtkWidget *combo, MathPreferencesDialog *dialo
 }
 
 
+void angle_unit_combobox_changed_cb(GtkWidget *combo, MathPreferencesDialog *dialog);
 G_MODULE_EXPORT
 void
 angle_unit_combobox_changed_cb(GtkWidget *combo, MathPreferencesDialog *dialog)
@@ -91,6 +93,7 @@ angle_unit_combobox_changed_cb(GtkWidget *combo, MathPreferencesDialog *dialog)
 }
 
 
+void word_size_combobox_changed_cb(GtkWidget *combo, MathPreferencesDialog *dialog);
 G_MODULE_EXPORT
 void
 word_size_combobox_changed_cb(GtkWidget *combo, MathPreferencesDialog *dialog)
@@ -106,6 +109,7 @@ word_size_combobox_changed_cb(GtkWidget *combo, MathPreferencesDialog *dialog)
 }
 
 
+void decimal_places_spin_change_value_cb(GtkWidget *spin, MathPreferencesDialog *dialog);
 G_MODULE_EXPORT
 void
 decimal_places_spin_change_value_cb(GtkWidget *spin, MathPreferencesDialog *dialog)
@@ -117,6 +121,7 @@ decimal_places_spin_change_value_cb(GtkWidget *spin, MathPreferencesDialog *dial
 }
 
 
+void thousands_separator_check_toggled_cb(GtkWidget *check, MathPreferencesDialog *dialog);
 G_MODULE_EXPORT
 void
 thousands_separator_check_toggled_cb(GtkWidget *check, MathPreferencesDialog *dialog)
@@ -128,6 +133,7 @@ thousands_separator_check_toggled_cb(GtkWidget *check, MathPreferencesDialog *di
 }
 
 
+void trailing_zeroes_check_toggled_cb(GtkWidget *check, MathPreferencesDialog *dialog);
 G_MODULE_EXPORT
 void
 trailing_zeroes_check_toggled_cb(GtkWidget *check, MathPreferencesDialog *dialog)
diff --git a/src/math-preferences.h b/src/math-preferences.h
index e4cd5d4..487a68e 100644
--- a/src/math-preferences.h
+++ b/src/math-preferences.h
@@ -40,7 +40,7 @@ typedef struct
     GtkDialogClass parent_class;
 } MathPreferencesDialogClass;
 
-GType math_preferences_get_type();
+GType math_preferences_get_type(void);
 
 MathPreferencesDialog *math_preferences_dialog_new(MathEquation *equation);
 
diff --git a/src/math-variables.h b/src/math-variables.h
index 9e16fa5..b2317b0 100644
--- a/src/math-variables.h
+++ b/src/math-variables.h
@@ -39,7 +39,9 @@ typedef struct
     GObjectClass parent_class;
 } MathVariablesClass;
 
-MathVariables *math_variables_new();
+GType math_variables_get_type(void);
+
+MathVariables *math_variables_new(void);
 
 gchar **math_variables_get_names(MathVariables *variables);
 
diff --git a/src/math-window.h b/src/math-window.h
index d272e4f..70c81bd 100644
--- a/src/math-window.h
+++ b/src/math-window.h
@@ -44,7 +44,7 @@ typedef struct
     void (*quit)(MathWindow *window);
 } MathWindowClass;
 
-GType math_window_get_type();
+GType math_window_get_type(void);
 
 MathWindow *math_window_new(MathEquation *equation);
 
diff --git a/src/mp-equation-parser.y b/src/mp-equation-parser.y
index ab2c66a..064f90f 100644
--- a/src/mp-equation-parser.y
+++ b/src/mp-equation-parser.y
@@ -44,7 +44,7 @@ static void set_result(yyscan_t yyscanner, const MPNumber *x)
     mp_set_from_mp(x, &(_mp_equation_get_extra(yyscanner))->ret);
 }
 
-char *
+static char *
 utf8_next_char (const char *c)
 {
     c++;
diff --git a/src/mp.c b/src/mp.c
index 466c6cb..68043a2 100644
--- a/src/mp.c
+++ b/src/mp.c
@@ -1767,7 +1767,7 @@ mp_reciprocal(const MPNumber *x, MPNumber *z)
 }
 
 
-void
+static void
 mp_root_real(const MPNumber *x, int64_t n, MPNumber *z)
 {
     float approximation;
diff --git a/src/mp.h b/src/mp.h
index ee02201..d71111d 100644
--- a/src/mp.h
+++ b/src/mp.h
@@ -74,10 +74,10 @@ typedef enum
 
 /* Returns error string or NULL if no error */
 // FIXME: Global variable
-const char *mp_get_error();
+const char *mp_get_error(void);
 
 /* Clear any current error */
-void mp_clear_error();
+void mp_clear_error(void);
 
 /* Returns:
  *  0 if x == y
diff --git a/src/unittest.c b/src/unittest.c
index c0b391f..a322717 100644
--- a/src/unittest.c
+++ b/src/unittest.c
@@ -128,14 +128,14 @@ test_conversions()
 }
 
 
-int
+static int
 variable_is_defined(const char *name, void *data)
 {
     return strcmp (name, "x") == 0 || strcmp (name, "y") == 0;
 }
 
 
-int
+static int
 get_variable(const char *name, MPNumber *z, void *data)
 {
     if (strcmp (name, "x") == 0) {
@@ -150,12 +150,12 @@ get_variable(const char *name, MPNumber *z, void *data)
 }
 
 
-void
+static void
 set_variable(const char *name, const MPNumber *x, void *data)
 {
 }
 
-void
+static void
 test_equations()
 {
     memset(&options, 0, sizeof(options));
diff --git a/src/unittest.h b/src/unittest.h
index 394f7cd..7eee87d 100644
--- a/src/unittest.h
+++ b/src/unittest.h
@@ -19,6 +19,6 @@
 #ifndef UNITTEST_H
 #define UNITTEST_H
 
-void unittest();
+void unittest(void);
 
 #endif /* UNITTEST_H */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]