[DEV] try to correct clang and gcc unacordence on the sequening of expending the variadic elements ...

This commit is contained in:
Edouard DUPIN 2016-05-19 23:19:16 +02:00
parent da1afb3771
commit 5342ac68b1
2 changed files with 25 additions and 4 deletions

View File

@ -36,6 +36,7 @@ template<> int64_t convertJsonTo<int64_t>(const ejson::Value& _value) {
return int64_t(_value.toNumber().get());
}
template<> int32_t convertJsonTo<int32_t>(const ejson::Value& _value) {
_value.display();
return int32_t(_value.toNumber().get());
}
template<> int16_t convertJsonTo<int16_t>(const ejson::Value& _value) {

View File

@ -122,8 +122,18 @@ class TypeList: public CmdBase {
return out;
}
// TODO : Check params ...
int32_t idParam = 0;
ejson::Value retVal = convertToJson(m_function(convertJsonTo<JUS_TYPES>(_params[idParam++])...));
// Clang and Gcc does not exapnd variadic template at the same way ...
#if defined(__clang__)
// clang generate a basic warning:
// warning: multiple unsequenced modifications to 'idParam' [-Wunsequenced]
int32_t idParam = 0;
ejson::Value retVal = convertToJson(m_function(convertJsonTo<JUS_TYPES>(_params[idParam++])...));
#elif defined(__GNUC__) || defined(__GNUG__) || defined(_MSC_VER)
int32_t idParam = m_listParamType.size()-1;
ejson::Value retVal = convertToJson(m_function(convertJsonTo<JUS_TYPES>(_params[idParam--])...));
#else
#error Must be implemented ...
#endif
out.add("return", retVal);
return out;
}
@ -161,8 +171,18 @@ class TypeListVoid: public CmdBase {
return out;
}
// TODO : Check params ...
int32_t idParam = m_listParamType.size()-1;
m_function(convertJsonTo<JUS_TYPES>(_params[idParam--])...);
// Clang and Gcc does not exapnd variadic template at the same way ...
#if defined(__clang__)
// clang generate a basic warning:
// warning: multiple unsequenced modifications to 'idParam' [-Wunsequenced]
int32_t idParam = 0;
m_function(convertJsonTo<JUS_TYPES>(_params[idParam++])...);
#elif defined(__GNUC__) || defined(__GNUG__) || defined(_MSC_VER)
int32_t idParam = m_listParamType.size()-1;
m_function(convertJsonTo<JUS_TYPES>(_params[idParam--])...);
#else
#error Must be implemented ...
#endif
out.add("return", ejson::Null());
return out;
}