yanglint OPTIMIZE setting LY_CTX_SET_PRIV_PARSED
Flag causes recompilation, so some models are unnecessarily
compiled twice. The flag should be set as soon as possible.
diff --git a/tools/lint/main_ni.c b/tools/lint/main_ni.c
index 0d590b6..76b6fe0 100644
--- a/tools/lint/main_ni.c
+++ b/tools/lint/main_ni.c
@@ -657,6 +657,11 @@
}
}
+ if (c->schema_out_format == LYS_OUT_TREE) {
+ /* print tree from lysc_nodes */
+ ly_ctx_set_options(c->ctx, LY_CTX_SET_PRIV_PARSED);
+ }
+
/* process input files provided as standalone command line arguments,
* schema modules are parsed and inserted into the context,
* data files are just checked and prepared into internal structures for further processing */
@@ -665,11 +670,6 @@
return ret;
}
- if (c->schema_out_format == LYS_OUT_TREE) {
- /* print tree from lysc_nodes */
- ly_ctx_set_options(c->ctx, LY_CTX_SET_PRIV_PARSED);
- }
-
/* the second batch of checks */
if (c->schema_print_options && !c->schema_out_format) {
YLMSG_W("Schema printer options specified, but the schema output format is missing.\n");