[DEBUG] correct order of parameter in c++
gcc of rpi3 change it order of usnig parameter ==> I need to check it at the runtime now.
This commit is contained in:
parent
47c69df1e0
commit
3287796807
@ -7,6 +7,34 @@
|
|||||||
#include <zeus/debug.h>
|
#include <zeus/debug.h>
|
||||||
#include <etk/os/FSNode.h>
|
#include <etk/os/FSNode.h>
|
||||||
|
|
||||||
|
static int32_t firstCall(bool& _value) {
|
||||||
|
_value = false;
|
||||||
|
return 51;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t secondCall(bool& _value) {
|
||||||
|
_value = true;
|
||||||
|
return 452;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void unneededCall(int32_t _val1, int32_t _val2) {
|
||||||
|
// Nothing to do ...
|
||||||
|
}
|
||||||
|
|
||||||
|
bool zeus::checkOrderFunctionParameter() {
|
||||||
|
static bool value = false;
|
||||||
|
static bool init = false;
|
||||||
|
if (init == true) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
// use a temporary variable to mermit to have multiple first call and like this permit to not need to initialize it while not really needed
|
||||||
|
bool valueTmp = false;
|
||||||
|
unneededCall(firstCall(valueTmp),secondCall(valueTmp));
|
||||||
|
value = valueTmp;
|
||||||
|
init = true;
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
enum zeus::AbstractFunction::type zeus::AbstractFunction::getType() const {
|
enum zeus::AbstractFunction::type zeus::AbstractFunction::getType() const {
|
||||||
return m_type;
|
return m_type;
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,10 @@
|
|||||||
|
|
||||||
|
|
||||||
namespace zeus {
|
namespace zeus {
|
||||||
|
/**
|
||||||
|
* @bried check if the compilater order the function element call in order or backOrder
|
||||||
|
*/
|
||||||
|
bool checkOrderFunctionParameter();
|
||||||
/**
|
/**
|
||||||
* @brief Interface to store a function and call it after with a @ref zeus::Buffer
|
* @brief Interface to store a function and call it after with a @ref zeus::Buffer
|
||||||
*/
|
*/
|
||||||
|
@ -27,19 +27,16 @@ namespace zeus {
|
|||||||
if (_obj == nullptr) {
|
if (_obj == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if defined(__clang__)
|
ZEUS_RETURN ret;
|
||||||
|
if (zeus::checkOrderFunctionParameter() == true) {
|
||||||
// clang generate a basic warning:
|
// clang generate a basic warning:
|
||||||
// warning: multiple unsequenced modifications to 'idParam' [-Wunsequenced]
|
// warning: multiple unsequenced modifications to 'idParam' [-Wunsequenced]
|
||||||
int32_t idParam = 0;
|
int32_t idParam = 0;
|
||||||
ZEUS_RETURN ret = (*_pointer.*_func)(_obj->getParameter<ZEUS_TYPES>(idParam++)...);
|
ret = (*_pointer.*_func)(_obj->getParameter<ZEUS_TYPES>(idParam++)...);
|
||||||
#elif defined(__GNUC__) || defined(__GNUG__) || defined(_MSC_VER)
|
} else {
|
||||||
int32_t idParam = int32_t(sizeof...(ZEUS_TYPES))-1;
|
int32_t idParam = int32_t(sizeof...(ZEUS_TYPES))-1;
|
||||||
ZEUS_RETURN ret = (*_pointer.*_func)(_obj->getParameter<ZEUS_TYPES>(idParam--)...);
|
ret = (*_pointer.*_func)(_obj->getParameter<ZEUS_TYPES>(idParam--)...);
|
||||||
#else
|
}
|
||||||
#error Must be implemented ...
|
|
||||||
ZEUS_RETURN ret;
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
_interfaceClient->addAsync([=](WebServer* _interface) {
|
_interfaceClient->addAsync([=](WebServer* _interface) {
|
||||||
_interface->answerValue(_obj->getTransactionId(), ret, _obj->getClientId());
|
_interface->answerValue(_obj->getTransactionId(), ret, _obj->getClientId());
|
||||||
return true;
|
return true;
|
||||||
@ -60,18 +57,15 @@ namespace zeus {
|
|||||||
if (_obj == nullptr) {
|
if (_obj == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if defined(__clang__)
|
if (zeus::checkOrderFunctionParameter() == true) {
|
||||||
// clang generate a basic warning:
|
// clang generate a basic warning:
|
||||||
// warning: multiple unsequenced modifications to 'idParam' [-Wunsequenced]
|
// warning: multiple unsequenced modifications to 'idParam' [-Wunsequenced]
|
||||||
int32_t idParam = 0;
|
int32_t idParam = 0;
|
||||||
(*_pointer.*_func)(_obj->getParameter<ZEUS_TYPES>(idParam++)...);
|
(*_pointer.*_func)(_obj->getParameter<ZEUS_TYPES>(idParam++)...);
|
||||||
#elif defined(__GNUC__) || defined(__GNUG__) || defined(_MSC_VER)
|
} else {
|
||||||
int32_t idParam = int32_t(sizeof...(ZEUS_TYPES))-1;
|
int32_t idParam = int32_t(sizeof...(ZEUS_TYPES))-1;
|
||||||
(*_pointer.*_func)(_obj->getParameter<ZEUS_TYPES>(idParam--)...);
|
(*_pointer.*_func)(_obj->getParameter<ZEUS_TYPES>(idParam--)...);
|
||||||
#else
|
}
|
||||||
#error Must be implemented ...
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
_interfaceClient->addAsync([=](WebServer* _interface) {
|
_interfaceClient->addAsync([=](WebServer* _interface) {
|
||||||
_interface->answerVoid(_obj->getTransactionId(), _obj->getClientId());
|
_interface->answerVoid(_obj->getTransactionId(), _obj->getClientId());
|
||||||
return true;
|
return true;
|
||||||
|
@ -22,17 +22,16 @@ namespace zeus {
|
|||||||
if (_obj == nullptr) {
|
if (_obj == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if defined(__clang__)
|
ZEUS_RETURN ret;
|
||||||
|
if (zeus::checkOrderFunctionParameter() == true) {
|
||||||
// clang generate a basic warning:
|
// clang generate a basic warning:
|
||||||
// warning: multiple unsequenced modifications to 'idParam' [-Wunsequenced]
|
// warning: multiple unsequenced modifications to 'idParam' [-Wunsequenced]
|
||||||
int32_t idParam = 0;
|
int32_t idParam = 0;
|
||||||
ZEUS_RETURN ret = _func(_obj->getParameter<ZEUS_TYPES>(idParam++)...);
|
ret = _func(_obj->getParameter<ZEUS_TYPES>(idParam++)...);
|
||||||
#elif defined(__GNUC__) || defined(__GNUG__) || defined(_MSC_VER)
|
} else {
|
||||||
int32_t idParam = int32_t(sizeof...(ZEUS_TYPES))-1;
|
int32_t idParam = int32_t(sizeof...(ZEUS_TYPES))-1;
|
||||||
ZEUS_RETURN ret = _func(_obj->getParameter<ZEUS_TYPES>(idParam--)...);
|
ret = _func(_obj->getParameter<ZEUS_TYPES>(idParam--)...);
|
||||||
#else
|
}
|
||||||
#error Must be implemented ...
|
|
||||||
#endif
|
|
||||||
_interfaceClient->addAsync([=](WebServer* _interface) {
|
_interfaceClient->addAsync([=](WebServer* _interface) {
|
||||||
_interface->answerValue(_obj->getTransactionId(), ret, _obj->getClientId());
|
_interface->answerValue(_obj->getTransactionId(), ret, _obj->getClientId());
|
||||||
return true;
|
return true;
|
||||||
@ -51,17 +50,15 @@ namespace zeus {
|
|||||||
if (_obj == nullptr) {
|
if (_obj == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if defined(__clang__)
|
if (zeus::checkOrderFunctionParameter() == true) {
|
||||||
// clang generate a basic warning:
|
// clang generate a basic warning:
|
||||||
// warning: multiple unsequenced modifications to 'idParam' [-Wunsequenced]
|
// warning: multiple unsequenced modifications to 'idParam' [-Wunsequenced]
|
||||||
int32_t idParam = 0;
|
int32_t idParam = 0;
|
||||||
_func(_obj->getParameter<ZEUS_TYPES>(idParam++)...);
|
_func(_obj->getParameter<ZEUS_TYPES>(idParam++)...);
|
||||||
#elif defined(__GNUC__) || defined(__GNUG__) || defined(_MSC_VER)
|
} else {
|
||||||
int32_t idParam = int32_t(sizeof...(ZEUS_TYPES))-1;
|
int32_t idParam = int32_t(sizeof...(ZEUS_TYPES))-1;
|
||||||
_func(_obj->getParameter<ZEUS_TYPES>(idParam--)...);
|
_func(_obj->getParameter<ZEUS_TYPES>(idParam--)...);
|
||||||
#else
|
}
|
||||||
#error Must be implemented ...
|
|
||||||
#endif
|
|
||||||
_interfaceClient->addAsync([=](WebServer* _interface) {
|
_interfaceClient->addAsync([=](WebServer* _interface) {
|
||||||
_interface->answerVoid(_obj->getTransactionId(), _obj->getClientId());
|
_interface->answerVoid(_obj->getTransactionId(), _obj->getClientId());
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user