Skip to content

Commit 0270dce

Browse files
committed
Merge pull request #136 from torbjoernk/feature/tackle-compiler-warnings
tackling compiler warnings Yay -- very nice.
2 parents 7f8947f + 3b76e57 commit 0270dce

File tree

7 files changed

+25
-22
lines changed

7 files changed

+25
-22
lines changed

include/pfasst.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
namespace pfasst
1111
{
12-
static void init(int argc, char** argv)
12+
inline static void init(int argc, char** argv)
1313
{
1414
SDC<>::enable_config_options(0);
1515
Quadrature::enable_config_options(0);

include/pfasst/config.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,27 +102,27 @@ namespace pfasst
102102

103103

104104
template<typename T>
105-
static const T get_value(const string& name, const T& default_val)
105+
inline static T get_value(const string& name, const T& default_val)
106106
{
107107
return Options::get_instance().get_variables_map().count(name)
108108
? Options::get_instance().get_variables_map()[name].as<T>() : default_val;
109109
}
110110

111111

112112
template<typename T>
113-
static const T get_value(const string& name)
113+
inline static T get_value(const string& name)
114114
{
115115
return Options::get_instance().get_variables_map()[name].as<T>();
116116
}
117117

118118

119-
static bool no_params_given()
119+
inline static bool no_params_given()
120120
{
121121
return Options::get_instance().get_variables_map().empty();
122122
}
123123

124124

125-
static string pretty_print()
125+
inline static string pretty_print()
126126
{
127127
stringstream s;
128128
s << "Logging Options:" << endl
@@ -140,7 +140,7 @@ namespace pfasst
140140
/**
141141
* @returns empty string if params are set and `if_no_params` is `true`
142142
*/
143-
static string print_help(bool if_no_params = false)
143+
inline static string print_help(bool if_no_params = false)
144144
{
145145
if (!if_no_params || (if_no_params && no_params_given())) {
146146
return pretty_print();
@@ -150,14 +150,14 @@ namespace pfasst
150150
}
151151

152152

153-
static void init_global_options(po::options_description& opts)
153+
inline static void init_global_options(po::options_description& opts)
154154
{
155155
opts.add_options()
156156
("help,h", "display this help message");
157157
}
158158

159159

160-
static void init_config()
160+
inline static void init_config()
161161
{
162162
Options::get_instance()
163163
.register_init_function("Global Options",
@@ -168,7 +168,7 @@ namespace pfasst
168168
}
169169

170170

171-
static void read_commandline(int argc, char* argv[], bool exit_on_help = true)
171+
inline static void read_commandline(int argc, char* argv[], bool exit_on_help = true)
172172
{
173173
po::parsed_options parsed = po::command_line_parser(argc, argv)
174174
.options(Options::get_instance().get_all_options())
@@ -188,7 +188,7 @@ namespace pfasst
188188
/**
189189
* @throws invalid_argument if the given file could not be opened
190190
*/
191-
static void read_config_file(string file_name)
191+
inline static void read_config_file(string file_name)
192192
{
193193
ifstream ifs(file_name.c_str(), ios_base::in);
194194
if (!ifs) {

include/pfasst/encap/encap_sweeper.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ namespace pfasst
193193
*/
194194
virtual void reevaluate(bool initial_only=false)
195195
{
196+
UNUSED(initial_only);
196197
throw NotImplementedYet("sweeper");
197198
}
198199

@@ -228,6 +229,7 @@ namespace pfasst
228229
*/
229230
virtual void residual(time dt, vector<shared_ptr<Encapsulation<time>>> dst) const
230231
{
232+
UNUSED(dt); UNUSED(dst);
231233
throw NotImplementedYet("residual");
232234
}
233235

@@ -241,6 +243,7 @@ namespace pfasst
241243
if (this->abs_residual_tol > 0.0 || this->rel_residual_tol > 0.0) {
242244
if (this->residuals.size() == 0) {
243245
for (auto x: this->get_nodes()) {
246+
UNUSED(x);
244247
this->residuals.push_back(this->get_factory()->create(pfasst::encap::solution));
245248
}
246249
}

include/pfasst/encap/imex_sweeper.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ namespace pfasst
309309

310310
void predict_without_left(bool initial)
311311
{
312+
UNUSED(initial);
312313
time dt = this->get_controller()->get_time_step();
313314
time t = this->get_controller()->get_time();
314315
time ds;

include/pfasst/logging.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ namespace pfasst
8686
/**
8787
* sets default configuration for default loggers
8888
*/
89-
static void load_default_config()
89+
inline static void load_default_config()
9090
{
9191
const string TIMESTAMP = OUT::white + "%datetime{%H:%m:%s,%g}" + OUT::reset + " ";
9292
const string LEVEL = "[%level]";
@@ -137,7 +137,7 @@ namespace pfasst
137137
*
138138
* \see https://github.com/easylogging/easyloggingpp#logging-flags
139139
*/
140-
static void set_logging_flags()
140+
inline static void set_logging_flags()
141141
{
142142
el::Loggers::addFlag(el::LoggingFlag::NewLineForContainer);
143143
el::Loggers::addFlag(el::LoggingFlag::LogDetailedCrashReason);
@@ -149,9 +149,9 @@ namespace pfasst
149149
}
150150

151151
#ifdef NDEBUG
152-
static void test_logging_levels() {}
152+
inline static void test_logging_levels() {}
153153
#else
154-
static void test_logging_levels()
154+
inline static void test_logging_levels()
155155
{
156156
cout << "### Example of different Logging Levels:" << endl;
157157
LOG(INFO) << "info";
@@ -176,7 +176,7 @@ namespace pfasst
176176
* \param[in] argc number of command line arguments
177177
* \param[in] argv command line arguments
178178
*/
179-
static void start_log(int argc, char** argv)
179+
inline static void start_log(int argc, char** argv)
180180
{
181181
_START_EASYLOGGINGPP(argc, argv);
182182
set_logging_flags();

include/pfasst/quadrature.hpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ namespace pfasst
2929
namespace quadrature
3030
{
3131
template<typename precision = pfasst::time_precision>
32-
shared_ptr<IQuadrature<precision>> quadrature_factory(const size_t nnodes,
33-
const QuadratureType qtype)
32+
shared_ptr<IQuadrature<precision>> quadrature_factory(const size_t nnodes, const QuadratureType qtype)
3433
{
3534
if (qtype == QuadratureType::GaussLegendre) {
3635
return make_shared<GaussLegendre<precision>>(nnodes);
@@ -112,7 +111,7 @@ namespace pfasst
112111
// note: GCC fails with "error: explicit template specialization cannot have a storage class"
113112
// if this template specialization is also declared 'static'; Clang does not care.
114113
template<>
115-
const pfasst::quadrature::QuadratureType get_value(const string& name)
114+
inline pfasst::quadrature::QuadratureType get_value(const string& name)
116115
{
117116
const string type = Options::get_instance().get_variables_map()[name].as<string>();
118117
if (type == "gauss-lobatto") {
@@ -133,8 +132,8 @@ namespace pfasst
133132
// note: GCC fails with "error: explicit template specialization cannot have a storage class"
134133
// if this template specialization is also declared 'static'; Clang does not care.
135134
template<>
136-
const pfasst::quadrature::QuadratureType get_value(const string& name,
137-
const pfasst::quadrature::QuadratureType& default_value)
135+
inline pfasst::quadrature::QuadratureType get_value(const string& name,
136+
const pfasst::quadrature::QuadratureType& default_value)
138137
{
139138
if (Options::get_instance().get_variables_map().count(name) == 1) {
140139
return pfasst::config::get_value<pfasst::quadrature::QuadratureType>(name);

tests/examples/advection_diffusion/test_advection_diffusion.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ TEST(ErrorTest, VanillaSDC)
4949
}
5050

5151
EXPECT_THAT(err, testing::Pointwise(DoubleLess(), tol));
52-
ASSERT_EQ(max_iter, 3);
52+
ASSERT_EQ(max_iter, (size_t)3);
5353
}
5454

5555
{
@@ -66,7 +66,7 @@ TEST(ErrorTest, VanillaSDC)
6666
}
6767

6868
EXPECT_THAT(err, testing::Pointwise(DoubleLess(), tol));
69-
ASSERT_EQ(max_iter, 2);
69+
ASSERT_EQ(max_iter, (size_t)2);
7070
}
7171
}
7272

0 commit comments

Comments
 (0)