eo2: improve err msg in _eo2_api_op_id_get() and _eo2_call_resolve()

This commit is contained in:
Jérémy Zurcher 2014-01-03 15:54:18 +01:00 committed by Tom Hacohen
parent 914dde776f
commit e41f2804b4
2 changed files with 16 additions and 13 deletions

View File

@ -643,8 +643,8 @@ EAPI extern Eo2_Hook_Call eo2_hook_call_post;
Eo2_Op_Call_Data call; \
static Eo_Op op = EO_NOOP; \
if (op == EO_NOOP) \
op = _eo2_api_op_id_get((void*)Name); \
if (!_eo2_call_resolve(#Name, op, &call)) return DefRet; \
op = _eo2_api_op_id_get((void*) Name, __FILE__, __LINE__); \
if (!_eo2_call_resolve(#Name, op, &call, __FILE__, __LINE__)) return DefRet; \
_Eo2_##Name##_func _func_ = (_Eo2_##Name##_func) call.func; \
// to define an EAPI function
@ -706,10 +706,10 @@ EAPI extern Eo2_Hook_Call eo2_hook_call_post;
#define EO2_OP_SENTINEL { NULL, NULL, 0, EO_OP_TYPE_INVALID, NULL}
// returns the OP id corresponding to the given api_func
EAPI Eo_Op _eo2_api_op_id_get(const void *api_func);
EAPI Eo_Op _eo2_api_op_id_get(const void *api_func, const char *file, int line);
// gets the real function pointer and the object data
EAPI Eina_Bool _eo2_call_resolve(const char *func_name, const Eo_Op op, Eo2_Op_Call_Data *call);
EAPI Eina_Bool _eo2_call_resolve(const char *func_name, const Eo_Op op, Eo2_Op_Call_Data *call, const char *file, int line);
// start of eo2_do barrier, gets the object pointer and ref it, put it on the stask
EAPI Eina_Bool _eo2_do_start(const Eo *obj, const Eo_Class *cur_klass, Eina_Bool is_super, const char *file, const char *func, int line);

View File

@ -440,7 +440,7 @@ _eo2_do_end(const Eo **eo_id EINA_UNUSED)
}
EAPI Eina_Bool
_eo2_call_resolve(const char *func_name, const Eo_Op op, Eo2_Op_Call_Data *call)
_eo2_call_resolve(const char *func_name, const Eo_Op op, Eo2_Op_Call_Data *call, const char *file, int line)
{
Eo2_Stack_Frame *fptr;
const _Eo_Class *klass;
@ -469,7 +469,8 @@ _eo2_call_resolve(const char *func_name, const Eo_Op op, Eo2_Op_Call_Data *call)
if (EINA_UNLIKELY(func == NULL))
{
ERR("you called func '%s' (%d) which is unknown in class '%s'", func_name, op, klass->desc->name);
ERR("in %s:%d: you called func '%s' (%d) which is unknown in class '%s'",
file, line, func_name, op, klass->desc->name);
return EINA_FALSE;
}
@ -502,7 +503,8 @@ _eo2_call_resolve(const char *func_name, const Eo_Op op, Eo2_Op_Call_Data *call)
if (func->src != NULL)
{
ERR("you called a pure virtual func '%s' (%d)", func_name, op);
ERR("in %s:%d: you called a pure virtual func '%s' (%d)",
file, line, func_name, op);
return EINA_FALSE;
}
@ -541,14 +543,14 @@ end:
/* If it's a do_super call. */
if (fptr->cur_klass)
{
ERR("func '%s' (%d) could not be resolved for class '%s' for super of '%s'",
func_name, op, main_klass->desc->name,
ERR("in %s:%d: func '%s' (%d) could not be resolved for class '%s' for super of '%s'",
file, line, func_name, op, main_klass->desc->name,
fptr->cur_klass->desc->name);
}
else
{
ERR("func '%s' (%d) could not be resolved for class '%s'",
func_name, op, main_klass->desc->name);
ERR("in %s:%d: func '%s' (%d) could not be resolved for class '%s'",
file, line, func_name, op, main_klass->desc->name);
}
}
@ -604,7 +606,7 @@ _eo2_api_desc_get(const void *api_func, const _Eo_Class *klass, const _Eo_Class
}
EAPI Eo_Op
_eo2_api_op_id_get(const void *api_func)
_eo2_api_op_id_get(const void *api_func, const char *file, int line)
{
const Eo2_Op_Description *desc;
const _Eo_Class *klass;
@ -620,7 +622,8 @@ _eo2_api_op_id_get(const void *api_func)
if (desc == NULL)
{
ERR("unable to resolve %s api func %p", (class_ref ? "class" : "regular"), api_func);
ERR("in %s:%d: unable to resolve %s api func %p",
file, line, (class_ref ? "class" : "regular"), api_func);
return EO_NOOP;
}