schema compile CHANGE remove possibly false-positive warnings
Changed to verbose messages.
diff --git a/src/schema_compile_node.c b/src/schema_compile_node.c
index d34b46d..c022261 100644
--- a/src/schema_compile_node.c
+++ b/src/schema_compile_node.c
@@ -2420,7 +2420,7 @@
/* list ordering */
if (node->nodetype & (LYS_LIST | LYS_LEAFLIST)) {
if ((node->flags & (LYS_CONFIG_R | LYS_IS_OUTPUT | LYS_IS_NOTIF)) && (node->flags & LYS_ORDBY_MASK)) {
- LOGWRN(ctx->ctx, "The ordered-by statement is ignored in lists representing %s (%s).",
+ LOGVRB("The ordered-by statement is ignored in lists representing %s (%s).",
(node->flags & LYS_IS_OUTPUT) ? "RPC/action output parameters" :
(ctx->options & LYS_IS_NOTIF) ? "notification content" : "state data", ctx->path);
node->flags &= ~LYS_ORDBY_MASK;
@@ -3363,7 +3363,7 @@
}
if (any->flags & LYS_CONFIG_W) {
- LOGWRN(ctx->ctx, "Use of %s to define configuration data is not recommended. %s",
+ LOGVRB("Use of %s to define configuration data is not recommended. %s",
ly_stmt2str(any->nodetype == LYS_ANYDATA ? LY_STMT_ANYDATA : LY_STMT_ANYXML), ctx->path);
}
done:
diff --git a/src/xpath.c b/src/xpath.c
index adbe1a4..a641e53 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -3395,17 +3395,21 @@
LY_ARRAY_COUNT_TYPE u;
if (options & LYXP_SCNODE_ALL) {
- if ((args[0]->type != LYXP_SET_SCNODE_SET) || !(sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
+ if (args[0]->type != LYXP_SET_SCNODE_SET) {
LOGWRN(set->ctx, "Argument #1 of %s not a node-set as expected.", __func__);
- } else if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
- LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
- } else if (!warn_is_specific_type(sleaf->type, LY_TYPE_BITS)) {
- LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of type \"bits\".", __func__, sleaf->name);
+ } else if ((sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
+ if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
+ LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype),
+ sleaf->name);
+ } else if (!warn_is_specific_type(sleaf->type, LY_TYPE_BITS)) {
+ LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of type \"bits\".", __func__, sleaf->name);
+ }
}
if ((args[1]->type == LYXP_SET_SCNODE_SET) && (sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[1]))) {
if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
- LOGWRN(set->ctx, "Argument #2 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
+ LOGWRN(set->ctx, "Argument #2 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype),
+ sleaf->name);
} else if (!warn_is_string_type(sleaf->type)) {
LOGWRN(set->ctx, "Argument #2 of %s is node \"%s\", not of string-type.", __func__, sleaf->name);
}
@@ -3483,12 +3487,15 @@
LY_ERR rc = LY_SUCCESS;
if (options & LYXP_SCNODE_ALL) {
- if ((args[0]->type != LYXP_SET_SCNODE_SET) || !(sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
+ if (args[0]->type != LYXP_SET_SCNODE_SET) {
LOGWRN(set->ctx, "Argument #1 of %s not a node-set as expected.", __func__);
- } else if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
- LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
- } else if (!warn_is_specific_type(sleaf->type, LY_TYPE_DEC64)) {
- LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of type \"decimal64\".", __func__, sleaf->name);
+ } else if ((sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
+ if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
+ LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype),
+ sleaf->name);
+ } else if (!warn_is_specific_type(sleaf->type, LY_TYPE_DEC64)) {
+ LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of type \"decimal64\".", __func__, sleaf->name);
+ }
}
set_scnode_clear_ctx(set);
return rc;
@@ -3580,7 +3587,8 @@
if (options & LYXP_SCNODE_ALL) {
if ((args[0]->type == LYXP_SET_SCNODE_SET) && (sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
- LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
+ LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype),
+ sleaf->name);
} else if (!warn_is_string_type(sleaf->type)) {
LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of string-type.", __func__, sleaf->name);
}
@@ -3588,7 +3596,8 @@
if ((args[1]->type == LYXP_SET_SCNODE_SET) && (sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[1]))) {
if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
- LOGWRN(set->ctx, "Argument #2 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
+ LOGWRN(set->ctx, "Argument #2 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype),
+ sleaf->name);
} else if (!warn_is_string_type(sleaf->type)) {
LOGWRN(set->ctx, "Argument #2 of %s is node \"%s\", not of string-type.", __func__, sleaf->name);
}
@@ -3624,11 +3633,10 @@
static LY_ERR
xpath_count(struct lyxp_set **args, uint16_t UNUSED(arg_count), struct lyxp_set *set, uint32_t options)
{
- struct lysc_node *scnode = NULL;
LY_ERR rc = LY_SUCCESS;
if (options & LYXP_SCNODE_ALL) {
- if ((args[0]->type != LYXP_SET_SCNODE_SET) || !(scnode = warn_get_scnode_in_ctx(args[0]))) {
+ if (args[0]->type != LYXP_SET_SCNODE_SET) {
LOGWRN(set->ctx, "Argument #1 of %s not a node-set as expected.", __func__);
}
set_scnode_clear_ctx(set);
@@ -3700,13 +3708,16 @@
LY_ERR rc = LY_SUCCESS;
if (options & LYXP_SCNODE_ALL) {
- if ((args[0]->type != LYXP_SET_SCNODE_SET) || !(sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
+ if (args[0]->type != LYXP_SET_SCNODE_SET) {
LOGWRN(set->ctx, "Argument #1 of %s not a node-set as expected.", __func__);
- } else if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
- LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
- } else if (!warn_is_specific_type(sleaf->type, LY_TYPE_LEAFREF) && !warn_is_specific_type(sleaf->type, LY_TYPE_INST)) {
- LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of type \"leafref\" nor \"instance-identifier\".",
- __func__, sleaf->name);
+ } else if ((sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
+ if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
+ LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype),
+ sleaf->name);
+ } else if (!warn_is_specific_type(sleaf->type, LY_TYPE_LEAFREF) && !warn_is_specific_type(sleaf->type, LY_TYPE_INST)) {
+ LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of type \"leafref\" nor \"instance-identifier\".",
+ __func__, sleaf->name);
+ }
}
set_scnode_clear_ctx(set);
if (sleaf && (sleaf->type->basetype == LY_TYPE_LEAFREF)) {
@@ -3777,13 +3788,15 @@
ly_bool found;
if (options & LYXP_SCNODE_ALL) {
- if ((args[0]->type != LYXP_SET_SCNODE_SET) || !(sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
+ if (args[0]->type != LYXP_SET_SCNODE_SET) {
LOGWRN(set->ctx, "Argument #1 of %s not a node-set as expected.", func);
- } else if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
- LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", func, lys_nodetype2str(sleaf->nodetype),
- sleaf->name);
- } else if (!warn_is_specific_type(sleaf->type, LY_TYPE_IDENT)) {
- LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of type \"identityref\".", func, sleaf->name);
+ } else if ((sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
+ if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
+ LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", func, lys_nodetype2str(sleaf->nodetype),
+ sleaf->name);
+ } else if (!warn_is_specific_type(sleaf->type, LY_TYPE_IDENT)) {
+ LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of type \"identityref\".", func, sleaf->name);
+ }
}
if ((args[1]->type == LYXP_SET_SCNODE_SET) && (sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[1]))) {
@@ -3920,12 +3933,15 @@
LY_ERR rc = LY_SUCCESS;
if (options & LYXP_SCNODE_ALL) {
- if ((args[0]->type != LYXP_SET_SCNODE_SET) || !(sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
+ if (args[0]->type != LYXP_SET_SCNODE_SET) {
LOGWRN(set->ctx, "Argument #1 of %s not a node-set as expected.", __func__);
- } else if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
- LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
- } else if (!warn_is_specific_type(sleaf->type, LY_TYPE_ENUM)) {
- LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of type \"enumeration\".", __func__, sleaf->name);
+ } else if ((sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
+ if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
+ LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype),
+ sleaf->name);
+ } else if (!warn_is_specific_type(sleaf->type, LY_TYPE_ENUM)) {
+ LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of type \"enumeration\".", __func__, sleaf->name);
+ }
}
set_scnode_clear_ctx(set);
return rc;
@@ -4649,12 +4665,15 @@
LY_ERR rc = LY_SUCCESS;
if (options & LYXP_SCNODE_ALL) {
- if ((args[0]->type != LYXP_SET_SCNODE_SET) || !(sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
+ if (args[0]->type != LYXP_SET_SCNODE_SET) {
LOGWRN(set->ctx, "Argument #1 of %s not a node-set as expected.", __func__);
- } else if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
- LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
- } else if (!warn_is_specific_type(sleaf->type, LY_TYPE_DEC64)) {
- LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of type \"decimal64\".", __func__, sleaf->name);
+ } else if ((sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
+ if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
+ LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype),
+ sleaf->name);
+ } else if (!warn_is_specific_type(sleaf->type, LY_TYPE_DEC64)) {
+ LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of type \"decimal64\".", __func__, sleaf->name);
+ }
}
set_scnode_clear_ctx(set);
return rc;