diff options
-rw-r--r-- | src/account.cc | 6 | ||||
-rw-r--r-- | src/amount.cc | 2 | ||||
-rw-r--r-- | src/draft.cc | 7 | ||||
-rw-r--r-- | src/filters.cc | 13 | ||||
-rw-r--r-- | src/format.cc | 2 | ||||
-rw-r--r-- | src/op.cc | 10 | ||||
-rw-r--r-- | src/op.h | 8 | ||||
-rw-r--r-- | src/pool.cc | 18 | ||||
-rw-r--r-- | src/pyinterp.cc | 1 | ||||
-rw-r--r-- | src/query.h | 1 | ||||
-rw-r--r-- | src/textual.cc | 10 | ||||
-rw-r--r-- | src/times.h | 2 | ||||
-rw-r--r-- | src/xact.cc | 2 |
13 files changed, 62 insertions, 20 deletions
diff --git a/src/account.cc b/src/account.cc index e1874839..29c05719 100644 --- a/src/account.cc +++ b/src/account.cc @@ -89,8 +89,10 @@ account_t * account_t::find_account(const string& acct_name, if (has_flags(ACCOUNT_GENERATED)) account->add_flags(ACCOUNT_GENERATED); - std::pair<accounts_map::iterator, bool> result - = accounts.insert(accounts_map::value_type(first, account)); +#if defined(DEBUG_ON) + std::pair<accounts_map::iterator, bool> result = +#endif + accounts.insert(accounts_map::value_type(first, account)); assert(result.second); } else { account = (*i).second; diff --git a/src/amount.cc b/src/amount.cc index f9e2309b..313f8d27 100644 --- a/src/amount.cc +++ b/src/amount.cc @@ -120,11 +120,13 @@ namespace { { char * buf = NULL; try { +#if defined(DEBUG_ON) IF_DEBUG("amount.convert") { char * tbuf = mpq_get_str(NULL, 10, quant); DEBUG("amount.convert", "Rational to convert = " << tbuf); std::free(tbuf); } +#endif // Convert the rational number to a floating-point, extending the // floating-point to a large enough size to get a precise answer. diff --git a/src/draft.cc b/src/draft.cc index 017c637d..9abc769e 100644 --- a/src/draft.cc +++ b/src/draft.cc @@ -109,7 +109,14 @@ void draft_t::parse_args(const value_t& args) } else if (check_for_date && bool(weekday = string_to_day_of_week(what[0]))) { +#if defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif short dow = static_cast<short>(*weekday); +#if defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6 +#pragma GCC diagnostic pop +#endif date_t date = CURRENT_DATE() - date_duration(1); while (date.day_of_week() != dow) date -= date_duration(1); diff --git a/src/filters.cc b/src/filters.cc index 8543cddb..34df2056 100644 --- a/src/filters.cc +++ b/src/filters.cc @@ -833,10 +833,17 @@ void subtotal_posts::report_subtotal(const char * spec_fmt, foreach (post_t * post, component_posts) { date_t date = post->date(); date_t value_date = post->value_date(); +#if defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif if (! range_start || date < *range_start) range_start = date; if (! range_finish || value_date > *range_finish) range_finish = value_date; +#if defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6 +#pragma GCC diagnostic pop +#endif } } component_posts.clear(); @@ -880,8 +887,10 @@ void subtotal_posts::operator()(post_t& post) if (i == values.end()) { value_t temp; post.add_to_value(temp, amount_expr); - std::pair<values_map::iterator, bool> result - = values.insert(values_pair(acct->fullname(), acct_value_t(acct, temp))); +#if defined(DEBUG_ON) + std::pair<values_map::iterator, bool> result = +#endif + values.insert(values_pair(acct->fullname(), acct_value_t(acct, temp))); assert(result.second); } else { post.add_to_value((*i).second.value, amount_expr); diff --git a/src/format.cc b/src/format.cc index d8c03e6a..79f94869 100644 --- a/src/format.cc +++ b/src/format.cc @@ -221,8 +221,10 @@ format_t::element_t * format_t::parse_elements(const string& fmt, static_cast<int>(current->max_width) : -1); else if (keyword == "left") expr << (current->has_flags(ELEMENT_ALIGN_LEFT) ? "false" : "true"); +#if defined(DEBUG_ON) else assert("Unrecognized format substitution keyword" == NULL); +#endif } else { expr << *ptr++; } @@ -38,6 +38,16 @@ namespace ledger { +void intrusive_ptr_add_ref(const expr_t::op_t * op) +{ + op->acquire(); +} + +void intrusive_ptr_release(const expr_t::op_t * op) +{ + op->release(); +} + namespace { value_t split_cons_expr(expr_t::ptr_op_t op) { @@ -260,12 +260,8 @@ private: checked_delete(this); } - friend inline void intrusive_ptr_add_ref(const op_t * op) { - op->acquire(); - } - friend inline void intrusive_ptr_release(const op_t * op) { - op->release(); - } + friend void intrusive_ptr_add_ref(const op_t * op); + friend void intrusive_ptr_release(const op_t * op); ptr_op_t copy(ptr_op_t _left = NULL, ptr_op_t _right = NULL) const { ptr_op_t node(new_node(kind, _left, _right)); diff --git a/src/pool.cc b/src/pool.cc index ca50db2c..a6ae0919 100644 --- a/src/pool.cc +++ b/src/pool.cc @@ -70,9 +70,11 @@ commodity_t * commodity_pool_t::create(const string& symbol) DEBUG("pool.commodities", "Creating commodity '" << commodity->symbol() << "'"); - std::pair<commodities_map::iterator, bool> result - = commodities.insert(commodities_map::value_type - (commodity->base_symbol(), commodity)); +#if defined(DEBUG_ON) + std::pair<commodities_map::iterator, bool> result = +#endif + commodities.insert(commodities_map::value_type + (commodity->base_symbol(), commodity)); assert(result.second); commodity_price_history.add_commodity(*commodity.get()); @@ -211,10 +213,12 @@ commodity_pool_t::create(commodity_t& comm, << "symbol " << commodity->symbol() << std::endl << details); - std::pair<annotated_commodities_map::iterator, bool> result - = annotated_commodities.insert(annotated_commodities_map::value_type - (annotated_commodities_map::key_type - (comm.symbol(), details), commodity)); +#if defined(DEBUG_ON) + std::pair<annotated_commodities_map::iterator, bool> result = +#endif + annotated_commodities.insert(annotated_commodities_map::value_type + (annotated_commodities_map::key_type + (comm.symbol(), details), commodity)); assert(result.second); return commodity.get(); diff --git a/src/pyinterp.cc b/src/pyinterp.cc index d733c40d..d1f46580 100644 --- a/src/pyinterp.cc +++ b/src/pyinterp.cc @@ -535,6 +535,7 @@ namespace { case value_t::ANY: // a pointer to an arbitrary object return object(val); } + return object(); } } diff --git a/src/query.h b/src/query.h index f95988a7..7286e89b 100644 --- a/src/query.h +++ b/src/query.h @@ -186,6 +186,7 @@ public: assert(false); return "<UNKNOWN>"; } + return "<ERROR>"; } void unexpected(); diff --git a/src/textual.cc b/src/textual.cc index cf15f048..258a4d76 100644 --- a/src/textual.cc +++ b/src/textual.cc @@ -107,10 +107,12 @@ namespace { return (in.good() && ! in.eof() && (in.peek() == ' ' || in.peek() == '\t')); } +#if defined(HAVE_BOOST_PYTHON) bool peek_blank_line() { return (in.good() && ! in.eof() && (in.peek() == '\n' || in.peek() == '\r')); } +#endif void read_next_directive(); @@ -943,9 +945,11 @@ void instance_t::account_alias_directive(account_t * account, string alias) // (account), add a reference to the account in the `account_aliases' // map, which is used by the post parser to resolve alias references. trim(alias); - std::pair<accounts_map::iterator, bool> result - = context.journal - ->account_aliases.insert(accounts_map::value_type(alias, account)); +#if defined(DEBUG_ON) + std::pair<accounts_map::iterator, bool> result = +#endif + context.journal->account_aliases.insert + (accounts_map::value_type(alias, account)); assert(result.second); } diff --git a/src/times.h b/src/times.h index 6eadcad3..edc6d8b8 100644 --- a/src/times.h +++ b/src/times.h @@ -218,6 +218,7 @@ struct date_duration_t case YEARS: return date + gregorian::years(length); } + return date_t(); } date_t subtract(const date_t& date) const { @@ -233,6 +234,7 @@ struct date_duration_t case YEARS: return date - gregorian::years(length); } + return date_t(); } string to_string() const { diff --git a/src/xact.cc b/src/xact.cc index 5cec9ab0..5c43558d 100644 --- a/src/xact.cc +++ b/src/xact.cc @@ -336,7 +336,9 @@ bool xact_base_t::finalize() amount_t> sorted_amounts_map; sorted_amounts_map samp; foreach (const balance_t::amounts_map::value_type& pair, bal.amounts) { +#if defined(DEBUG_ON) std::pair<sorted_amounts_map::iterator, bool> result = +#endif samp.insert(sorted_amounts_map::value_type (sorted_amounts_map::key_type (pair.first->symbol(), |