Convert functions in anonymous namespace into statics
These functions are referred to from templates which may not be instantiated. Since they were in an anonymous namespace they were not reachable otherwise, and a warning is emitted. This only applies to Clang; GCC consider them used. If we make them static helper functions instead, the warning disappears.
This commit is contained in:
@@ -282,6 +282,12 @@ namespace Opm {
|
||||
template <typename StringArray>
|
||||
void parseCommandLineArguments(int argc, StringArray argv);
|
||||
void recursiveSetIsOutputEnabled(bool output_is_enabled);
|
||||
|
||||
// helper routines to do textual I/O
|
||||
template <typename T>
|
||||
static std::string to_string(const T& val);
|
||||
static std::pair<std::string, std::string>
|
||||
filename_split(const std::string& filename);
|
||||
};
|
||||
} // namespace parameter
|
||||
} // namespace Opm
|
||||
|
||||
@@ -66,18 +66,18 @@ namespace Opm {
|
||||
static std::string type() {return "ParameterGroup";}
|
||||
};
|
||||
|
||||
namespace {
|
||||
template <typename T>
|
||||
inline std::string
|
||||
to_string(const T& val)
|
||||
ParameterGroup::to_string(const T& val)
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << val;
|
||||
return os.str();
|
||||
}
|
||||
|
||||
template <>
|
||||
inline std::string
|
||||
to_string(const bool b) {
|
||||
ParameterGroup::to_string(const bool& b) {
|
||||
if (b) {
|
||||
return ID_true;
|
||||
} else {
|
||||
@@ -85,14 +85,15 @@ namespace Opm {
|
||||
}
|
||||
}
|
||||
|
||||
template <>
|
||||
inline std::string
|
||||
to_string(const ParameterGroup&)
|
||||
ParameterGroup::to_string(const ParameterGroup&)
|
||||
{
|
||||
return std::string("<parameter group>");
|
||||
}
|
||||
|
||||
std::pair<std::string, std::string>
|
||||
filename_split(const std::string& filename)
|
||||
inline std::pair<std::string, std::string>
|
||||
ParameterGroup::filename_split(const std::string& filename)
|
||||
{
|
||||
int fpos = filename.rfind('.');
|
||||
std::string name = filename.substr(0, fpos);
|
||||
@@ -100,10 +101,6 @@ namespace Opm {
|
||||
return std::make_pair(name, type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
template <typename StringArray>
|
||||
ParameterGroup::ParameterGroup(int argc, StringArray argv, bool verify_syntax)
|
||||
: path_(ID_path_root), parent_(0), output_is_enabled_(true)
|
||||
|
||||
Reference in New Issue
Block a user