return 0;
}
+static
+int get_unary_signed(struct cds_list_head *head, int64_t *value)
+{
+ struct ctf_node *node;
+ int i = 0;
+
+ cds_list_for_each_entry(node, head, siblings) {
+ 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);
+ *value = node->u.unary_expression.u.signed_constant;
+ i++;
+ }
+ return 0;
+}
+
static
int get_unary_uuid(struct cds_list_head *head, uuid_t *uuid)
{
return NULL;
}
g_free(s_right);
+ } else if (!strcmp(left->u.unary_expression.u.string, "map")) {
+ char *s_right;
+
+ if (right->u.unary_expression.type != UNARY_STRING) {
+ fprintf(fd, "[error] %s: map: expecting identifier\n",
+ __func__);
+ return NULL;
+ }
+ s_right = concatenate_unary_strings(&expression->u.ctf_expression.right);
+ if (!s_right) {
+ fprintf(fd, "[error] %s: unexpected unary expression for integer map\n", __func__);
+ g_free(s_right);
+ return NULL;
+ }
+ /* TODO: lookup */
+
} else {
- fprintf(fd, "[error] %s: unknown attribute name %s\n",
+ fprintf(fd, "[warning] %s: unknown attribute name %s\n",
__func__, left->u.unary_expression.u.string);
- return NULL;
+ /* Fall-through after warning */
}
}
if (!has_size) {
}
has_alignment = 1;
} else {
- fprintf(fd, "[error] %s: unknown attribute name %s\n",
+ fprintf(fd, "[warning] %s: unknown attribute name %s\n",
__func__, left->u.unary_expression.u.string);
- return NULL;
+ /* Fall-through after warning */
}
}
if (!has_mant_dig) {
}
encoding_c = right->u.unary_expression.u.string;
} else {
- fprintf(fd, "[error] %s: unknown attribute name %s\n",
+ fprintf(fd, "[warning] %s: unknown attribute name %s\n",
__func__, left->u.unary_expression.u.string);
- return NULL;
+ /* Fall-through after warning */
}
}
if (encoding_c && !strcmp(encoding_c, "ASCII"))
goto error;
}
event->fields_decl = container_of(declaration, struct declaration_struct, p);
+ } else if (!strcmp(left, "loglevel.identifier")) {
+ char *right;
+
+ if (CTF_EVENT_FIELD_IS_SET(event, loglevel_identifier)) {
+ fprintf(fd, "[error] %s: identifier already declared in event declaration\n", __func__);
+ ret = -EPERM;
+ goto error;
+ }
+ right = concatenate_unary_strings(&node->u.ctf_expression.right);
+ if (!right) {
+ fprintf(fd, "[error] %s: unexpected unary expression for event identifier\n", __func__);
+ ret = -EINVAL;
+ goto error;
+ }
+ event->loglevel_identifier = g_quark_from_string(right);
+ g_free(right);
+ CTF_EVENT_SET_FIELD(event, loglevel_identifier);
+ } else if (!strcmp(left, "loglevel.value")) {
+ if (CTF_EVENT_FIELD_IS_SET(event, loglevel_value)) {
+ fprintf(fd, "[error] %s: loglevel value already declared in event declaration\n", __func__);
+ ret = -EPERM;
+ goto error;
+ }
+ ret = get_unary_signed(&node->u.ctf_expression.right, &event->loglevel_value);
+ if (ret) {
+ fprintf(fd, "[error] %s: unexpected unary expression for event loglevel value\n", __func__);
+ ret = -EINVAL;
+ goto error;
+ }
+ CTF_EVENT_SET_FIELD(event, loglevel_value);
} else {
- fprintf(fd, "[error] %s: attribute \"%s\" is unknown in event declaration.\n", __func__, left);
- ret = -EINVAL;
- goto error;
+ fprintf(fd, "[warning] %s: attribute \"%s\" is unknown in event declaration.\n", __func__, left);
+ /* Fall-through after warning */
}
error:
g_free(left);
}
stream->packet_context_decl = container_of(declaration, struct declaration_struct, p);
} else {
- fprintf(fd, "[error] %s: attribute \"%s\" is unknown in stream declaration.\n", __func__, left);
- ret = -EINVAL;
- goto error;
+ fprintf(fd, "[warning] %s: attribute \"%s\" is unknown in stream declaration.\n", __func__, left);
+ /* Fall-through after warning */
}
error:
}
trace->packet_header_decl = container_of(declaration, struct declaration_struct, p);
} else {
- fprintf(fd, "[error] %s: attribute \"%s\" is unknown in trace declaration.\n", __func__, left);
- ret = -EINVAL;
- goto error;
+ fprintf(fd, "[warning] %s: attribute \"%s\" is unknown in trace declaration.\n", __func__, left);
}
error: