#include <babeltrace/list.h>
#include <babeltrace/types.h>
#include <babeltrace/ctf/metadata.h>
#include <babeltrace/list.h>
#include <babeltrace/types.h>
#include <babeltrace/ctf/metadata.h>
- assert(node->type == NODE_UNARY_EXPRESSION);
- assert(node->u.unary_expression.type == UNARY_STRING);
- assert((node->u.unary_expression.link == UNARY_LINK_UNKNOWN)
- ^ (i != 0));
+ if (node->type != NODE_UNARY_EXPRESSION
+ || node->u.unary_expression.type != UNARY_STRING
+ || !((node->u.unary_expression.link != UNARY_LINK_UNKNOWN)
+ ^ (i == 0)))
+ return NULL;
switch (node->u.unary_expression.link) {
case UNARY_DOTLINK:
g_string_append(str, ".");
switch (node->u.unary_expression.link) {
case UNARY_DOTLINK:
g_string_append(str, ".");
- assert(node->type == NODE_UNARY_EXPRESSION);
- assert(node->u.unary_expression.type == UNARY_STRING);
- assert((node->u.unary_expression.link == UNARY_LINK_UNKNOWN)
- ^ (i != 0));
+ if (node->type != NODE_UNARY_EXPRESSION
+ || node->u.unary_expression.type != UNARY_STRING
+ || !((node->u.unary_expression.link != UNARY_LINK_UNKNOWN)
+ ^ (i == 0)))
+ return 0;
- assert(node->type == NODE_UNARY_EXPRESSION);
- assert(node->u.unary_expression.type == UNARY_UNSIGNED_CONSTANT);
- assert(node->u.unary_expression.link == UNARY_LINK_UNKNOWN);
- assert(i == 0);
+ if (node->type != NODE_UNARY_EXPRESSION
+ || node->u.unary_expression.type != UNARY_UNSIGNED_CONSTANT
+ || node->u.unary_expression.link != UNARY_LINK_UNKNOWN
+ || i != 0)
+ return -EINVAL;
- assert(node->type == NODE_UNARY_EXPRESSION);
- assert(node->u.unary_expression.type == UNARY_UNSIGNED_CONSTANT
- || node->u.unary_expression.type == UNARY_SIGNED_CONSTANT);
- assert(node->u.unary_expression.link == UNARY_LINK_UNKNOWN);
- assert(i == 0);
+ if (node->type != NODE_UNARY_EXPRESSION
+ || node->u.unary_expression.type != UNARY_UNSIGNED_CONSTANT
+ || (node->u.unary_expression.type != UNARY_UNSIGNED_CONSTANT && node->u.unary_expression.type != UNARY_SIGNED_CONSTANT)
+ || node->u.unary_expression.link != UNARY_LINK_UNKNOWN
+ || i != 0)
+ return -EINVAL;
switch (node->u.unary_expression.type) {
case UNARY_UNSIGNED_CONSTANT:
*value = (int64_t) node->u.unary_expression.u.unsigned_constant;
switch (node->u.unary_expression.type) {
case UNARY_UNSIGNED_CONSTANT:
*value = (int64_t) node->u.unary_expression.u.unsigned_constant;
- assert(node->type == NODE_UNARY_EXPRESSION);
- assert(node->u.unary_expression.type == UNARY_STRING);
- assert(node->u.unary_expression.link == UNARY_LINK_UNKNOWN);
- assert(i == 0);
+ if (node->type != NODE_UNARY_EXPRESSION
+ || node->u.unary_expression.type != UNARY_STRING
+ || node->u.unary_expression.link != UNARY_LINK_UNKNOWN
+ || i != 0)
+ return -EINVAL;
src_string = node->u.unary_expression.u.string;
ret = babeltrace_uuid_parse(src_string, uuid);
}
src_string = node->u.unary_expression.u.string;
ret = babeltrace_uuid_parse(src_string, uuid);
}
/* TODO: gcc bitfields not supported yet. */
if (node_type_declarator->u.type_declarator.bitfield_len != NULL) {
/* TODO: gcc bitfields not supported yet. */
if (node_type_declarator->u.type_declarator.bitfield_len != NULL) {
}
first = _bt_list_first_entry(&node_type_declarator->u.type_declarator.u.nested.length,
struct ctf_node, siblings);
}
first = _bt_list_first_entry(&node_type_declarator->u.type_declarator.u.nested.length,
struct ctf_node, siblings);
char *length_name = concatenate_unary_strings(&node_type_declarator->u.type_declarator.u.nested.length);
struct declaration_sequence *sequence_declaration;
char *length_name = concatenate_unary_strings(&node_type_declarator->u.type_declarator.u.nested.length);
struct declaration_sequence *sequence_declaration;
sequence_declaration = bt_sequence_declaration_new(length_name, nested_declaration, declaration_scope);
if (!sequence_declaration) {
fprintf(fd, "[error] %s: cannot create sequence declaration.\n", __func__);
sequence_declaration = bt_sequence_declaration_new(length_name, nested_declaration, declaration_scope);
if (!sequence_declaration) {
fprintf(fd, "[error] %s: cannot create sequence declaration.\n", __func__);
bt_list_for_each_entry(iter, type_declarators, siblings) {
struct bt_declaration *type_declaration;
int ret;
bt_list_for_each_entry(iter, type_declarators, siblings) {
struct bt_declaration *type_declaration;
int ret;
break;
default:
fprintf(fd, "[error] %s: unexpected node type %d\n", __func__, (int) iter->type);
break;
default:
fprintf(fd, "[error] %s: unexpected node type %d\n", __func__, (int) iter->type);
break;
default:
fprintf(fd, "[error] %s: unexpected node type %d\n", __func__, (int) iter->type);
break;
default:
fprintf(fd, "[error] %s: unexpected node type %d\n", __func__, (int) iter->type);
fprintf(fd, "[error] %s: struct %s already declared in scope\n", __func__, name);
return NULL;
}
fprintf(fd, "[error] %s: struct %s already declared in scope\n", __func__, name);
return NULL;
}
ret = get_unary_unsigned(min_align, &min_align_value);
if (ret) {
fprintf(fd, "[error] %s: unexpected unary expression for structure \"align\" attribute\n", __func__);
ret = get_unary_unsigned(min_align, &min_align_value);
if (ret) {
fprintf(fd, "[error] %s: unexpected unary expression for structure \"align\" attribute\n", __func__);
untagged_variant_declaration =
bt_lookup_variant_declaration(g_quark_from_string(name),
declaration_scope);
untagged_variant_declaration =
bt_lookup_variant_declaration(g_quark_from_string(name),
declaration_scope);
fprintf(fd, "[error] %s: variant %s already declared in scope\n", __func__, name);
return NULL;
}
fprintf(fd, "[error] %s: variant %s already declared in scope\n", __func__, name);
return NULL;
}
ret = bt_register_variant_declaration(g_quark_from_string(name),
untagged_variant_declaration,
declaration_scope);
ret = bt_register_variant_declaration(g_quark_from_string(name),
untagged_variant_declaration,
declaration_scope);
fprintf(fd, "[error] %s: enum %s already declared in scope\n", __func__, name);
return NULL;
}
fprintf(fd, "[error] %s: enum %s already declared in scope\n", __func__, name);
return NULL;
}
left = _bt_list_first_entry(&expression->u.ctf_expression.left, struct ctf_node, siblings);
right = _bt_list_first_entry(&expression->u.ctf_expression.right, struct ctf_node, siblings);
left = _bt_list_first_entry(&expression->u.ctf_expression.left, struct ctf_node, siblings);
right = _bt_list_first_entry(&expression->u.ctf_expression.right, struct ctf_node, siblings);
if (!strcmp(left->u.unary_expression.u.string, "signed")) {
signedness = get_boolean(fd, depth, right);
if (signedness < 0)
if (!strcmp(left->u.unary_expression.u.string, "signed")) {
signedness = get_boolean(fd, depth, right);
if (signedness < 0)
has_size = 1;
} else if (!strcmp(left->u.unary_expression.u.string, "align")) {
if (right->u.unary_expression.type != UNARY_UNSIGNED_CONSTANT) {
has_size = 1;
} else if (!strcmp(left->u.unary_expression.u.string, "align")) {
if (right->u.unary_expression.type != UNARY_UNSIGNED_CONSTANT) {
- uint64_t alignment = 1, exp_dig = 0, mant_dig = 0,
- byte_order = trace->byte_order;
- int has_alignment = 0, has_exp_dig = 0, has_mant_dig = 0;
+ uint64_t alignment = 1, exp_dig = 0, mant_dig = 0;
+ int byte_order = trace->byte_order, has_alignment = 0,
+ has_exp_dig = 0, has_mant_dig = 0;
struct declaration_float *float_declaration;
bt_list_for_each_entry(expression, expressions, siblings) {
struct declaration_float *float_declaration;
bt_list_for_each_entry(expression, expressions, siblings) {
left = _bt_list_first_entry(&expression->u.ctf_expression.left, struct ctf_node, siblings);
right = _bt_list_first_entry(&expression->u.ctf_expression.right, struct ctf_node, siblings);
left = _bt_list_first_entry(&expression->u.ctf_expression.left, struct ctf_node, siblings);
right = _bt_list_first_entry(&expression->u.ctf_expression.right, struct ctf_node, siblings);
if (!strcmp(left->u.unary_expression.u.string, "byte_order")) {
byte_order = get_byte_order(fd, depth, right, trace);
if (byte_order < 0)
if (!strcmp(left->u.unary_expression.u.string, "byte_order")) {
byte_order = get_byte_order(fd, depth, right, trace);
if (byte_order < 0)
left = _bt_list_first_entry(&expression->u.ctf_expression.left, struct ctf_node, siblings);
right = _bt_list_first_entry(&expression->u.ctf_expression.right, struct ctf_node, siblings);
left = _bt_list_first_entry(&expression->u.ctf_expression.left, struct ctf_node, siblings);
right = _bt_list_first_entry(&expression->u.ctf_expression.right, struct ctf_node, siblings);
if (!strcmp(left->u.unary_expression.u.string, "encoding")) {
if (right->u.unary_expression.type != UNARY_STRING) {
fprintf(fd, "[error] %s: encoding: expecting string\n",
if (!strcmp(left->u.unary_expression.u.string, "encoding")) {
if (right->u.unary_expression.type != UNARY_STRING) {
fprintf(fd, "[error] %s: encoding: expecting string\n",
first = _bt_list_first_entry(&type_specifier_list->u.type_specifier_list.head, struct ctf_node, siblings);
first = _bt_list_first_entry(&type_specifier_list->u.type_specifier_list.head, struct ctf_node, siblings);
if (!strcmp(left, "id")) {
if (CTF_STREAM_FIELD_IS_SET(stream, stream_id)) {
fprintf(fd, "[error] %s: id already declared in stream declaration\n", __func__);
if (!strcmp(left, "id")) {
if (CTF_STREAM_FIELD_IS_SET(stream, stream_id)) {
fprintf(fd, "[error] %s: id already declared in stream declaration\n", __func__);
if (!strcmp(left, "major")) {
if (CTF_TRACE_FIELD_IS_SET(trace, major)) {
fprintf(fd, "[error] %s: major already declared in trace declaration\n", __func__);
if (!strcmp(left, "major")) {
if (CTF_TRACE_FIELD_IS_SET(trace, major)) {
fprintf(fd, "[error] %s: major already declared in trace declaration\n", __func__);
right = _bt_list_first_entry(&node->u.ctf_expression.right, struct ctf_node, siblings);
byte_order = get_trace_byte_order(fd, depth, right);
right = _bt_list_first_entry(&node->u.ctf_expression.right, struct ctf_node, siblings);
byte_order = get_trace_byte_order(fd, depth, right);
if (CTF_TRACE_FIELD_IS_SET(trace, byte_order)
&& byte_order != trace->byte_order) {
if (CTF_TRACE_FIELD_IS_SET(trace, byte_order)
&& byte_order != trace->byte_order) {
} else {
fprintf(fd, "[warning] %s: attribute \"%s\" is unknown in clock declaration.\n", __func__, left);
}
} else {
fprintf(fd, "[warning] %s: attribute \"%s\" is unknown in clock declaration.\n", __func__, left);
}
- trace->single_clock = clock;
- g_hash_table_insert(trace->clocks, (gpointer) (unsigned long) clock->name, clock);
+ trace->parent.single_clock = clock;
+ g_hash_table_insert(trace->parent.clocks, (gpointer) (unsigned long) clock->name, clock);
- trace->single_clock = clock;
- g_hash_table_insert(trace->clocks, (gpointer) (unsigned long) clock->name, clock);
+ trace->parent.single_clock = clock;
+ g_hash_table_insert(trace->parent.clocks, (gpointer) (unsigned long) clock->name, clock);
printf_verbose("env.%s = \"%s\"\n", left, right);
g_free(right);
} else if (is_unary_unsigned(&node->u.ctf_expression.right)) {
printf_verbose("env.%s = \"%s\"\n", left, right);
g_free(right);
} else if (is_unary_unsigned(&node->u.ctf_expression.right)) {
printf_verbose("env.%s = %" PRIu64 "\n", left, v);
} else if (is_unary_signed(&node->u.ctf_expression.right)) {
int64_t v;
int ret;
ret = get_unary_signed(&node->u.ctf_expression.right, &v);
printf_verbose("env.%s = %" PRIu64 "\n", left, v);
} else if (is_unary_signed(&node->u.ctf_expression.right)) {
int64_t v;
int ret;
ret = get_unary_signed(&node->u.ctf_expression.right, &v);
printf_verbose("env.%s = %" PRId64 "\n", left, v);
} else {
printf_verbose("%s: attribute \"%s\" has unknown type.\n", __func__, left);
printf_verbose("env.%s = %" PRId64 "\n", left, v);
} else {
printf_verbose("%s: attribute \"%s\" has unknown type.\n", __func__, left);
- trace->clocks = g_hash_table_new_full(g_direct_hash, g_direct_equal,
- NULL, clock_free);
+ trace->parent.clocks = g_hash_table_new_full(g_direct_hash,
+ g_direct_equal, NULL, clock_free);