q66 pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=454e9eb1d9f480583850aaaa6d8ee72045763b28

commit 454e9eb1d9f480583850aaaa6d8ee72045763b28
Author: Daniel Kolesa <d.kol...@samsung.com>
Date:   Fri Nov 30 14:12:15 2018 +0100

    eolian: add optional warning for regular classes in ext list
    
    As per T7240, we intend to disallow multi-class inheritance in Eo
    at some point. In order to achieve that, it is necessary to find
    out which classes still use multi-class inheritance and change
    them accordingly.
    
    Eo multi-class inheritance is not actually multi-class, as doing
    so will simply treat all the other classes as interfaces, which
    is misleading and poor design on its own.
    
    By setting EOLIAN_CLASS_REGULAR_AS_EXT_WARN environment variable,
    Eolian will now warn about such classes, allowing them to be
    fixed.
    
    Closes T7365.
---
 src/lib/eolian/database_validate.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/src/lib/eolian/database_validate.c 
b/src/lib/eolian/database_validate.c
index b44fc1221d..a96e389010 100644
--- a/src/lib/eolian/database_validate.c
+++ b/src/lib/eolian/database_validate.c
@@ -12,6 +12,7 @@ typedef struct _Validate_State
 {
    Eina_Bool warned;
    Eina_Bool event_redef;
+   Eina_Bool ext_regular;
 } Validate_State;
 
 static Eina_Bool
@@ -848,6 +849,23 @@ _validate_class(Validate_State *vals, Eolian_Class *cl,
 
    EINA_LIST_FOREACH(cl->extends, l, icl)
      {
+        if (!valid && vals->ext_regular) switch (icl->type)
+          {
+           case EOLIAN_CLASS_REGULAR:
+           case EOLIAN_CLASS_ABSTRACT:
+             /* regular class in extensions list, forbidden */
+             {
+                char buf[PATH_MAX];
+                snprintf(buf, sizeof(buf), "regular classes ('%s') cannot 
appear in extensions list of '%s'",
+                         icl->base.name, cl->base.name);
+                _obj_error(&cl->base, buf);
+                vals->warned = EINA_TRUE;
+                break;
+             }
+           default:
+             /* it's ok, interfaces are allowed */
+             break;
+          }
         if (!_validate_class(vals, icl, nhash, ehash, chash))
           return EINA_FALSE;
      }
@@ -928,7 +946,8 @@ database_validate(const Eolian_Unit *src)
 
    Validate_State vals = {
       EINA_FALSE,
-      !!getenv("EOLIAN_EVENT_REDEF_WARN")
+      !!getenv("EOLIAN_EVENT_REDEF_WARN"),
+      !!getenv("EOLIAN_CLASS_REGULAR_AS_EXT_WARN")
    };
 
    /* do an initial pass to refill inherits */

-- 


Reply via email to