From 0f02236ebe751f32609b64b1a67fdad1ab4aa5e5 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Sun, 1 Aug 2021 10:27:50 -0700 Subject: [PATCH] Fix gcc warnings. --- gnucash/gnome-utils/dialog-options.cpp | 5 +- libgnucash/app-utils/gnc-optiondb.i | 122 +++++++++++++------------ 2 files changed, 66 insertions(+), 61 deletions(-) diff --git a/gnucash/gnome-utils/dialog-options.cpp b/gnucash/gnome-utils/dialog-options.cpp index 7e2720679b..975b13543f 100644 --- a/gnucash/gnome-utils/dialog-options.cpp +++ b/gnucash/gnome-utils/dialog-options.cpp @@ -150,7 +150,7 @@ GncOptionUIFactory::create(GncOption& option, GtkGrid* page, GtkLabel* name, auto func{s_registry[static_cast(type)]}; if (func) return func(option, page, name, description, enclosing, packed); - PERR("No function registered for type %d", type); + PERR("No function registered for type %d", static_cast(type)); return nullptr; } @@ -1506,7 +1506,8 @@ create_date_option_widget(GncOption& option, GtkGrid *page_box, option.set_ui_item(std::make_unique(std::make_unique(option), type)); break; default: - PERR("Attempted to create date option widget with wrong UI type %d", type); + PERR("Attempted to create date option widget with wrong UI type %d", + static_cast(type)); return nullptr; break; } diff --git a/libgnucash/app-utils/gnc-optiondb.i b/libgnucash/app-utils/gnc-optiondb.i index 31b5acdda6..f081157b8a 100644 --- a/libgnucash/app-utils/gnc-optiondb.i +++ b/libgnucash/app-utils/gnc-optiondb.i @@ -760,7 +760,8 @@ wrap_unique_ptr(GncOptionDBPtr, GncOptionDB); return scm_reverse(values); } - SCM get_scm_value(const GncOptionMultichoiceValue& option) + static SCM + get_scm_value(const GncOptionMultichoiceValue& option) { auto indexes = option.get_multiple(); @@ -771,7 +772,8 @@ wrap_unique_ptr(GncOptionDBPtr, GncOptionDB); return scm_from_multichoices(indexes, option); } - SCM get_scm_default_value(const GncOptionMultichoiceValue& option) + static SCM + get_scm_default_value(const GncOptionMultichoiceValue& option) { auto indexes = option.get_default_multiple(); @@ -780,14 +782,16 @@ wrap_unique_ptr(GncOptionDBPtr, GncOptionDB); return scm_from_multichoices(indexes, option); } - SCM get_scm_value(const GncOptionRangeValue& option) + static SCM + get_scm_value(const GncOptionRangeValue& option) { auto val{option.get_value()}; auto desig{scm_c_eval_string(val > 100 ? "'pixels" : "'percent")}; return scm_cons(desig, scm_from_int(val)); } - SCM get_scm_default_value(const GncOptionRangeValue& option) + static SCM + get_scm_default_value(const GncOptionRangeValue& option) { auto val{option.get_default_value()}; auto desig{scm_c_eval_string(val > 100 ? "'pixels" : "'percent")}; @@ -945,10 +949,11 @@ wrap_unique_ptr(GncOptionDBPtr, GncOptionDB); %template(gnc_register_number_range_option_int) gnc_register_number_range_option; %inline %{ - GncOption* gnc_make_account_list_option(const char* section, - const char* name, const char* key, - const char* doc_string, - const GncOptionAccountList& value) + static GncOption* + gnc_make_account_list_option(const char* section, + const char* name, const char* key, + const char* doc_string, + const GncOptionAccountList& value) { try { return new GncOption{GncOptionAccountListValue{section, name, key, @@ -961,12 +966,13 @@ wrap_unique_ptr(GncOptionDBPtr, GncOptionDB); } } - GncOption* gnc_make_account_list_limited_option(const char* section, - const char* name, - const char* key, - const char* doc_string, - const GncOptionAccountList& value, - GncOptionAccountTypeList&& allowed) + static GncOption* + gnc_make_account_list_limited_option(const char* section, + const char* name, + const char* key, + const char* doc_string, + const GncOptionAccountList& value, + GncOptionAccountTypeList&& allowed) { try { @@ -981,12 +987,11 @@ wrap_unique_ptr(GncOptionDBPtr, GncOptionDB); } } - GncOption* gnc_make_account_sel_limited_option(const char* section, - const char* name, - const char* key, - const char* doc_string, - const Account* value, - GncOptionAccountTypeList&& allowed) + static GncOption* + gnc_make_account_sel_limited_option(const char* section, const char* name, + const char* key, const char* doc_string, + const Account* value, + GncOptionAccountTypeList&& allowed) { try { @@ -1001,12 +1006,10 @@ wrap_unique_ptr(GncOptionDBPtr, GncOptionDB); } } - GncOption* gnc_make_date_option(const char* section, - const char* name, const char* key, - const char* doc_string, - const SCM default_val, - RelativeDatePeriodVec& period_set, - bool both) + static GncOption* + gnc_make_date_option(const char* section, const char* name, const char* key, + const char* doc_string, const SCM default_val, + RelativeDatePeriodVec& period_set, bool both) { try { @@ -1046,11 +1049,11 @@ wrap_unique_ptr(GncOptionDBPtr, GncOptionDB); } } - GncOption* gnc_make_multichoice_option(const char* section, - const char* name, const char* key, - const char* doc_string, - const char* default_val, - GncMultichoiceOptionChoices&& choices) + static GncOption* + gnc_make_multichoice_option(const char* section, const char* name, + const char* key, const char* doc_string, + const char* default_val, + GncMultichoiceOptionChoices&& choices) { try { std::string defval{default_val}; @@ -1072,11 +1075,11 @@ wrap_unique_ptr(GncOptionDBPtr, GncOptionDB); } } - GncOption* gnc_make_list_option(const char* section, - const char* name, const char* key, - const char* doc_string, - GncMultichoiceOptionIndexVec indexes, - GncMultichoiceOptionChoices&& list) + static GncOption* + gnc_make_list_option(const char* section, const char* name, const char* key, + const char* doc_string, + GncMultichoiceOptionIndexVec indexes, + GncMultichoiceOptionChoices&& list) { try { return new GncOption{GncOptionMultichoiceValue{section, name, key, @@ -1090,10 +1093,11 @@ wrap_unique_ptr(GncOptionDBPtr, GncOptionDB); } } - GncOption* gnc_make_range_value_option(const char* section, - const char* name, const char* key, - const char* doc_string, double value, - double min, double max, double step) + static GncOption* + gnc_make_range_value_option(const char* section, const char* name, + const char* key, const char* doc_string, + double value, double min, double max, + double step) { try { @@ -1108,10 +1112,10 @@ wrap_unique_ptr(GncOptionDBPtr, GncOptionDB); } } - GncOption* gnc_make_plot_size_option(const char* section, - const char* name, const char* key, - const char* doc_string, int value, - int min, int max, int step) + static GncOption* + gnc_make_plot_size_option(const char* section, const char* name, + const char* key, const char* doc_string, + int value, int min, int max, int step) { try { @@ -1126,19 +1130,19 @@ wrap_unique_ptr(GncOptionDBPtr, GncOptionDB); } } - GncOption* gnc_make_commodity_option(const char* section, - const char* name, const char* key, - const char* doc_string, - gnc_commodity *value) + static GncOption* + gnc_make_commodity_option(const char* section, const char* name, + const char* key, const char* doc_string, + gnc_commodity *value) { return new GncOption{GncOptionValue{ section, name, key, doc_string, (const QofInstance*)value}}; } - GncOption* gnc_make_commodity_option(const char* section, - const char* name, const char* key, - const char* doc_string, - const char *value) + static GncOption* + gnc_make_commodity_option(const char* section, const char* name, + const char* key, const char* doc_string, + const char *value) { gnc_commodity* commodity{}; const auto book{qof_session_get_book(gnc_get_current_session())}; @@ -1156,10 +1160,10 @@ wrap_unique_ptr(GncOptionDBPtr, GncOptionDB); return nullptr; } - GncOption* gnc_make_currency_option(const char* section, - const char* name, const char* key, - const char* doc_string, - gnc_commodity *value) + static GncOption* + gnc_make_currency_option(const char* section, const char* name, + const char* key, const char* doc_string, + gnc_commodity *value) { try { @@ -1254,7 +1258,7 @@ wrap_unique_ptr(GncOptionDBPtr, GncOptionDB); return optiondb->find_option(section, name); } - void + static void gnc_option_db_set_option_selectable_by_name(GncOptionDBPtr& odb, const char* section, const char* name, @@ -1264,7 +1268,7 @@ wrap_unique_ptr(GncOptionDBPtr, GncOptionDB); option->set_ui_item_selectable(selectable); } - void + static void gnc_optiondb_foreach(GncOptionDBPtr& odb, SCM thunk) { odb->foreach_section( @@ -1281,7 +1285,7 @@ wrap_unique_ptr(GncOptionDBPtr, GncOptionDB); }); } - std::string + static std::string gnc_optiondb_save_to_scheme(GncOptionDBPtr& odb, const char* prolog) { std::ostringstream oss;