tree schema BUGFIX dep set feature dependency
diff --git a/src/tree_schema.c b/src/tree_schema.c
index 9b309f6..941895d 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -889,9 +889,9 @@
LY_ARRAY_COUNT_TYPE u, v;
ly_bool found;
- if (!lys_has_compiled(mod) || (mod->compiled && !lys_has_recompiled(mod))) {
+ if (LYS_IS_SINGLE_DEP_SET(mod)) {
/* is already in a separate dep set */
- if (!lys_has_groupings(mod)) {
+ if (!lys_has_groupings(mod) && !mod->parsed->features) {
/* break the dep set here, no modules depend on this one */
return LY_SUCCESS;
}
@@ -926,8 +926,8 @@
imports = mod->parsed->includes[v].submodule->imports;
LY_ARRAY_FOR(imports, u) {
mod2 = imports[u].module;
- if (!lys_has_compiled(mod2) || (mod2->compiled && !lys_has_recompiled(mod2))) {
- if (!lys_has_groupings(mod2)) {
+ if (LYS_IS_SINGLE_DEP_SET(mod2)) {
+ if (!lys_has_groupings(mod2) && !mod2->parsed->features) {
/* break the dep set here, no modules depend on this one */
continue;
}
@@ -991,7 +991,7 @@
while (i < ctx_set->count) {
m = ctx_set->objs[i];
- if (!lys_has_compiled(m) || (m->compiled && !lys_has_recompiled(m))) {
+ if (LYS_IS_SINGLE_DEP_SET(m)) {
/* remove it from the set, we are processing it now */
ly_set_rm_index(ctx_set, i, NULL);
diff --git a/src/tree_schema_internal.h b/src/tree_schema_internal.h
index 9f78dd9..26d1599 100644
--- a/src/tree_schema_internal.h
+++ b/src/tree_schema_internal.h
@@ -929,4 +929,13 @@
*/
ly_bool lys_has_groupings(const struct lys_module *mod);
+/**
+ * @brief Learn whether the module qualifies for a single dep set with only this module or not.
+ *
+ * @param[in] mod Module to examine.
+ * @return Whether it qualifies as a single dep set or not.
+ */
+#define LYS_IS_SINGLE_DEP_SET(mod) \
+ (!(mod)->parsed->features && (!lys_has_compiled(mod) || ((mod)->compiled && !lys_has_recompiled(mod))))
+
#endif /* LY_TREE_SCHEMA_INTERNAL_H_ */