summaryrefslogtreecommitdiff
path: root/legacy/eobj
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2012-07-26 12:21:01 +0000
committerTom Hacohen <tom@stosb.com>2012-07-26 12:21:01 +0000
commitd368088e597b1ffd9ac411ee203f1528f0340f99 (patch)
tree8e0c909dd2851acf5f2db2915180873d1760d324 /legacy/eobj
parent6c9804fba90ee9f8d4d80a6f20526d08c4dec4bc (diff)
Eo: Add a warning when trying to override a function that was already set for a class.
SVN revision: 74436
Diffstat (limited to 'legacy/eobj')
-rw-r--r--legacy/eobj/src/lib/eo.c10
-rw-r--r--legacy/eobj/src/tests/eo_suite/eo_test_general.c1
2 files changed, 11 insertions, 0 deletions
diff --git a/legacy/eobj/src/lib/eo.c b/legacy/eobj/src/lib/eo.c
index 2dc7a2ecfe..ded5b32627 100644
--- a/legacy/eobj/src/lib/eo.c
+++ b/legacy/eobj/src/lib/eo.c
@@ -22,6 +22,8 @@ static void _eo_condtor_reset(Eo *obj);
22static inline void *_eo_data_get(const Eo *obj, const Eo_Class *klass); 22static inline void *_eo_data_get(const Eo *obj, const Eo_Class *klass);
23static inline Eo *_eo_ref(Eo *obj); 23static inline Eo *_eo_ref(Eo *obj);
24static inline void _eo_unref(Eo *obj); 24static inline void _eo_unref(Eo *obj);
25static const Eo_Class *_eo_op_class_get(Eo_Op op);
26static const Eo_Op_Description *_eo_op_id_desc_get(Eo_Op op);
25 27
26typedef struct 28typedef struct
27{ 29{
@@ -165,6 +167,14 @@ _dich_func_set(Eo_Class *klass, Eo_Op op, eo_op_func_type func)
165 size_t idx1 = DICH_CHAIN1(op); 167 size_t idx1 = DICH_CHAIN1(op);
166 Dich_Chain1 *chain1 = &klass->chain[idx1]; 168 Dich_Chain1 *chain1 = &klass->chain[idx1];
167 _dich_chain_alloc(chain1); 169 _dich_chain_alloc(chain1);
170 if (chain1->funcs[DICH_CHAIN_LAST(op)].src == klass)
171 {
172 const Eo_Class *op_kls = _eo_op_class_get(op);
173 const Eo_Op_Description *op_desc = _eo_op_id_desc_get(op);
174 WRN("Already set function for op %x (%s:%s). Overriding with func %p",
175 op, op_kls->desc->name, op_desc->name, func);
176 }
177
168 chain1->funcs[DICH_CHAIN_LAST(op)].func = func; 178 chain1->funcs[DICH_CHAIN_LAST(op)].func = func;
169 chain1->funcs[DICH_CHAIN_LAST(op)].src = klass; 179 chain1->funcs[DICH_CHAIN_LAST(op)].src = klass;
170} 180}
diff --git a/legacy/eobj/src/tests/eo_suite/eo_test_general.c b/legacy/eobj/src/tests/eo_suite/eo_test_general.c
index f6d872f705..12791a04f3 100644
--- a/legacy/eobj/src/tests/eo_suite/eo_test_general.c
+++ b/legacy/eobj/src/tests/eo_suite/eo_test_general.c
@@ -224,6 +224,7 @@ _man_class_constructor(Eo_Class *klass)
224 const Eo_Op_Func_Description func_desc[] = { 224 const Eo_Op_Func_Description func_desc[] = {
225 EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _man_con), 225 EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _man_con),
226 EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _man_des), 226 EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _man_des),
227 EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _man_des),
227 EO_OP_FUNC_SENTINEL 228 EO_OP_FUNC_SENTINEL
228 }; 229 };
229 230