summaryrefslogtreecommitdiff
path: root/src/lib/eolian
diff options
context:
space:
mode:
authorXavi Artigas <xavierartigas@yahoo.es>2019-09-30 19:48:19 +0200
committerXavi Artigas <xavierartigas@yahoo.es>2019-09-30 19:48:19 +0200
commit835e230f2fefa14cdfae7af84dc5afbc40bca985 (patch)
treeac9862256197c9c155d34275dd0cf7ae16ea057a /src/lib/eolian
parent2946cb3c325f27d77354ac1b83b614e3a1d9e1d5 (diff)
Revert "eolian: disallow missing docs for stable API where necessary"
I'm afraid but this breaks the mono bindings too close to a release. This also fixes the missing docs errors by adding a lot of inconsistent placeholder text ("No description supplied.", "TBD") which will make finding them later on more complicated. I was the one that asked for this feature but it is not critical at this point, so I suggest we explore some refinements (like T8291) before landing this patch in its current state. This reverts commit 2946cb3c325f27d77354ac1b83b614e3a1d9e1d5.
Diffstat (limited to 'src/lib/eolian')
-rw-r--r--src/lib/eolian/database_validate.c65
1 files changed, 23 insertions, 42 deletions
diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c
index 20417f7f4a..c1de7ec11a 100644
--- a/src/lib/eolian/database_validate.c
+++ b/src/lib/eolian/database_validate.c
@@ -41,23 +41,12 @@ _validate(Eolian_Object *obj)
41 eolian_state_log_obj((_base)->unit->state, (_base), __VA_ARGS__) 41 eolian_state_log_obj((_base)->unit->state, (_base), __VA_ARGS__)
42 42
43static Eina_Bool 43static Eina_Bool
44_validate_docstr(Eina_Stringshare *str, const Eolian_Object *info, Eina_List **rdbg, Eina_Bool sum) 44_validate_docstr(Eina_Stringshare *str, const Eolian_Object *info, Eina_List **rdbg)
45{ 45{
46 Eina_List *pl = NULL; 46 if (!str || !str[0]) return EINA_TRUE;
47 if (str && str[0])
48 pl = eolian_documentation_string_split(str);
49 if (!pl)
50 {
51 if (sum)
52 {
53 _eo_parser_log(info, "empty documentation");
54 return EINA_FALSE;
55 }
56 /* description can be empty, summary-only line */
57 return EINA_TRUE;
58 }
59 47
60 Eina_Bool ret = EINA_TRUE; 48 Eina_Bool ret = EINA_TRUE;
49 Eina_List *pl = eolian_documentation_string_split(str);
61 char *par; 50 char *par;
62 EINA_LIST_FREE(pl, par) 51 EINA_LIST_FREE(pl, par)
63 { 52 {
@@ -99,23 +88,16 @@ _validate_docstr(Eina_Stringshare *str, const Eolian_Object *info, Eina_List **r
99} 88}
100 89
101static Eina_Bool 90static Eina_Bool
102_validate_doc(Validate_State *vals, Eolian_Documentation *doc, 91_validate_doc(Eolian_Documentation *doc)
103 const Eolian_Object *obj)
104{ 92{
105 if (!doc) 93 if (!doc)
106 {
107 if (!obj) return EINA_TRUE;
108 if (!vals->stable) return EINA_TRUE;
109 _eo_parser_log(obj, "missing documentation");
110 return EINA_FALSE;
111 }
112 return EINA_TRUE; 94 return EINA_TRUE;
113 95
114 Eina_List *rdbg = doc->ref_dbg; 96 Eina_List *rdbg = doc->ref_dbg;
115 97
116 if (!_validate_docstr(doc->summary, &doc->base, &rdbg, EINA_TRUE)) 98 if (!_validate_docstr(doc->summary, &doc->base, &rdbg))
117 return EINA_FALSE; 99 return EINA_FALSE;
118 if (!_validate_docstr(doc->description, &doc->base, &rdbg, EINA_FALSE)) 100 if (!_validate_docstr(doc->description, &doc->base, &rdbg))
119 return EINA_FALSE; 101 return EINA_FALSE;
120 102
121 return _validate(&doc->base); 103 return _validate(&doc->base);
@@ -150,7 +132,7 @@ _sf_map_cb(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED,
150 if (!sc->succ) 132 if (!sc->succ)
151 return EINA_FALSE; 133 return EINA_FALSE;
152 134
153 sc->succ = _validate_doc(sc->vals, sf->doc, NULL); 135 sc->succ = _validate_doc(sf->doc);
154 136
155 return sc->succ; 137 return sc->succ;
156} 138}
@@ -167,7 +149,7 @@ _ef_map_cb(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED,
167 if (!sc->succ) 149 if (!sc->succ)
168 return EINA_FALSE; 150 return EINA_FALSE;
169 151
170 sc->succ = _validate_doc(sc->vals, ef->doc, NULL); 152 sc->succ = _validate_doc(ef->doc);
171 153
172 return sc->succ; 154 return sc->succ;
173} 155}
@@ -178,12 +160,12 @@ _validate_typedecl(Validate_State *vals, Eolian_Typedecl *tp)
178 if (tp->base.validated) 160 if (tp->base.validated)
179 return EINA_TRUE; 161 return EINA_TRUE;
180 162
163 if (!_validate_doc(tp->doc))
164 return EINA_FALSE;
165
181 /* for the time being assume all typedecls are beta unless overridden */ 166 /* for the time being assume all typedecls are beta unless overridden */
182 Eina_Bool was_stable = _set_stable(vals, !tp->base.is_beta); 167 Eina_Bool was_stable = _set_stable(vals, !tp->base.is_beta);
183 168
184 if (!_validate_doc(vals, tp->doc, &tp->base))
185 return EINA_FALSE;
186
187 switch (tp->type) 169 switch (tp->type)
188 { 170 {
189 case EOLIAN_TYPEDECL_ALIAS: 171 case EOLIAN_TYPEDECL_ALIAS:
@@ -489,7 +471,7 @@ _validate_param(Validate_State *vals, Eolian_Function_Parameter *param)
489 if (param->value && !_validate_expr(param->value, param->type, 0, param->by_ref)) 471 if (param->value && !_validate_expr(param->value, param->type, 0, param->by_ref))
490 return EINA_FALSE; 472 return EINA_FALSE;
491 473
492 if (!_validate_doc(vals, param->doc, NULL)) 474 if (!_validate_doc(param->doc))
493 return EINA_FALSE; 475 return EINA_FALSE;
494 476
495 return _validate(&param->base); 477 return _validate(&param->base);
@@ -557,9 +539,9 @@ _validate_function(Validate_State *vals, Eolian_Function *func, Eina_Hash *nhash
557 539
558#undef EOLIAN_PARAMS_VALIDATE 540#undef EOLIAN_PARAMS_VALIDATE
559 541
560 if (!_validate_doc(vals, func->get_return_doc, NULL)) 542 if (!_validate_doc(func->get_return_doc))
561 return _reset_stable(vals, was_stable, EINA_FALSE); 543 return _reset_stable(vals, was_stable, EINA_FALSE);
562 if (!_validate_doc(vals, func->set_return_doc, NULL)) 544 if (!_validate_doc(func->set_return_doc))
563 return _reset_stable(vals, was_stable, EINA_FALSE); 545 return _reset_stable(vals, was_stable, EINA_FALSE);
564 546
565 /* just for now, when dups become errors there will be no need to check */ 547 /* just for now, when dups become errors there will be no need to check */
@@ -592,7 +574,7 @@ _validate_part(Validate_State *vals, Eolian_Part *part, Eina_Hash *phash)
592 574
593 Eina_Bool was_stable = _set_stable(vals, !part->base.is_beta && vals->stable); 575 Eina_Bool was_stable = _set_stable(vals, !part->base.is_beta && vals->stable);
594 576
595 if (!_validate_doc(vals, part->doc, NULL)) 577 if (!_validate_doc(part->doc))
596 return _reset_stable(vals, was_stable, EINA_FALSE); 578 return _reset_stable(vals, was_stable, EINA_FALSE);
597 579
598 /* switch the class name for class */ 580 /* switch the class name for class */
@@ -711,7 +693,7 @@ _validate_event(Validate_State *vals, Eolian_Event *event, Eina_Hash *nhash)
711 } 693 }
712 } 694 }
713 695
714 if (!_validate_doc(vals, event->doc, &event->base)) 696 if (!_validate_doc(event->doc))
715 return _reset_stable(vals, was_stable, EINA_FALSE); 697 return _reset_stable(vals, was_stable, EINA_FALSE);
716 698
717 eina_hash_set(nhash, &event->base.name, &event->base); 699 eina_hash_set(nhash, &event->base.name, &event->base);
@@ -1364,17 +1346,16 @@ _db_fill_inherits(Validate_State *vals, Eolian_Class *cl, Eina_Hash *fhash,
1364} 1346}
1365 1347
1366static Eina_Bool 1348static Eina_Bool
1367_validate_implement(Validate_State *vals, Eolian_Implement *impl) 1349_validate_implement(Eolian_Implement *impl)
1368{ 1350{
1369 if (impl->base.validated) 1351 if (impl->base.validated)
1370 return EINA_TRUE; 1352 return EINA_TRUE;
1371 1353
1372 if (!_validate_doc(vals, impl->common_doc, (impl->implklass == impl->klass) 1354 if (!_validate_doc(impl->common_doc))
1373 ? &impl->foo_id->base : NULL))
1374 return EINA_FALSE; 1355 return EINA_FALSE;
1375 if (!_validate_doc(vals, impl->get_doc, NULL)) 1356 if (!_validate_doc(impl->get_doc))
1376 return EINA_FALSE; 1357 return EINA_FALSE;
1377 if (!_validate_doc(vals, impl->set_doc, NULL)) 1358 if (!_validate_doc(impl->set_doc))
1378 return EINA_FALSE; 1359 return EINA_FALSE;
1379 1360
1380 return _validate(&impl->base); 1361 return _validate(&impl->base);
@@ -1522,7 +1503,7 @@ _validate_class(Validate_State *vals, Eolian_Class *cl,
1522 return EINA_FALSE; 1503 return EINA_FALSE;
1523 1504
1524 EINA_LIST_FOREACH(cl->implements, l, impl) 1505 EINA_LIST_FOREACH(cl->implements, l, impl)
1525 if (!_validate_implement(vals, impl)) 1506 if (!_validate_implement(impl))
1526 return EINA_FALSE; 1507 return EINA_FALSE;
1527 1508
1528 /* all the checks that need to be done every time are performed now */ 1509 /* all the checks that need to be done every time are performed now */
@@ -1533,7 +1514,7 @@ _validate_class(Validate_State *vals, Eolian_Class *cl,
1533 return EINA_TRUE; 1514 return EINA_TRUE;
1534 } 1515 }
1535 1516
1536 if (!_validate_doc(vals, cl->doc, &cl->base)) 1517 if (!_validate_doc(cl->doc))
1537 return EINA_FALSE; 1518 return EINA_FALSE;
1538 1519
1539 /* also done */ 1520 /* also done */
@@ -1556,7 +1537,7 @@ _validate_constant(Validate_State *vals, Eolian_Constant *var)
1556 if (!_validate_expr(var->value, var->base_type, 0, EINA_FALSE)) 1537 if (!_validate_expr(var->value, var->base_type, 0, EINA_FALSE))
1557 return _reset_stable(vals, was_stable, EINA_FALSE); 1538 return _reset_stable(vals, was_stable, EINA_FALSE);
1558 1539
1559 if (!_validate_doc(vals, var->doc, &var->base)) 1540 if (!_validate_doc(var->doc))
1560 return _reset_stable(vals, was_stable, EINA_FALSE); 1541 return _reset_stable(vals, was_stable, EINA_FALSE);
1561 1542
1562 _reset_stable(vals, was_stable, EINA_TRUE); 1543 _reset_stable(vals, was_stable, EINA_TRUE);