summaryrefslogtreecommitdiff
path: root/src/lib/eolian/database_validate.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/eolian/database_validate.c')
-rw-r--r--src/lib/eolian/database_validate.c36
1 files changed, 31 insertions, 5 deletions
diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c
index 7805a40..cdc31b0 100644
--- a/src/lib/eolian/database_validate.c
+++ b/src/lib/eolian/database_validate.c
@@ -73,6 +73,27 @@ _validate_docstr(Eina_Stringshare *str, const Eolian_Object *info, Eina_List **r
73} 73}
74 74
75static Eina_Bool 75static Eina_Bool
76_class_is_legacy(Eolian_Class *klass)
77{
78 return !!strncmp(klass->base.name, "Efl.", strlen("Efl."));
79}
80
81static Eina_Bool
82_validate_beta_usage(Eolian_Class *klass, Eolian_Type *type)
83{
84 if (!klass) return EINA_TRUE;
85 if (_class_is_legacy(klass)) return EINA_TRUE;
86 if (klass->is_beta) return EINA_TRUE;
87
88 if (type->type == EOLIAN_TYPE_CLASS && type->klass->is_beta)
89 {
90 _eo_parser_log(&type->base, "beta class used in public API");
91 return EINA_FALSE;
92 }
93 return EINA_TRUE;
94}
95
96static Eina_Bool
76_validate_doc(Eolian_Documentation *doc) 97_validate_doc(Eolian_Documentation *doc)
77{ 98{
78 if (!doc) 99 if (!doc)
@@ -182,7 +203,7 @@ static const char * const eo_complex_frees[] =
182{ 203{
183 "eina_accessor_free", "eina_array_free", "(void)", /* future */ 204 "eina_accessor_free", "eina_array_free", "(void)", /* future */
184 "eina_iterator_free", "eina_hash_free", 205 "eina_iterator_free", "eina_hash_free",
185 "eina_list_free", "eina_inarray_free", "(void)" 206 "eina_list_free"
186}; 207};
187 208
188static const char *eo_obj_free = "efl_del"; 209static const char *eo_obj_free = "efl_del";
@@ -378,10 +399,10 @@ _validate_function(Validate_State *vals, Eolian_Function *func, Eina_Hash *nhash
378 return EINA_TRUE; 399 return EINA_TRUE;
379 } 400 }
380 401
381 if (func->get_ret_type && !_validate_type(vals, func->get_ret_type)) 402 if (func->get_ret_type && (!_validate_type(vals, func->get_ret_type) || !_validate_beta_usage(func->klass, func->get_ret_type)))
382 return EINA_FALSE; 403 return EINA_FALSE;
383 404
384 if (func->set_ret_type && !_validate_type(vals, func->set_ret_type)) 405 if (func->set_ret_type && (!_validate_type(vals, func->set_ret_type) || !_validate_beta_usage(func->klass, func->set_ret_type)))
385 return EINA_FALSE; 406 return EINA_FALSE;
386 407
387 if (func->get_ret_val && !_validate_expr(func->get_ret_val, 408 if (func->get_ret_val && !_validate_expr(func->get_ret_val,
@@ -394,7 +415,7 @@ _validate_function(Validate_State *vals, Eolian_Function *func, Eina_Hash *nhash
394 415
395#define EOLIAN_PARAMS_VALIDATE(params) \ 416#define EOLIAN_PARAMS_VALIDATE(params) \
396 EINA_LIST_FOREACH(params, l, param) \ 417 EINA_LIST_FOREACH(params, l, param) \
397 if (!_validate_param(vals, param)) \ 418 if (!_validate_param(vals, param) || !_validate_beta_usage(func->klass, param->type)) \
398 return EINA_FALSE; 419 return EINA_FALSE;
399 420
400 EOLIAN_PARAMS_VALIDATE(func->prop_values); 421 EOLIAN_PARAMS_VALIDATE(func->prop_values);
@@ -482,7 +503,7 @@ _validate_event(Validate_State *vals, Eolian_Event *event, Eina_Hash *nhash)
482 return EINA_TRUE; 503 return EINA_TRUE;
483 } 504 }
484 505
485 if (!_validate_type(vals, event->type)) 506 if (!_validate_type(vals, event->type) || !_validate_beta_usage(event->klass, event->type))
486 return EINA_FALSE; 507 return EINA_FALSE;
487 508
488 if (!_validate_doc(event->doc)) 509 if (!_validate_doc(event->doc))
@@ -1159,6 +1180,11 @@ _validate_class(Validate_State *vals, Eolian_Class *cl,
1159 default: 1180 default:
1160 break; 1181 break;
1161 } 1182 }
1183 if (!_class_is_legacy(cl) && !cl->is_beta && cl->parent->is_beta)
1184 {
1185 _eo_parser_log(&cl->base, "non-beta class cannot have beta parent");
1186 return EINA_FALSE;
1187 }
1162 if (!_validate_class(vals, cl->parent, nhash, ehash, chash)) 1188 if (!_validate_class(vals, cl->parent, nhash, ehash, chash))
1163 return EINA_FALSE; 1189 return EINA_FALSE;
1164 } 1190 }