Corrected several compile and link problems

This commit is contained in:
John Wiegley 2012-03-06 23:04:27 -06:00
parent 488355e5d9
commit 71d0033b6f
13 changed files with 62 additions and 20 deletions

View file

@ -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;

View file

@ -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.

View file

@ -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);

View file

@ -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);

View file

@ -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++;
}

View file

@ -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)
{

View file

@ -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));

View file

@ -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();

View file

@ -535,6 +535,7 @@ namespace {
case value_t::ANY: // a pointer to an arbitrary object
return object(val);
}
return object();
}
}

View file

@ -186,6 +186,7 @@ public:
assert(false);
return "<UNKNOWN>";
}
return "<ERROR>";
}
void unexpected();

View file

@ -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);
}

View file

@ -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 {

View file

@ -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(),