X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=src%2Flib%2Ftrace-ir%2Fresolve-field-path.c;h=ac8aed7e7153c72d330fbdee1084de0836b867f4;hb=d98421f2abfc5adab28ab7ee9b63537a6c7261cc;hp=4bc0c9c2665fb8e41091a25689be7010e3d2445d;hpb=c4f23e30bf67d2523163614bc9461d84cbe1ae80;p=babeltrace.git diff --git a/src/lib/trace-ir/resolve-field-path.c b/src/lib/trace-ir/resolve-field-path.c index 4bc0c9c2..ac8aed7e 100644 --- a/src/lib/trace-ir/resolve-field-path.c +++ b/src/lib/trace-ir/resolve-field-path.c @@ -1,31 +1,15 @@ /* - * Copyright 2018 Philippe Proulx - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * SPDX-License-Identifier: MIT * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. + * Copyright 2018 Philippe Proulx */ #define BT_LOG_TAG "LIB/RESOLVE-FIELD-PATH" #include "lib/logging.h" -#include "lib/assert-pre.h" +#include "lib/assert-cond.h" #include "common/assert.h" -#include +#include #include #include #include @@ -171,7 +155,7 @@ end: return field_path; } -BT_ASSERT_PRE_DEV_FUNC +BT_ASSERT_COND_DEV_FUNC static inline bool target_is_before_source(struct bt_field_path *src_field_path, struct bt_field_path *tgt_field_path) @@ -215,7 +199,7 @@ end: return is_valid; } -BT_ASSERT_PRE_DEV_FUNC +BT_ASSERT_COND_DEV_FUNC static inline struct bt_field_class *borrow_root_field_class( struct bt_resolve_field_path_context *ctx, enum bt_field_path_scope scope) @@ -230,13 +214,13 @@ struct bt_field_class *borrow_root_field_class( case BT_FIELD_PATH_SCOPE_EVENT_PAYLOAD: return ctx->event_payload; default: - abort(); + bt_common_abort(); } return NULL; } -BT_ASSERT_PRE_DEV_FUNC +BT_ASSERT_COND_DEV_FUNC static inline struct bt_field_class *borrow_child_field_class( struct bt_field_class *parent_fc, @@ -273,7 +257,7 @@ struct bt_field_class *borrow_child_field_class( return child_fc; } -BT_ASSERT_PRE_DEV_FUNC +BT_ASSERT_COND_DEV_FUNC static inline bool target_field_path_in_different_scope_has_struct_fc_only( struct bt_field_path *src_field_path, @@ -313,7 +297,7 @@ end: return is_valid; } -BT_ASSERT_PRE_DEV_FUNC +BT_ASSERT_COND_DEV_FUNC static inline bool lca_is_structure_field_class(struct bt_field_path *src_field_path, struct bt_field_path *tgt_field_path, @@ -369,7 +353,7 @@ end: return is_valid; } -BT_ASSERT_PRE_DEV_FUNC +BT_ASSERT_COND_DEV_FUNC static inline bool lca_to_target_has_struct_fc_only(struct bt_field_path *src_field_path, struct bt_field_path *tgt_field_path, @@ -432,7 +416,7 @@ end: return is_valid; } -BT_ASSERT_PRE_DEV_FUNC +BT_ASSERT_COND_DEV_FUNC static inline bool field_path_is_valid(struct bt_field_class *src_fc, struct bt_field_class *tgt_fc, @@ -445,14 +429,14 @@ bool field_path_is_valid(struct bt_field_class *src_fc, tgt_fc, ctx); if (!src_field_path) { - BT_ASSERT_PRE_DEV_MSG("Cannot find requesting field class in " + BT_ASSERT_COND_DEV_MSG("Cannot find requesting field class in " "resolving context: %!+F", src_fc); is_valid = false; goto end; } if (!tgt_field_path) { - BT_ASSERT_PRE_DEV_MSG("Cannot find target field class in " + BT_ASSERT_COND_DEV_MSG("Cannot find target field class in " "resolving context: %!+F", tgt_fc); is_valid = false; goto end; @@ -460,7 +444,7 @@ bool field_path_is_valid(struct bt_field_class *src_fc, /* Target must be before source */ if (!target_is_before_source(src_field_path, tgt_field_path)) { - BT_ASSERT_PRE_DEV_MSG("Target field class is located after " + BT_ASSERT_COND_DEV_MSG("Target field class is located after " "requesting field class: %![req-fc-]+F, %![tgt-fc-]+F", src_fc, tgt_fc); is_valid = false; @@ -473,7 +457,7 @@ bool field_path_is_valid(struct bt_field_class *src_fc, */ if (!target_field_path_in_different_scope_has_struct_fc_only( src_field_path, tgt_field_path, ctx)) { - BT_ASSERT_PRE_DEV_MSG("Target field class is located in a " + BT_ASSERT_COND_DEV_MSG("Target field class is located in a " "different scope than requesting field class, " "but within an array or a variant field class: " "%![req-fc-]+F, %![tgt-fc-]+F", @@ -484,7 +468,7 @@ bool field_path_is_valid(struct bt_field_class *src_fc, /* Same scope: LCA must be a structure field class */ if (!lca_is_structure_field_class(src_field_path, tgt_field_path, ctx)) { - BT_ASSERT_PRE_DEV_MSG("Lowest common ancestor of target and " + BT_ASSERT_COND_DEV_MSG("Lowest common ancestor of target and " "requesting field classes is not a structure field class: " "%![req-fc-]+F, %![tgt-fc-]+F", src_fc, tgt_fc); @@ -495,7 +479,7 @@ bool field_path_is_valid(struct bt_field_class *src_fc, /* Same scope: path from LCA to target has no array/variant FTs */ if (!lca_to_target_has_struct_fc_only(src_field_path, tgt_field_path, ctx)) { - BT_ASSERT_PRE_DEV_MSG("Path from lowest common ancestor of target " + BT_ASSERT_COND_DEV_MSG("Path from lowest common ancestor of target " "and requesting field classes to target field class " "contains an array or a variant field class: " "%![req-fc-]+F, %![tgt-fc-]+F", src_fc, tgt_fc);