diff options
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | Makefile.in | 3 | ||||
-rw-r--r-- | src/amount.cc | 2 | ||||
-rw-r--r-- | src/ofx.h | 8 | ||||
-rw-r--r-- | src/option.cc | 4 | ||||
-rw-r--r-- | src/quotes.cc | 1 | ||||
-rw-r--r-- | src/session.h | 2 | ||||
-rw-r--r-- | src/utils.cc | 4 | ||||
-rw-r--r-- | src/utils.h | 6 | ||||
-rw-r--r-- | src/value.cc | 6 | ||||
-rw-r--r-- | src/value.h | 2 | ||||
-rw-r--r-- | src/xml.h | 1 |
12 files changed, 23 insertions, 18 deletions
diff --git a/Makefile.am b/Makefile.am index 2ec279b4..19d6435c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -26,6 +26,8 @@ WARNFLAGS = -Wall -Wextra -Wfloat-equal -Wno-endif-labels WARNFLAGS += -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion WARNFLAGS += -Wconversion -Wshorten-64-to-32 -Wsign-compare WARNFLAGS += -Wmissing-field-initializers -pedantic-errors +WARNFLAGS += -Weffc++ -Wstrict-null-sentinel -Wold-style-cast +WARNFLAGS += -Woverloaded-virtual -Wsign-promo libledger_la_CPPFLAGS = -I$(top_builddir)/gdtoa -I$(srcdir)/gdtoa \ -I$(srcdir)/src #$(WARNFLAGS) diff --git a/Makefile.in b/Makefile.in index 5dc12135..9c246b8f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -358,7 +358,8 @@ AM_LFLAGS = -o $(LEX_OUTPUT_ROOT).c WARNFLAGS = -Wall -Wextra -Wfloat-equal -Wno-endif-labels -Wcast-qual \ -Wcast-align -Wwrite-strings -Wconversion -Wconversion \ -Wshorten-64-to-32 -Wsign-compare -Wmissing-field-initializers \ - -pedantic-errors + -pedantic-errors -Weffc++ -Wstrict-null-sentinel \ + -Wold-style-cast -Woverloaded-virtual -Wsign-promo libledger_la_CPPFLAGS = -I$(top_builddir)/gdtoa -I$(srcdir)/gdtoa \ -I$(srcdir)/src $(am__append_2) $(am__append_4) \ $(am__append_6) $(am__append_8) $(am__append_9) diff --git a/src/amount.cc b/src/amount.cc index 0025fbd9..b014112b 100644 --- a/src/amount.cc +++ b/src/amount.cc @@ -497,7 +497,6 @@ amount_t& amount_t::operator*=(const amount_t& amt) mpz_mul(MPZ(quantity), MPZ(quantity), MPZ(amt.quantity)); quantity->prec += amt.quantity->prec; - finish: if (! has_commodity()) commodity_ = amt.commodity_; @@ -547,7 +546,6 @@ amount_t& amount_t::operator/=(const amount_t& amt) mpz_round(MPZ(quantity), MPZ(quantity), quantity->prec, quantity->prec - 1); quantity->prec -= 1; - finish: if (! has_commodity()) commodity_ = amt.commodity_; @@ -41,10 +41,10 @@ class ofx_parser_t : public parser_t public: virtual bool test(std::istream& in) const; - virtual unsigned int parse(std::istream& in, - journal_t * journal, - account_t * master = NULL, - const string * original_file = NULL); + virtual unsigned int parse(std::istream& in, + journal_t * journal, + account_t * master = NULL, + const optional<path>& original = optional<path>()); }; } // namespace ledger diff --git a/src/option.cc b/src/option.cc index 51b5459e..dd0dad4b 100644 --- a/src/option.cc +++ b/src/option.cc @@ -170,7 +170,6 @@ void process_arguments(int argc, char ** argv, const bool anywhere, } // --long-option or -s - again: if ((*i)[1] == '-') { if ((*i)[2] == '\0') break; @@ -241,9 +240,6 @@ void process_arguments(int argc, char ** argv, const bool anywhere, checked_delete(*o); } } - - next: - ; } } diff --git a/src/quotes.cc b/src/quotes.cc index c38beafd..d5dbd4fe 100644 --- a/src/quotes.cc +++ b/src/quotes.cc @@ -111,6 +111,7 @@ quotes_by_script::operator()(commodity_t& commodity, "Failed to download price for '" << commodity.symbol() << "' (command: \"getquote " << commodity.base_symbol() << "\")"); } + return optional<amount_t>(); } } // namespace ledger diff --git a/src/session.h b/src/session.h index 4693cacf..40fb5c4a 100644 --- a/src/session.h +++ b/src/session.h @@ -153,7 +153,7 @@ class session_t : public xml::xpath_t::scope_t account_t * master = NULL, const optional<path>& original = optional<path>()); - unsigned int read_journal(const path& path, + unsigned int read_journal(const path& pathname, journal_t * journal, account_t * master = NULL, const optional<path>& original = optional<path>()); diff --git a/src/utils.cc b/src/utils.cc index e4e0f2bc..bcbffdca 100644 --- a/src/utils.cc +++ b/src/utils.cc @@ -454,10 +454,8 @@ static inline void stream_memory_size(std::ostream& out, std::size_t size) out << (double(size) / 1024.0) << 'K'; else if (size < (1024 * 1024 * 1024)) out << (double(size) / (1024.0 * 1024.0)) << 'M'; - else if (size < (1024 * 1024 * 1024 * 1024)) - out << (double(size) / (1024.0 * 1024.0 * 1024.0)) << 'G'; else - assert(false); + out << (double(size) / (1024.0 * 1024.0 * 1024.0)) << 'G'; } static bool logger_has_run = false; diff --git a/src/utils.h b/src/utils.h index 8ff142ca..4dabd7ea 100644 --- a/src/utils.h +++ b/src/utils.h @@ -102,9 +102,9 @@ namespace ledger { typedef gregorian::date_duration date_duration; typedef posix_time::seconds seconds; - typedef filesystem::path path; - typedef boost::filesystem::ifstream ifstream; - typedef boost::filesystem::ofstream ofstream; + typedef boost::filesystem::path path; + typedef boost::filesystem::ifstream ifstream; + typedef boost::filesystem::ofstream ofstream; typedef boost::filesystem::filesystem_error filesystem_error; } diff --git a/src/value.cc b/src/value.cc index 6623e1a1..63719266 100644 --- a/src/value.cc +++ b/src/value.cc @@ -392,6 +392,7 @@ value_t& value_t::operator+=(const value_t& val) throw_(value_error, "Cannot add " << label() << " to " << val.label()); + return *this; } value_t& value_t::operator-=(const value_t& val) @@ -541,6 +542,7 @@ value_t& value_t::operator-=(const value_t& val) throw_(value_error, "Cannot subtract " << label() << " from " << val.label()); + return *this; } value_t& value_t::operator*=(const value_t& val) @@ -626,6 +628,7 @@ value_t& value_t::operator*=(const value_t& val) throw_(value_error, "Cannot multiply " << label() << " with " << val.label()); + return *this; } value_t& value_t::operator/=(const value_t& val) @@ -695,6 +698,7 @@ value_t& value_t::operator/=(const value_t& val) throw_(value_error, "Cannot divide " << label() << " by " << val.label()); + return *this; } @@ -1228,6 +1232,7 @@ value_t value_t::value(const optional<moment_t>& moment) const } throw_(value_error, "Cannot find the value of " << label()); + return value_t(); } void value_t::in_place_reduce() @@ -1269,6 +1274,7 @@ value_t value_t::round() const } throw_(value_error, "Cannot round " << label()); + return value_t(); } value_t value_t::unround() const diff --git a/src/value.h b/src/value.h index 4f5908b3..917f732f 100644 --- a/src/value.h +++ b/src/value.h @@ -327,6 +327,8 @@ class value_t assert(false); break; } + assert(false); + return "<invalid>"; } operator bool() const; @@ -127,6 +127,7 @@ public: virtual value_t to_value() const { throw_(conversion_error, "Cannot convert node to a value"); + return value_t(); } virtual void print(std::ostream& out, int depth = 0) const = 0; |