Format core sources again

Formatted with nl_func_type_name and related options set to ignore. This
keeps the formatting intact for long return types in declarations and
definitions.
This commit is contained in:
Markus Mäkelä
2019-05-09 10:43:09 +03:00
parent 50b5fe76ef
commit b4e8f79c5f
30 changed files with 331 additions and 334 deletions

View File

@ -245,9 +245,7 @@ enum DurationUnit
DURATION_IN_MILLISECONDS, DURATION_IN_MILLISECONDS,
DURATION_IN_DEFAULT DURATION_IN_DEFAULT
}; };
} }
} }
/** /**

View File

@ -291,7 +291,8 @@ public:
bool set(Type& value, const std::string& value_as_string) const override; bool set(Type& value, const std::string& value_as_string) const override;
bool from_string(const std::string& value, value_type* pValue, std::string* pMessage = nullptr) const; bool from_string(const std::string& value, value_type* pValue,
std::string* pMessage = nullptr) const;
std::string to_string(value_type value) const; std::string to_string(value_type value) const;
private: private:
@ -320,7 +321,8 @@ public:
bool set(Type& value, const std::string& value_as_string) const override; bool set(Type& value, const std::string& value_as_string) const override;
bool from_string(const std::string& value, value_type* pValue, std::string* pMessage = nullptr) const; bool from_string(const std::string& value, value_type* pValue,
std::string* pMessage = nullptr) const;
std::string to_string(value_type value) const; std::string to_string(value_type value) const;
protected: protected:
@ -403,8 +405,8 @@ private:
: ParamNumber(pSpecification, zName, zDescription, kind, MXS_MODULE_PARAM_COUNT, : ParamNumber(pSpecification, zName, zDescription, kind, MXS_MODULE_PARAM_COUNT,
default_value, default_value,
min_value >= 0 ? min_value : 0, min_value >= 0 ? min_value : 0,
max_value <= std::numeric_limits<uint32_t>::max() max_value <= std::numeric_limits<uint32_t>::max() ?
? max_value : std::numeric_limits<uint32_t>::max()) max_value : std::numeric_limits<uint32_t>::max())
{ {
mxb_assert(min_value >= 0); mxb_assert(min_value >= 0);
mxb_assert(max_value <= std::numeric_limits<uint32_t>::max()); mxb_assert(max_value <= std::numeric_limits<uint32_t>::max());
@ -473,10 +475,10 @@ private:
value_type max_value) value_type max_value)
: ParamNumber(pSpecification, zName, zDescription, kind, MXS_MODULE_PARAM_INT, : ParamNumber(pSpecification, zName, zDescription, kind, MXS_MODULE_PARAM_INT,
default_value, default_value,
min_value >= std::numeric_limits<int32_t>::min() min_value >= std::numeric_limits<int32_t>::min() ?
? min_value : std::numeric_limits<int32_t>::min(), min_value : std::numeric_limits<int32_t>::min(),
max_value <= std::numeric_limits<int32_t>::max() max_value <= std::numeric_limits<int32_t>::max() ?
? max_value : std::numeric_limits<int32_t>::max()) max_value : std::numeric_limits<int32_t>::max())
{ {
mxb_assert(min_value >= std::numeric_limits<int32_t>::min()); mxb_assert(min_value >= std::numeric_limits<int32_t>::min());
mxb_assert(max_value <= std::numeric_limits<int32_t>::max()); mxb_assert(max_value <= std::numeric_limits<int32_t>::max());
@ -517,7 +519,8 @@ public:
bool set(Type& value, const std::string& value_as_string) const override; bool set(Type& value, const std::string& value_as_string) const override;
bool from_string(const std::string& value, value_type* pValue, std::string* pMessage = nullptr) const; bool from_string(const std::string& value, value_type* pValue,
std::string* pMessage = nullptr) const;
std::string to_string(const value_type& value) const; std::string to_string(const value_type& value) const;
private: private:
@ -572,7 +575,8 @@ public:
bool set(Type& value, const std::string& value_as_string) const override; bool set(Type& value, const std::string& value_as_string) const override;
bool from_string(const std::string& value, value_type* pValue, std::string* pMessage = nullptr) const; bool from_string(const std::string& value, value_type* pValue,
std::string* pMessage = nullptr) const;
std::string to_string(value_type value) const; std::string to_string(value_type value) const;
void populate(MXS_MODULE_PARAM& param) const; void populate(MXS_MODULE_PARAM& param) const;
@ -636,7 +640,8 @@ public:
bool set(Type& value, const std::string& value_as_string) const override; bool set(Type& value, const std::string& value_as_string) const override;
bool from_string(const std::string& value, value_type* pValue, std::string* pMessage = nullptr) const; bool from_string(const std::string& value, value_type* pValue,
std::string* pMessage = nullptr) const;
std::string to_string(const value_type& value) const; std::string to_string(const value_type& value) const;
void populate(MXS_MODULE_PARAM& param) const; void populate(MXS_MODULE_PARAM& param) const;
@ -690,7 +695,8 @@ public:
bool set(Type& value, const std::string& value_as_string) const override; bool set(Type& value, const std::string& value_as_string) const override;
bool from_string(const std::string& value, value_type* pValue, std::string* pMessage = nullptr) const; bool from_string(const std::string& value, value_type* pValue,
std::string* pMessage = nullptr) const;
std::string to_string(value_type value) const; std::string to_string(value_type value) const;
private: private:
@ -739,7 +745,8 @@ public:
bool set(Type& value, const std::string& value_as_string) const override; bool set(Type& value, const std::string& value_as_string) const override;
bool from_string(const std::string& value, value_type* pValue, std::string* pMessage = nullptr) const; bool from_string(const std::string& value, value_type* pValue,
std::string* pMessage = nullptr) const;
std::string to_string(value_type value) const; std::string to_string(value_type value) const;
private: private:
@ -856,7 +863,7 @@ class Type
{ {
public: public:
Type(const Type& rhs) = delete; Type(const Type& rhs) = delete;
Type& operator = (const Type&) = delete; Type& operator=(const Type&) = delete;
~Type(); ~Type();
@ -921,7 +928,7 @@ public:
{ {
} }
This& operator = (const ConcreteType<This, ParamType>& rhs) This& operator=(const ConcreteType<This, ParamType>& rhs)
{ {
// Only the value is copied, the parameter and the configuration // Only the value is copied, the parameter and the configuration
// remains the same. // remains the same.
@ -954,43 +961,43 @@ protected:
* ConcreteType <-> ConcreteType * ConcreteType <-> ConcreteType
*/ */
template<class This, class ParamType> template<class This, class ParamType>
inline bool operator == (const ConcreteType<This,ParamType>& lhs, inline bool operator==(const ConcreteType<This, ParamType>& lhs,
const ConcreteType<This,ParamType>& rhs) const ConcreteType<This, ParamType>& rhs)
{ {
return lhs.get() == rhs.get(); return lhs.get() == rhs.get();
} }
template<class This, class ParamType> template<class This, class ParamType>
inline bool operator != (const ConcreteType<This,ParamType>& lhs, inline bool operator!=(const ConcreteType<This, ParamType>& lhs,
const ConcreteType<This,ParamType>& rhs) const ConcreteType<This, ParamType>& rhs)
{ {
return lhs.get() != rhs.get(); return lhs.get() != rhs.get();
} }
template<class This, class ParamType> template<class This, class ParamType>
inline bool operator < (const ConcreteType<This,ParamType>& lhs, inline bool operator<(const ConcreteType<This, ParamType>& lhs,
const ConcreteType<This,ParamType>& rhs) const ConcreteType<This, ParamType>& rhs)
{ {
return lhs.get() < rhs.get(); return lhs.get() < rhs.get();
} }
template<class This, class ParamType> template<class This, class ParamType>
inline bool operator > (const ConcreteType<This,ParamType>& lhs, inline bool operator>(const ConcreteType<This, ParamType>& lhs,
const ConcreteType<This,ParamType>& rhs) const ConcreteType<This, ParamType>& rhs)
{ {
return lhs.get() > rhs.get(); return lhs.get() > rhs.get();
} }
template<class This, class ParamType> template<class This, class ParamType>
inline bool operator <= (const ConcreteType<This,ParamType>& lhs, inline bool operator<=(const ConcreteType<This, ParamType>& lhs,
const ConcreteType<This,ParamType>& rhs) const ConcreteType<This, ParamType>& rhs)
{ {
return (lhs.get() < rhs.get()) || (lhs == rhs); return (lhs.get() < rhs.get()) || (lhs == rhs);
} }
template<class This, class ParamType> template<class This, class ParamType>
inline bool operator >= (const ConcreteType<This,ParamType>& lhs, inline bool operator>=(const ConcreteType<This, ParamType>& lhs,
const ConcreteType<This,ParamType>& rhs) const ConcreteType<This, ParamType>& rhs)
{ {
return (lhs.get() > rhs.get()) || (lhs == rhs); return (lhs.get() > rhs.get()) || (lhs == rhs);
} }
@ -1001,42 +1008,42 @@ inline bool operator >= (const ConcreteType<This,ParamType>& lhs,
* ConcreteType <-> ParamType::value_type * ConcreteType <-> ParamType::value_type
*/ */
template<class This, class ParamType> template<class This, class ParamType>
inline bool operator == (const ConcreteType<This,ParamType>& lhs, inline bool operator==(const ConcreteType<This, ParamType>& lhs,
const typename ParamType::value_type& rhs) const typename ParamType::value_type& rhs)
{ {
return lhs.get() == rhs; return lhs.get() == rhs;
} }
template<class This, class ParamType> template<class This, class ParamType>
inline bool operator != (const ConcreteType<This,ParamType>& lhs, inline bool operator!=(const ConcreteType<This, ParamType>& lhs,
const typename ParamType::value_type& rhs) const typename ParamType::value_type& rhs)
{ {
return lhs.get() != rhs; return lhs.get() != rhs;
} }
template<class This, class ParamType> template<class This, class ParamType>
inline bool operator < (const ConcreteType<This,ParamType>& lhs, inline bool operator<(const ConcreteType<This, ParamType>& lhs,
const typename ParamType::value_type& rhs) const typename ParamType::value_type& rhs)
{ {
return lhs.get() < rhs; return lhs.get() < rhs;
} }
template<class This, class ParamType> template<class This, class ParamType>
inline bool operator > (const ConcreteType<This,ParamType>& lhs, inline bool operator>(const ConcreteType<This, ParamType>& lhs,
const typename ParamType::value_type& rhs) const typename ParamType::value_type& rhs)
{ {
return lhs.get() > rhs; return lhs.get() > rhs;
} }
template<class This, class ParamType> template<class This, class ParamType>
inline bool operator <= (const ConcreteType<This,ParamType>& lhs, inline bool operator<=(const ConcreteType<This, ParamType>& lhs,
const typename ParamType::value_type& rhs) const typename ParamType::value_type& rhs)
{ {
return (lhs.get() < rhs) || (lhs.get() == rhs); return (lhs.get() < rhs) || (lhs.get() == rhs);
} }
template<class This, class ParamType> template<class This, class ParamType>
inline bool operator >= (const ConcreteType<This,ParamType>& lhs, inline bool operator>=(const ConcreteType<This, ParamType>& lhs,
const typename ParamType::value_type& rhs) const typename ParamType::value_type& rhs)
{ {
return (lhs.get() > rhs) || (lhs.get() == rhs); return (lhs.get() > rhs) || (lhs.get() == rhs);
@ -1048,43 +1055,43 @@ inline bool operator >= (const ConcreteType<This,ParamType>& lhs,
* ParamType::value_type <-> ConcreteType * ParamType::value_type <-> ConcreteType
*/ */
template<class This, class ParamType> template<class This, class ParamType>
inline bool operator == (const typename ParamType::value_type& lhs, inline bool operator==(const typename ParamType::value_type& lhs,
const ConcreteType<This,ParamType>& rhs) const ConcreteType<This, ParamType>& rhs)
{ {
return lhs == rhs.get(); return lhs == rhs.get();
} }
template<class This, class ParamType> template<class This, class ParamType>
inline bool operator != (const typename ParamType::value_type& lhs, inline bool operator!=(const typename ParamType::value_type& lhs,
const ConcreteType<This,ParamType>& rhs) const ConcreteType<This, ParamType>& rhs)
{ {
return lhs != rhs.get(); return lhs != rhs.get();
} }
template<class This, class ParamType> template<class This, class ParamType>
inline bool operator < (const typename ParamType::value_type& lhs, inline bool operator<(const typename ParamType::value_type& lhs,
const ConcreteType<This,ParamType>& rhs) const ConcreteType<This, ParamType>& rhs)
{ {
return lhs < rhs.get(); return lhs < rhs.get();
} }
template<class This, class ParamType> template<class This, class ParamType>
inline bool operator > (const typename ParamType::value_type& lhs, inline bool operator>(const typename ParamType::value_type& lhs,
const ConcreteType<This,ParamType>& rhs) const ConcreteType<This, ParamType>& rhs)
{ {
return lhs > rhs.get(); return lhs > rhs.get();
} }
template<class This, class ParamType> template<class This, class ParamType>
inline bool operator <= (const typename ParamType::value_type& lhs, inline bool operator<=(const typename ParamType::value_type& lhs,
const ConcreteType<This,ParamType>& rhs) const ConcreteType<This, ParamType>& rhs)
{ {
return (lhs < rhs.get()) || (lhs == rhs.get()); return (lhs < rhs.get()) || (lhs == rhs.get());
} }
template<class This, class ParamType> template<class This, class ParamType>
inline bool operator >= (const typename ParamType::value_type& lhs, inline bool operator>=(const typename ParamType::value_type& lhs,
const ConcreteType<This,ParamType>& rhs) const ConcreteType<This, ParamType>& rhs)
{ {
return (lhs > rhs.get()) || (lhs == rhs.get()); return (lhs > rhs.get()) || (lhs == rhs.get());
} }
@ -1147,11 +1154,11 @@ class Bool : public ConcreteType<Bool, ParamBool>
{ {
public: public:
Bool(Configuration* pConfiguration, const ParamBool* pParam) Bool(Configuration* pConfiguration, const ParamBool* pParam)
: ConcreteType<Bool,ParamBool>(pConfiguration, pParam) : ConcreteType<Bool, ParamBool>(pConfiguration, pParam)
{ {
} }
explicit operator bool () const explicit operator bool() const
{ {
return m_value; return m_value;
} }
@ -1176,18 +1183,18 @@ public:
}; };
/* /*
template<class T> * template<class T>
inline bool operator < (const Duration<T>& lhs, const Duration<T>& rhs) * inline bool operator < (const Duration<T>& lhs, const Duration<T>& rhs)
{ * {
return lhs.get() < rhs.get(); * return lhs.get() < rhs.get();
} * }
*
template<class T> * template<class T>
inline bool operator > (const Duration<T>& lhs, const Duration<T>& rhs) * inline bool operator > (const Duration<T>& lhs, const Duration<T>& rhs)
{ * {
return lhs.get() > rhs.get(); * return lhs.get() > rhs.get();
} * }
*/ */
/** /**
* Enum * Enum
@ -1236,7 +1243,7 @@ public:
} }
}; };
inline Size::value_type operator / (const Size& lhs, Size::value_type rhs) inline Size::value_type operator/(const Size& lhs, Size::value_type rhs)
{ {
return lhs.get() / rhs; return lhs.get() / rhs;
} }
@ -1380,7 +1387,7 @@ ParamEnum<T>::ParamEnum(Specification* pSpecification,
m_enum_values.emplace_back(x); m_enum_values.emplace_back(x);
} }
MXS_ENUM_VALUE end { NULL }; MXS_ENUM_VALUE end {NULL};
m_enum_values.emplace_back(end); m_enum_values.emplace_back(end);
} }
@ -1446,7 +1453,7 @@ bool ParamEnum<T>::from_string(const std::string& value_as_string,
std::string* pMessage) const std::string* pMessage) const
{ {
auto it = std::find_if(m_enumeration.begin(), m_enumeration.end(), auto it = std::find_if(m_enumeration.begin(), m_enumeration.end(),
[value_as_string](const std::pair<T,const char*>& elem) { [value_as_string](const std::pair<T, const char*>& elem) {
return value_as_string == elem.second; return value_as_string == elem.second;
}); });
@ -1487,7 +1494,7 @@ template<class T>
std::string ParamEnum<T>::to_string(value_type value) const std::string ParamEnum<T>::to_string(value_type value) const
{ {
auto it = std::find_if(m_enumeration.begin(), m_enumeration.end(), auto it = std::find_if(m_enumeration.begin(), m_enumeration.end(),
[value] (const std::pair<T, const char*>& entry) { [value](const std::pair<T, const char*>& entry) {
return entry.first == value; return entry.first == value;
}); });
@ -1501,6 +1508,4 @@ void ParamEnum<T>::populate(MXS_MODULE_PARAM& param) const
param.accepted_values = &m_enum_values[0]; param.accepted_values = &m_enum_values[0];
} }
} }

View File

@ -75,7 +75,7 @@ private:
, nextdue(time(0) + frequency) , nextdue(time(0) + frequency)
, id(0) , id(0)
{ {
}; }
std::string name; std::string name;
TASKFN func; TASKFN func;
@ -90,5 +90,4 @@ private:
std::map<std::string, Task> m_tasks_by_name; std::map<std::string, Task> m_tasks_by_name;
}; };
} }

View File

@ -160,7 +160,7 @@ public:
public: public:
std::string username; /**< Monitor username */ std::string username; /**< Monitor username */
std::string password; /**< Monitor password */ std::string password; /**< Monitor password */
int connect_timeout {1}; /**< Connect timeout in seconds for mysql_real_connect */ int connect_timeout {1};/**< Connect timeout in seconds for mysql_real_connect */
int write_timeout {1}; /**< Timeout in seconds for each attempt to write to the server. int write_timeout {1}; /**< Timeout in seconds for each attempt to write to the server.
* There are retries and the total effective timeout value is two * There are retries and the total effective timeout value is two
* times the option value. */ * times the option value. */
@ -836,7 +836,6 @@ private:
void pre_loop() final; void pre_loop() final;
void post_loop() final; void post_loop() final;
}; };
/** /**

View File

@ -138,7 +138,6 @@ namespace maxscale
*/ */
std::unique_ptr<mxq::QueryResult> execute_query(MYSQL* conn, const std::string& query, std::unique_ptr<mxq::QueryResult> execute_query(MYSQL* conn, const std::string& query,
std::string* errmsg_out = NULL); std::string* errmsg_out = NULL);
} }
MXS_END_DECLS MXS_END_DECLS

View File

@ -67,7 +67,8 @@ struct CloserTraits<pcre2_match_data*>
namespace std namespace std
{ {
template<> class default_delete<pcre2_code> template<>
class default_delete<pcre2_code>
{ {
public: public:
void operator()(pcre2_code* p) void operator()(pcre2_code* p)
@ -78,6 +79,4 @@ public:
} }
} }
}; };
} }

View File

@ -137,7 +137,7 @@ struct MXS_PROTOCOL
* *
* @return The name of the default authenticator * @return The name of the default authenticator
*/ */
char* (*auth_default)(); char* (* auth_default)();
/** /**
* Handle connection limits * Handle connection limits

View File

@ -453,7 +453,7 @@ struct QUERY_CLASSIFIER
* *
* @return The same info that was provided as argument. * @return The same info that was provided as argument.
*/ */
QC_STMT_INFO* (*qc_info_dup)(QC_STMT_INFO * info); QC_STMT_INFO* (* qc_info_dup)(QC_STMT_INFO* info);
/** /**
* Closes a dupped info object. After the info object has been closed, it must * Closes a dupped info object. After the info object has been closed, it must
@ -486,7 +486,7 @@ struct QUERY_CLASSIFIER
* *
* @return The result of the provided info. * @return The result of the provided info.
*/ */
QC_STMT_RESULT (*qc_get_result_from_info)(const QC_STMT_INFO* info); QC_STMT_RESULT (* qc_get_result_from_info)(const QC_STMT_INFO* info);
}; };
/** /**

View File

@ -656,8 +656,9 @@ private:
uint32_t handle_epoll_events(uint32_t events); uint32_t handle_epoll_events(uint32_t events);
static maxbase::Duration s_watchdog_interval; /*< Duration between notifications, if any. */ static maxbase::Duration s_watchdog_interval; /*< Duration between notifications, if any. */
static maxbase::TimePoint s_watchdog_next_check; /*< Next time to notify systemd. */ static maxbase::TimePoint s_watchdog_next_check;/*< Next time to notify systemd. */
std::atomic<bool> m_alive; /*< Set to true in epoll_tick(), false on notification. */ std::atomic<bool> m_alive; /*< Set to true in epoll_tick(), false on
* notification. */
WatchdogNotifier* m_pWatchdog_notifier; /*< Watchdog notifier, if systemd enabled. */ WatchdogNotifier* m_pWatchdog_notifier; /*< Watchdog notifier, if systemd enabled. */
}; };

View File

@ -550,5 +550,4 @@ bool server_set_status(SERVER* server, int bit, std::string* errmsg_out = NULL);
* @param errmsg_out Error output * @param errmsg_out Error output
*/ */
bool server_clear_status(SERVER* server, int bit, std::string* errmsg_out = NULL); bool server_clear_status(SERVER* server, int bit, std::string* errmsg_out = NULL);
} }

View File

@ -155,8 +155,8 @@ public:
protected: protected:
SERVICE(const std::string& name, SERVICE(const std::string& name,
const std::string& router_name) const std::string& router_name)
: m_name(name) /** Service name. */ : m_name(name)
, m_router_name(router_name) /** Router module. */ , m_router_name(router_name)
{ {
} }

View File

@ -312,7 +312,8 @@ template<typename T>
class EqualPointees : public std::unary_function<T, bool> class EqualPointees : public std::unary_function<T, bool>
{ {
public: public:
EqualPointees(const T& lhs) : m_ppLhs(&lhs) EqualPointees(const T& lhs)
: m_ppLhs(&lhs)
{ {
} }
bool operator()(const T& pRhs) bool operator()(const T& pRhs)

View File

@ -26,23 +26,23 @@ static const MXS_ENUM_VALUE mxs_monitor_event_default_enum = {"all", ~0ULL};
static const MXS_ENUM_VALUE mxs_monitor_event_enum_values[] = static const MXS_ENUM_VALUE mxs_monitor_event_enum_values[] =
{ {
mxs_monitor_event_default_enum, mxs_monitor_event_default_enum,
{"master_down", MASTER_DOWN_EVENT}, {"master_down", MASTER_DOWN_EVENT },
{"master_up", MASTER_UP_EVENT}, {"master_up", MASTER_UP_EVENT },
{"slave_down", SLAVE_DOWN_EVENT}, {"slave_down", SLAVE_DOWN_EVENT },
{"slave_up", SLAVE_UP_EVENT}, {"slave_up", SLAVE_UP_EVENT },
{"server_down", SERVER_DOWN_EVENT}, {"server_down", SERVER_DOWN_EVENT },
{"server_up", SERVER_UP_EVENT}, {"server_up", SERVER_UP_EVENT },
{"synced_down", SYNCED_DOWN_EVENT}, {"synced_down", SYNCED_DOWN_EVENT },
{"synced_up", SYNCED_UP_EVENT}, {"synced_up", SYNCED_UP_EVENT },
{"donor_down", DONOR_DOWN_EVENT}, {"donor_down", DONOR_DOWN_EVENT },
{"donor_up", DONOR_UP_EVENT}, {"donor_up", DONOR_UP_EVENT },
{"lost_master", LOST_MASTER_EVENT}, {"lost_master", LOST_MASTER_EVENT },
{"lost_slave", LOST_SLAVE_EVENT}, {"lost_slave", LOST_SLAVE_EVENT },
{"lost_synced", LOST_SYNCED_EVENT}, {"lost_synced", LOST_SYNCED_EVENT },
{"lost_donor", LOST_DONOR_EVENT}, {"lost_donor", LOST_DONOR_EVENT },
{"new_master", NEW_MASTER_EVENT}, {"new_master", NEW_MASTER_EVENT },
{"new_slave", NEW_SLAVE_EVENT}, {"new_slave", NEW_SLAVE_EVENT },
{"new_synced", NEW_SYNCED_EVENT}, {"new_synced", NEW_SYNCED_EVENT },
{"new_donor", NEW_DONOR_EVENT}, {"new_donor", NEW_DONOR_EVENT },
{NULL} {NULL}
}; };

View File

@ -109,7 +109,7 @@ public:
mutable std::mutex lock; mutable std::mutex lock;
// TODO: Make this private. // TODO: Make this private.
mxs::Monitor* m_monitor { nullptr }; /**< A possibly associated monitor */ mxs::Monitor* m_monitor {nullptr}; /**< A possibly associated monitor */
bool uses_cluster() const bool uses_cluster() const
{ {

View File

@ -1229,7 +1229,7 @@ void Session::dump_statements() const
const QueryInfo& info = *i; const QueryInfo& info = *i;
GWBUF* pBuffer = info.query().get(); GWBUF* pBuffer = info.query().get();
timespec ts = info.time_completed(); timespec ts = info.time_completed();
struct tm *tm = localtime(&ts.tv_sec); struct tm* tm = localtime(&ts.tv_sec);
char timestamp[20]; char timestamp[20];
strftime(timestamp, 20, "%Y-%m-%d %H:%M:%S", tm); strftime(timestamp, 20, "%Y-%m-%d %H:%M:%S", tm);

View File

@ -44,7 +44,7 @@ int test_validity()
{"p7", MXS_MODULE_PARAM_SERVICE, "my-service" }, {"p7", MXS_MODULE_PARAM_SERVICE, "my-service" },
{"p8", MXS_MODULE_PARAM_ENUM, "a", MXS_MODULE_OPT_ENUM_UNIQUE, enum_values}, {"p8", MXS_MODULE_PARAM_ENUM, "a", MXS_MODULE_OPT_ENUM_UNIQUE, enum_values},
{"p9", MXS_MODULE_PARAM_DURATION, "4711s" }, {"p9", MXS_MODULE_PARAM_DURATION, "4711s" },
{"p10", MXS_MODULE_PARAM_DURATION, "4711s", MXS_MODULE_OPT_DURATION_S }, {"p10", MXS_MODULE_PARAM_DURATION, "4711s", MXS_MODULE_OPT_DURATION_S},
{MXS_END_MODULE_PARAMS} {MXS_END_MODULE_PARAMS}
}; };

View File

@ -22,13 +22,13 @@
using namespace std; using namespace std;
inline ostream& operator << (ostream& out, const std::chrono::seconds& x) inline ostream& operator<<(ostream& out, const std::chrono::seconds& x)
{ {
out << x.count(); out << x.count();
return out; return out;
} }
inline ostream& operator << (ostream& out, const std::chrono::milliseconds& x) inline ostream& operator<<(ostream& out, const std::chrono::milliseconds& x)
{ {
out << x.count(); out << x.count();
return out; return out;
@ -37,17 +37,17 @@ inline ostream& operator << (ostream& out, const std::chrono::milliseconds& x)
config::Specification specification("test_module", config::Specification::FILTER); config::Specification specification("test_module", config::Specification::FILTER);
config::ParamBool config::ParamBool
param_bool(&specification, param_bool(&specification,
"boolean_parameter", "boolean_parameter",
"Specifies whether something is enabled."); "Specifies whether something is enabled.");
config::ParamCount config::ParamCount
param_count(&specification, param_count(&specification,
"count_parameter", "count_parameter",
"Specifies the cardinality of something."); "Specifies the cardinality of something.");
config::ParamInteger config::ParamInteger
param_integer(&specification, param_integer(&specification,
"integer_parameter", "integer_parameter",
"Specifies a number."); "Specifies a number.");
@ -73,24 +73,24 @@ config::ParamEnum<Enum>
param_enum(&specification, param_enum(&specification,
"enum_parameter", "enum_parameter",
"Specifies a range of values.", "Specifies a range of values.",
{ {
{ ENUM_ONE, "one" }, {ENUM_ONE, "one"},
{ ENUM_TWO, "two" } {ENUM_TWO, "two"}
}); });
config::ParamPath config::ParamPath
param_path(&specification, param_path(&specification,
"path_parameter", "path_parameter",
"Specifies the path of something.", "Specifies the path of something.",
config::ParamPath::F); config::ParamPath::F);
config::ParamSize config::ParamSize
param_size(&specification, param_size(&specification,
"size_parameter", "size_parameter",
"Specifies the size of something."); "Specifies the size of something.");
config::ParamString config::ParamString
param_string(&specification, param_string(&specification,
"string_parameter", "string_parameter",
"Specifies the name of something."); "Specifies the name of something.");
@ -102,7 +102,7 @@ struct TestEntry
T value; T value;
}; };
#define elements_in_array(x) (sizeof(x)/sizeof(x[0])) #define elements_in_array(x) (sizeof(x) / sizeof(x[0]))
template<class T> template<class T>
int test(T& value, const TestEntry<typename T::value_type>* pEntries, int nEntries) int test(T& value, const TestEntry<typename T::value_type>* pEntries, int nEntries)
@ -151,17 +151,17 @@ int test_bool(config::Bool& value)
{ {
static const TestEntry<config::Bool::value_type> entries[] = static const TestEntry<config::Bool::value_type> entries[] =
{ {
{ "1", true, true }, {"1", true, true },
{ "0", true, false }, {"0", true, false},
{ "true", true, true }, {"true", true, true },
{ "false", true, false }, {"false", true, false},
{ "on", true, true }, {"on", true, true },
{ "off", true, false }, {"off", true, false},
{ "2", false }, {"2", false},
{ "truth", false }, {"truth", false},
{ "%&", false }, {"%&", false},
{ "-1", false }, {"-1", false},
}; };
return test(value, entries, elements_in_array(entries)); return test(value, entries, elements_in_array(entries));
@ -171,13 +171,13 @@ int test_count(config::Count& value)
{ {
static const TestEntry<config::Count::value_type> entries[] = static const TestEntry<config::Count::value_type> entries[] =
{ {
{ "1", true, 1 }, {"1", true, 1 },
{ "9999", true, 9999 }, {"9999", true, 9999},
{ "0", true, 0 }, {"0", true, 0 },
{ "0x45", false }, {"0x45", false},
{ "blah", false }, {"blah", false},
{ "-1", false }, {"-1", false},
}; };
return test(value, entries, elements_in_array(entries)); return test(value, entries, elements_in_array(entries));
@ -187,16 +187,16 @@ int test_duration(config::Duration<std::chrono::seconds>& value)
{ {
static const TestEntry<config::Duration<std::chrono::seconds>::value_type> entries[] = static const TestEntry<config::Duration<std::chrono::seconds>::value_type> entries[] =
{ {
{ "1", true, std::chrono::seconds { 1 } }, {"1", true, std::chrono::seconds {1 }},
{ "1ms", true, std::chrono::seconds { 0 } }, {"1ms", true, std::chrono::seconds {0 }},
{ "1s", true, std::chrono::seconds { 1 } }, {"1s", true, std::chrono::seconds {1 }},
{ "1m", true, std::chrono::seconds { 60 } }, {"1m", true, std::chrono::seconds {60 }},
{ "1h", true, std::chrono::seconds { 3600 } }, {"1h", true, std::chrono::seconds {3600}},
{ "1x", false }, {"1x", false},
{ "a", false }, {"a", false},
{ "-", false }, {"-", false},
{ "second", false } {"second", false}
}; };
return test(value, entries, elements_in_array(entries)); return test(value, entries, elements_in_array(entries));
@ -206,16 +206,16 @@ int test_duration(config::Duration<std::chrono::milliseconds>& value)
{ {
static const TestEntry<config::Duration<std::chrono::milliseconds>::value_type> entries[] = static const TestEntry<config::Duration<std::chrono::milliseconds>::value_type> entries[] =
{ {
{ "1", true, std::chrono::milliseconds { 1 } }, {"1", true, std::chrono::milliseconds {1 }},
{ "1ms", true, std::chrono::milliseconds { 1 } }, {"1ms", true, std::chrono::milliseconds {1 }},
{ "1s", true, std::chrono::milliseconds { 1000 } }, {"1s", true, std::chrono::milliseconds {1000 }},
{ "1m", true, std::chrono::milliseconds { 60000 } }, {"1m", true, std::chrono::milliseconds {60000 }},
{ "1h", true, std::chrono::milliseconds { 3600000 } }, {"1h", true, std::chrono::milliseconds {3600000}},
{ "1x", false }, {"1x", false},
{ "a", false }, {"a", false},
{ "-", false }, {"-", false},
{ "second", false } {"second", false}
}; };
return test(value, entries, elements_in_array(entries)); return test(value, entries, elements_in_array(entries));
@ -225,12 +225,12 @@ int test_enum(config::Enum<Enum>& value)
{ {
static const TestEntry<Enum> entries[] = static const TestEntry<Enum> entries[] =
{ {
{ "one", true, ENUM_ONE }, {"one", true, ENUM_ONE},
{ "two", true, ENUM_TWO }, {"two", true, ENUM_TWO},
{ "blah", false }, {"blah", false},
{ "1", false }, {"1", false},
{ "ones", false } {"ones", false}
}; };
return test(value, entries, elements_in_array(entries)); return test(value, entries, elements_in_array(entries));
@ -244,7 +244,7 @@ int test_path(config::Path& value)
static const TestEntry<config::Path::value_type> entries[] = static const TestEntry<config::Path::value_type> entries[] =
{ {
{strpath, true, strpath}, {strpath, true, strpath},
{"/tmp", true, "/tmp"}, {"/tmp", true, "/tmp" },
{"non-existent", false} {"non-existent", false}
}; };
@ -256,11 +256,11 @@ int test_size(config::Size& value)
{ {
static const TestEntry<config::Size::value_type> entries[] = static const TestEntry<config::Size::value_type> entries[] =
{ {
{ "0", true, 0 }, {"0", true, 0 },
{ "100", true, 100 }, {"100", true, 100},
{ "-100", false }, {"-100", false},
{ "0x100", false }, {"0x100", false},
}; };
return test(value, entries, elements_in_array(entries)); return test(value, entries, elements_in_array(entries));
@ -270,13 +270,13 @@ int test_string(config::String& value)
{ {
static const TestEntry<config::String::value_type> entries[] = static const TestEntry<config::String::value_type> entries[] =
{ {
{ "blah", true, "blah" }, {"blah", true, "blah" },
{ "\"blah\"", true, "blah" }, {"\"blah\"", true, "blah" },
{ "'blah'", true, "blah" }, {"'blah'", true, "blah" },
{ "123", true, "123" }, {"123", true, "123" },
{ "`blah`", true, "`blah`" }, {"`blah`", true, "`blah`"},
{ "'blah\"", false } {"'blah\"", false}
}; };
return test(value, entries, elements_in_array(entries)); return test(value, entries, elements_in_array(entries));
@ -286,15 +286,15 @@ int test_integer(config::Integer& value)
{ {
static const TestEntry<config::Integer::value_type> entries[] = static const TestEntry<config::Integer::value_type> entries[] =
{ {
{ "0", true, 0 }, {"0", true, 0 },
{ "-1", true, -1 }, {"-1", true, -1 },
{ "1", true, 1 }, {"1", true, 1 },
{ "-2147483648", true, -2147483648 }, {"-2147483648", true, -2147483648},
{ "2147483647", true, 2147483647 }, {"2147483647", true, 2147483647 },
{ "-2147483649", false }, {"-2147483649", false},
{ "2147483648", false }, {"2147483648", false},
{ "0x10" , false }, {"0x10", false},
}; };
return test(value, entries, elements_in_array(entries)); return test(value, entries, elements_in_array(entries));
@ -304,7 +304,7 @@ int main()
{ {
mxb::Log log; mxb::Log log;
for_each(specification.cbegin(), specification.cend(),[](const config::Specification::value_type& p) { for_each(specification.cbegin(), specification.cend(), [](const config::Specification::value_type& p) {
cout << p.second->documentation() << endl; cout << p.second->documentation() << endl;
}); });

View File

@ -42,7 +42,6 @@ namespace
{ {
MXS_CONFIG_PARAMETER empty; MXS_CONFIG_PARAMETER empty;
} }
/** /**
* test1 Filter creation, finding and deletion * test1 Filter creation, finding and deletion

View File

@ -84,7 +84,6 @@ int test()
return rc; return rc;
} }
} }
int main(int argc, char** argv) int main(int argc, char** argv)

View File

@ -72,7 +72,6 @@ int test_checksums()
return 0; return 0;
} }
} }
int main(int argc, char* argv[]) int main(int argc, char* argv[])

View File

@ -40,7 +40,7 @@ void preload_module(const char* name, const char* path, const char* type)
set_libdir(MXS_STRDUP(old_libdir.c_str())); set_libdir(MXS_STRDUP(old_libdir.c_str()));
} }
void init_test_env(char* __attribute((unused)) path = nullptr, uint32_t init_type = QC_INIT_BOTH) void init_test_env(char* __attribute((unused))path = nullptr, uint32_t init_type = QC_INIT_BOTH)
{ {
config_get_global_options()->n_threads = 1; config_get_global_options()->n_threads = 1;

View File

@ -1055,11 +1055,11 @@ nl_constr_init_args = add # ignore/add/remove/force
nl_enum_own_lines = ignore # ignore/add/remove/force nl_enum_own_lines = ignore # ignore/add/remove/force
# Add or remove newline between return type and function name in a function definition. # Add or remove newline between return type and function name in a function definition.
nl_func_type_name = remove # ignore/add/remove/force nl_func_type_name = ignore # ignore/add/remove/force
# Add or remove newline between return type and function name inside a class {} # Add or remove newline between return type and function name inside a class {}
# Uses nl_func_type_name or nl_func_proto_type_name if set to ignore. # Uses nl_func_type_name or nl_func_proto_type_name if set to ignore.
nl_func_type_name_class = remove # ignore/add/remove/force nl_func_type_name_class = ignore # ignore/add/remove/force
# Add or remove newline between class specification and '::' in 'void A::f() { }' # Add or remove newline between class specification and '::' in 'void A::f() { }'
# Only appears in separate member implementation (does not appear with in-line implmementation). # Only appears in separate member implementation (does not appear with in-line implmementation).
@ -1070,7 +1070,7 @@ nl_func_class_scope = remove # ignore/add/remove/force
nl_func_scope_name = remove # ignore/add/remove/force nl_func_scope_name = remove # ignore/add/remove/force
# Add or remove newline between return type and function name in a prototype. # Add or remove newline between return type and function name in a prototype.
nl_func_proto_type_name = remove # ignore/add/remove/force nl_func_proto_type_name = ignore # ignore/add/remove/force
# Add or remove newline between a function name and the opening '(' in the declaration. # Add or remove newline between a function name and the opening '(' in the declaration.
nl_func_paren = remove # ignore/add/remove/force nl_func_paren = remove # ignore/add/remove/force