eo: Fix compilation of macro in C++ because of goto
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>
Tue, 25 Oct 2016 14:21:12 +0000 (12:21 -0200)
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>
Tue, 25 Oct 2016 14:23:34 +0000 (12:23 -0200)
Moved variable cross-definition to the top, so no more
cross-definition between goto would happen.

src/lib/eo/Eo.h

index c5b4e75..4ca0713 100644 (file)
@@ -747,13 +747,14 @@ typedef struct _Efl_Object_Call_Cache
 #define EFL_FUNC_COMMON_OP(Obj, Name, DefRet) \
    static EFL_FUNC_TLS Efl_Object_Call_Cache ___cache; /* static 0 by default */ \
    Efl_Object_Op_Call_Data ___call; \
-   if (EINA_UNLIKELY((___cache.op == EFL_NOOP) || \
+   _Eo_##Name##_func _func_;                                            \
+   if (EINA_UNLIKELY((___cache.op == EFL_NOOP) ||                       \
                      (___cache.generation != _efl_object_init_generation))) \
      goto __##Name##_op_create; /* yes a goto - see below */ \
    __##Name##_op_create_done: \
    if (!_efl_object_call_resolve((Eo *) Obj, #Name, &___call, &___cache, \
                                  __FILE__, __LINE__)) return DefRet; \
-   _Eo_##Name##_func _func_ = (_Eo_##Name##_func) ___call.func;
+   _func_ = (_Eo_##Name##_func) ___call.func;
 
 // yes this looks ugly with gotos BUT it moves rare "init" handling code
 // out of the hot path and thus l1 instruction cach prefetch etc. so it