[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi] [PATCH 1/3] Avoid warnings about unused local functions and types.
From: |
Vadim Zeitlin |
Subject: |
[lmi] [PATCH 1/3] Avoid warnings about unused local functions and types. |
Date: |
Mon, 29 Sep 2014 16:29:42 +0200 |
Date: |
Mon, 29 Sep 2014 01:06:01 +0200 |
Hello,
While trying to build latest LMI on Linux, I ran into several issues with
g++ 4.9.1. Here is the first of the 3 patches needed to make LMI compile
with it without errors or warnings. I also have some changes to configure
and Makefile.am, which I am going to commit myself, if there are no
objections.
-- >8 --
Don't define functions and types unless they are really used. This avoids
'function' defined but not used [-Werror=unused-function]
typedef 'name' locally defined but not used
[-Werror=unused-local-typedefs]
warnings/errors generated by at least g++ 4.9.1.
---
actuarial_table.cpp | 2 ++
custom_io_0.cpp | 4 ++++
interest_rates.cpp | 3 ++-
istream_to_string.hpp | 2 +-
4 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/actuarial_table.cpp b/actuarial_table.cpp
index 619618d..447137b 100644
--- a/actuarial_table.cpp
+++ b/actuarial_table.cpp
@@ -907,6 +907,7 @@ void soa_actuarial_table::read_values(std::istream& is, int
nominal_length)
return v;
}
+#if defined LMI_USE_XML_TABLES
namespace
{
bool almost_equal_doubles(std::vector<double> const& a,
std::vector<double> const& b)
@@ -936,6 +937,7 @@ void soa_actuarial_table::read_values(std::istream& is, int
nominal_length)
return true;
}
} // Unnamed namespace.
+#endif // !defined LMI_USE_XML_TABLES
std::vector<double> actuarial_table_rates
(std::string const& table_filename
diff --git a/custom_io_0.cpp b/custom_io_0.cpp
index 9649b10..0f66101 100644
--- a/custom_io_0.cpp
+++ b/custom_io_0.cpp
@@ -144,6 +144,9 @@ bool custom_io_0_file_exists()
return InputSequence(general_account_rate).mathematical_representation();
}
+// This function is currently unused. Reenable it if the call to it below is
+// uncommented.
+#if 0
void test_adjust_interest_rates()
{
std::vector<double> declared_rate;
@@ -192,6 +195,7 @@ void test_adjust_interest_rates()
;
warning() << std::flush;
}
+#endif
} // Unnamed namespace.
diff --git a/interest_rates.cpp b/interest_rates.cpp
index d5ca279..3a8859a 100644
--- a/interest_rates.cpp
+++ b/interest_rates.cpp
@@ -230,7 +230,7 @@
/// Determine whether loan rates are needed; else they can be zero.
///
/// Loan rates can potentially affect GPT calculations.
-
+#if 0
bool need_loan_rates(yare_input const& yi)
{
return
@@ -244,6 +244,7 @@ bool need_loan_rates(yare_input const& yi)
|| !each_equal(yi.NewLoan.begin(), yi.NewLoan.end(), 0.0)
;
}
+#endif
} // Unnamed namespace.
InterestRates::~InterestRates()
diff --git a/istream_to_string.hpp b/istream_to_string.hpp
index 168bdc6..c9119f3 100644
--- a/istream_to_string.hpp
+++ b/istream_to_string.hpp
@@ -46,8 +46,8 @@ void istream_to_string
,std::basic_string<Char_t,Traits,Allocator>& s
)
{
- typedef std::basic_string<Char_t,Traits,Allocator> string_type;
#if 0
+ typedef std::basic_string<Char_t,Traits,Allocator> string_type;
// Requires <iterator>.
typedef std::istreambuf_iterator<Char_t,Traits> bisbi;
string_type((bisbi(is)), bisbi()).swap(s);
--
2.1.0.rc0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi] [PATCH 1/3] Avoid warnings about unused local functions and types.,
Vadim Zeitlin <=