Remove unneeded declaration "name", work in progress for gen io struct
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 21 Apr 2011 16:41:16 +0000 (12:41 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 21 Apr 2011 16:41:16 +0000 (12:41 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
formats/ctf/metadata/ctf-ast.h
formats/ctf/metadata/ctf-visitor-generate-io-struct.c
include/babeltrace/ctf/metadata.h
include/babeltrace/types.h
types/array.c
types/enum.c
types/sequence.c
types/string.c
types/struct.c
types/variant.c

index 8a2888dafa28deee9f2a1c229b5a95f474f600d9..6ee937b6e44ec7597a39c6d34217ab9bc4f1bf89 100644 (file)
@@ -235,8 +235,12 @@ struct ctf_ast {
 
 const char *node_type(struct ctf_node *node);
 
+struct ctf_trace;
+
 int ctf_visitor_print_xml(FILE *fd, int depth, struct ctf_node *node);
 int ctf_visitor_semantic_check(FILE *fd, int depth, struct ctf_node *node);
 int ctf_visitor_parent_links(FILE *fd, int depth, struct ctf_node *node);
+int ctf_visitor_construct_metadata(FILE *fd, int depth, struct ctf_node *node,
+                       struct ctf_trace *trace, int byte_order);
 
 #endif /* _CTF_PARSER_H */
index fd6176fef4a1bef223cb3c0f3df0d34621d73d02..bd0a845f8fd1327ea2c00062e2259a109b5510fe 100644 (file)
@@ -39,7 +39,8 @@
 static
 struct declaration *ctf_declaration_specifier_visit(FILE *fd,
                int depth, struct cds_list_head *head,
-               struct declaration_scope *declaration_scope);
+               struct declaration_scope *declaration_scope,
+               struct ctf_trace *trace);
 
 /*
  * String returned must be freed by the caller using g_free.
@@ -731,12 +732,86 @@ struct declaration *ctf_declaration_type_specifier_visit(int fd, int depth,
        return declaration;
 }
 
+/*
+ * Returns 0/1 boolean, or < 0 on error.
+ */
+static
+int get_boolean(int fd, int depth, struct node *unary_expression)
+{
+       if (unary_expression->type != NODE_UNARY_EXPRESSION) {
+               fprintf(stderr, "[error] %s: expecting unary expression\n",
+                       __func__);
+               return -EINVAL;
+       }
+       switch (unary_expression->u.unary_expression.type) {
+       case UNARY_UNSIGNED_CONSTANT:
+               if (unary_expression->u.unary_expression.u.unsigned_constant == 0)
+                       return 0;
+               else
+                       return 1;
+       case UNARY_SIGNED_CONSTANT:
+               if (unary_expression->u.unary_expression.u.signed_constant == 0)
+                       return 0;
+               else
+                       return 1;
+       case UNARY_STRING:
+               if (!strcmp(unary_expression->u.unary_expression.u.string, "true"))
+                       return 1;
+               else if (!strcmp(unary_expression->u.unary_expression.u.string, "TRUE"))
+                       return 1;
+               else if (!strcmp(unary_expression->u.unary_expression.u.string, "false"))
+                       return 0;
+               else if (!strcmp(unary_expression->u.unary_expression.u.string, "FALSE"))
+                       return 0;
+               else {
+                       fprintf(stderr, "[error] %s: unexpected string \"%s\"\n",
+                               __func__, unary_expression->u.unary_expression.u.string);
+                       return -EINVAL;
+               }
+               break;
+       default:
+               fprintf(stderr, "[error] %s: unexpected unary expression type\n",
+                       __func__);
+               return -EINVAL;
+       } 
+
+}
+
+static
+int get_byte_order(int fd, int depth, struct node *unary_expression)
+{
+       int byte_order;
+
+       if (unary_expression->u.unary_expression.type != UNARY_STRING) {
+               fprintf(stderr, "[error] %s: byte_order: expecting string\n",
+                       __func__);
+               return -EINVAL;
+       }
+       if (!strcmp(unary_expression->u.unary_expression.u.string, "native"))
+               byte_order = trace->byte_order;
+       else if (!strcmp(unary_expression->u.unary_expression.u.string, "network"))
+               byte_order = BIG_ENDIAN;
+       else if (!strcmp(unary_expression->u.unary_expression.u.string, "be"))
+               byte_order = BIG_ENDIAN;
+       else if (!strcmp(unary_expression->u.unary_expression.u.string, "le"))
+               byte_order = LITTLE_ENDIAN;
+       else {
+               fprintf(stderr, "[error] %s: unexpected string \"%s\". Should be \"native\", \"network\", \"be\" or \"le\".\n",
+                       __func__, right->u.unary_expression.u.string);
+               return -EINVAL;
+       }
+       return byte_order;
+}
+
 static
 struct declaration *ctf_declaration_integer_visit(int fd, int depth,
-               struct cds_list_head *expressions)
+               struct cds_list_head *expressions,
+               struct ctf_trace *trace)
 {
        struct node *expression;
-       uint64_t alignment, size, byte_order = trace->native_bo, signedness = 0;
+       uint64_t alignment, size;
+       int byte_order = trace->byte_order;
+       int signedness = 0;
        int has_alignment = 0, has_size = 0;
        struct declaration_integer *integer_declaration;
 
@@ -747,13 +822,28 @@ struct declaration *ctf_declaration_integer_visit(int fd, int depth,
                right = expression->u.ctf_expression.right;
                assert(left->u.unary_expression.type == UNARY_STRING);
                if (!strcmp(left->u.unary_expression.u.string, "signed")) {
-                       /* TODO */
-       ...........
+                       signedness = get_boolean(fd, depth, right);
+                       if (signedness < 0)
+                               return NULL;
                } else if (!strcmp(left->u.unary_expression.u.string, "byte_order")) {
-
+                       byte_order = get_byte_order(fd, depth, right);
+                       if (byte_order < 0)
+                               return NULL;
                } else if (!strcmp(left->u.unary_expression.u.string, "size")) {
+                       if (right->u.unary_expression.type != UNARY_UNSIGNED_CONSTANT) {
+                               fprintf(stderr, "[error] %s: size: expecting unsigned constant\n",
+                                       __func__);
+                               return NULL;
+                       }
+                       size = right->u.unary_expression.u.unsigned_constant;
                        has_size = 1;
                } else if (!strcmp(left->u.unary_expression.u.string, "align")) {
+                       if (right->u.unary_expression.type != UNARY_UNSIGNED_CONSTANT) {
+                               fprintf(stderr, "[error] %s: align: expecting unsigned constant\n",
+                                       __func__);
+                               return NULL;
+                       }
+                       alignment = right->u.unary_expression.u.unsigned_constant;
                        has_alignment = 1;
                } else {
                        fprintf(stderr, "[error] %s: unknown attribute name %s\n",
@@ -761,26 +851,140 @@ struct declaration *ctf_declaration_integer_visit(int fd, int depth,
                        return NULL;
                }
        }
-       if (!has_alignment) {
-               fprintf(stderr, "[error] %s: missing alignment attribute\n", __func__);
-               return NULL;
-       }
        if (!has_size) {
                fprintf(stderr, "[error] %s: missing size attribute\n", __func__);
                return NULL;
        }
+       if (!has_alignment) {
+               if (size % CHAR_BIT) {
+                       /* bit-packed alignment */
+                       alignment = 1;
+               } else {
+                       /* byte-packed alignment */
+                       alignment = CHAR_BIT;
+               }
+       }
        integer_declaration = integer_declaration_new(size,
                                byte_order, signedness, alignment);
        return &integer_declaration->p;
 }
 
+static
+struct declaration *ctf_declaration_floating_point_visit(int fd, int depth,
+               struct cds_list_head *expressions,
+               struct ctf_trace *trace)
+{
+       struct node *expression;
+       uint64_t alignment, exp_dig, mant_dig, byte_order = trace->byte_order;
+       int has_alignment = 0, has_exp_dig = 0, has_mant_dig = 0;
+       struct declaration_float *float_declaration;
+
+       cds_list_for_each_entry(expression, expressions, siblings) {
+               struct node *left, *right;
+
+               left = expression->u.ctf_expression.left;
+               right = expression->u.ctf_expression.right;
+               assert(left->u.unary_expression.type == UNARY_STRING);
+               if (!strcmp(left->u.unary_expression.u.string, "byte_order")) {
+                       byte_order = get_byte_order(fd, depth, right);
+                       if (byte_order < 0)
+                               return NULL;
+               } else if (!strcmp(left->u.unary_expression.u.string, "exp_dig")) {
+                       if (right->u.unary_expression.type != UNARY_UNSIGNED_CONSTANT) {
+                               fprintf(stderr, "[error] %s: exp_dig: expecting unsigned constant\n",
+                                       __func__);
+                               return NULL;
+                       }
+                       exp_dig = right->u.unary_expression.u.unsigned_constant;
+                       has_exp_dig = 1;
+               } else if (!strcmp(left->u.unary_expression.u.string, "mant_dig")) {
+                       if (right->u.unary_expression.type != UNARY_UNSIGNED_CONSTANT) {
+                               fprintf(stderr, "[error] %s: mant_dig: expecting unsigned constant\n",
+                                       __func__);
+                               return NULL;
+                       }
+                       mant_dig = right->u.unary_expression.u.unsigned_constant;
+                       has_mant_dig = 1;
+               } else if (!strcmp(left->u.unary_expression.u.string, "align")) {
+                       if (right->u.unary_expression.type != UNARY_UNSIGNED_CONSTANT) {
+                               fprintf(stderr, "[error] %s: align: expecting unsigned constant\n",
+                                       __func__);
+                               return NULL;
+                       }
+                       alignment = right->u.unary_expression.u.unsigned_constant;
+                       has_alignment = 1;
+               } else {
+                       fprintf(stderr, "[error] %s: unknown attribute name %s\n",
+                               __func__, left->u.unary_expression.u.string);
+                       return NULL;
+               }
+       }
+       if (!has_mant_dig) {
+               fprintf(stderr, "[error] %s: missing mant_dig attribute\n", __func__);
+               return NULL;
+       }
+       if (!has_exp_dig) {
+               fprintf(stderr, "[error] %s: missing exp_dig attribute\n", __func__);
+               return NULL;
+       }
+       if (!has_alignment) {
+               if ((mant_dig + exp_dig) % CHAR_BIT) {
+                       /* bit-packed alignment */
+                       alignment = 1;
+               } else {
+                       /* byte-packed alignment */
+                       alignment = CHAR_BIT;
+               }
+       }
+       float_declaration = float_declaration_new(mant_dig, exp_dig,
+                               byte_order, alignment);
+       return &float_declaration->p;
+}
+
+static
+struct declaration *ctf_declaration_string_visit(int fd, int depth,
+               struct cds_list_head *expressions,
+               struct ctf_trace *trace)
+{
+       struct node *expression;
+       const char *encoding_c = NULL;
+       enum ctf_string_encoding encoding = CTF_STRING_UTF8;
+       struct declaration_string *string_declaration;
+
+       cds_list_for_each_entry(expression, expressions, siblings) {
+               struct node *left, *right;
+
+               left = expression->u.ctf_expression.left;
+               right = expression->u.ctf_expression.right;
+               assert(left->u.unary_expression.type == UNARY_STRING);
+               if (!strcmp(left->u.unary_expression.u.string, "encoding")) {
+                       if (right->u.unary_expression.type != UNARY_UNSIGNED_STRING) {
+                               fprintf(stderr, "[error] %s: encoding: expecting string\n",
+                                       __func__);
+                               return NULL;
+                       }
+                       encoding_c = right->u.unary_expression.u.string;
+               } else {
+                       fprintf(stderr, "[error] %s: unknown attribute name %s\n",
+                               __func__, left->u.unary_expression.u.string);
+                       return NULL;
+               }
+       }
+       if (encoding_c && !strcmp(encoding_c, "ASCII"))
+               encoding = CTF_STRING_ASCII;
+       string_declaration = string_declaration_new(encoding);
+       return &string_declaration->p;
+}
+
+
 /*
  * Also add named variant, struct or enum to the current declaration scope.
  */
 static
 struct declaration *ctf_declaration_specifier_visit(FILE *fd,
                int depth, struct cds_list_head *head,
-               struct declaration_scope *declaration_scope)
+               struct declaration_scope *declaration_scope,
+               struct ctf_trace *trace)
 {
        struct declaration *declaration;
        struct node *first;
@@ -793,31 +997,34 @@ struct declaration *ctf_declaration_specifier_visit(FILE *fd,
                        first->u._struct.name,
                        &first->u._struct.declaration_list,
                        first->u._struct.has_body,
-                       declaration_scope);
+                       declaration_scope,
+                       trace);
        case NODE_VARIANT:
                return ctf_declaration_variant_visit(fd, depth,
                        first->u.variant.name,
                        &first->u.variant.declaration_list,
                        first->u.variant.has_body,
-                       declaration_scope);
+                       declaration_scope,
+                       trace);
        case NODE_ENUM:
                return ctf_declaration_enum_visit(fd, depth,
                        first->u._enum.enum_id,
                        first->u._enum.container_type,
                        &first->u._enum.enumerator_list,
-                       first->u._enum.has_body);
+                       first->u._enum.has_body,
+                       trace);
        case NODE_INTEGER:
                return ctf_declaration_integer_visit(fd, depth,
-                       &first->u.integer.expressions);
-       case NODE_FLOATING_POINT:       /* TODO  */
+                       &first->u.integer.expressions, trace);
+       case NODE_FLOATING_POINT:
                return ctf_declaration_floating_point_visit(fd, depth,
-                       &first->u.floating_point.expressions);
-       case NODE_STRING:               /* TODO */
+                       &first->u.floating_point.expressions, trace);
+       case NODE_STRING:
                return ctf_declaration_string_visit(fd, depth,
-                       &first->u.string.expressions);
+                       &first->u.string.expressions, trace);
        case NODE_TYPE_SPECIFIER:
                return ctf_declaration_type_specifier_visit(fd, depth,
-                               head, declaration_scope);
+                               head, declaration_scope, trace);
        }
 }
 
@@ -890,7 +1097,7 @@ int ctf_event_declaration_visit(FILE *fd, int depth, struct ctf_node *node, stru
                                return -EPERM;
                        declaration = ctf_declaration_specifier_visit(fd, depth,
                                        &node->u.ctf_expression.right,
-                                       event->declaration_scope);
+                                       event->declaration_scope, trace);
                        if (!declaration)
                                return -EPERM;
                        if (declaration->type->id != CTF_TYPE_STRUCT)
@@ -903,7 +1110,7 @@ int ctf_event_declaration_visit(FILE *fd, int depth, struct ctf_node *node, stru
                                return -EPERM;
                        declaration = ctf_declaration_specifier_visit(fd, depth,
                                        &node->u.ctf_expression.right,
-                                       event->declaration_scope);
+                                       event->declaration_scope, trace);
                        if (!declaration)
                                return -EPERM;
                        if (declaration->type->id != CTF_TYPE_STRUCT)
@@ -1028,7 +1235,7 @@ int ctf_stream_declaration_visit(FILE *fd, int depth, struct ctf_node *node, str
 
                        declaration = ctf_declaration_specifier_visit(fd, depth,
                                        &node->u.ctf_expression.right,
-                                       stream->declaration_scope, stream->definition_scope);
+                                       stream->declaration_scope, stream->definition_scope, trace);
                        if (!declaration)
                                return -EPERM;
                        if (declaration->type->id != CTF_TYPE_STRUCT)
@@ -1039,7 +1246,7 @@ int ctf_stream_declaration_visit(FILE *fd, int depth, struct ctf_node *node, str
 
                        declaration = ctf_declaration_specifier_visit(fd, depth,
                                        &node->u.ctf_expression.right,
-                                       stream->declaration_scope);
+                                       stream->declaration_scope, trace);
                        if (!declaration)
                                return -EPERM;
                        if (declaration->type->id != CTF_TYPE_STRUCT)
@@ -1050,7 +1257,7 @@ int ctf_stream_declaration_visit(FILE *fd, int depth, struct ctf_node *node, str
 
                        declaration = ctf_declaration_specifier_visit(fd, depth,
                                        &node->u.ctf_expression.right,
-                                       stream->declaration_scope);
+                                       stream->declaration_scope, trace);
                        if (!declaration)
                                return -EPERM;
                        if (declaration->type->id != CTF_TYPE_STRUCT)
@@ -1256,11 +1463,14 @@ error:
        return ret;
 }
 
-int _ctf_visitor(FILE *fd, int depth, struct ctf_node *node, struct ctf_trace *trace)
+int ctf_visitor_construct_metadata(FILE *fd, int depth, struct ctf_node *node,
+               struct ctf_trace *trace, int byte_order)
 {
        int ret = 0;
        struct ctf_node *iter;
 
+       trace->byte_order = byte_order;
+
        switch (node->type) {
        case NODE_ROOT:
                cds_list_for_each_entry(iter, &node->u.root._typedef,
@@ -1282,7 +1492,7 @@ int _ctf_visitor(FILE *fd, int depth, struct ctf_node *node, struct ctf_trace *t
                }
                cds_list_for_each_entry(iter, &node->u.root.declaration_specifier, siblings) {
                        ret = ctf_declaration_specifier_visit(fd, depth, iter,
-                                       trace->root_declaration_scope);
+                                       trace->root_declaration_scope, trace);
                        if (ret)
                                return ret;
                }
index d98a26306cc9da3629a8aa90a039073ec5e91b96..6c17b4102ad046424490d92e3534ec38841d648b 100644 (file)
@@ -55,6 +55,7 @@ struct ctf_trace {
        uint64_t minor;
        uuid_t uuid;
        uint64_t word_size;
+       int byte_order;
 
        enum {                                  /* Fields populated mask */
                CTF_TRACE_major =       (1U << 0),
index 37ee9291cb8ec052647bb430e5f236c0971f2bc9..bfc698706766668cf67a1a9d346dc9dec1a9fc08 100644 (file)
@@ -133,7 +133,6 @@ enum ctf_type_id {
 
 struct declaration {
        enum ctf_type_id id;
-       GQuark name;            /* type name */
        size_t alignment;       /* type alignment, in bits */
        int ref;                /* number of references to the type */
        /*
@@ -253,8 +252,15 @@ struct definition_enum {
        GArray *value;
 };
 
+enum ctf_string_encoding {
+       CTF_STRING_UTF8 = 0,
+       CTF_STRING_ASCII,
+       CTF_STRING_UNKNOWN,
+};
+
 struct declaration_string {
        struct declaration p;
+       enum ctf_string_encoding encoding;
 };
 
 struct definition_string {
@@ -442,12 +448,10 @@ void enum_unsigned_insert(struct declaration_enum *enum_declaration,
 size_t enum_get_nr_enumerators(struct declaration_enum *enum_declaration);
 
 struct declaration_enum *
-       enum_declaration_new(const char *name,
-                            struct declaration_integer *integer_declaration);
+       enum_declaration_new(struct declaration_integer *integer_declaration);
 
 struct declaration_struct *
-       struct_declaration_new(const char *name,
-                              struct declaration_scope *parent_scope);
+       struct_declaration_new(struct declaration_scope *parent_scope);
 void struct_declaration_add_field(struct declaration_struct *struct_declaration,
                                  const char *field_name,
                                  struct declaration *field_declaration);
@@ -471,7 +475,7 @@ struct_get_field_from_index(struct definition_struct *struct_definition,
  * from numeric values to a single tag. Overlapping tag value ranges are
  * therefore forbidden.
  */
-struct declaration_untagged_variant *untagged_variant_declaration_new(const char *name,
+struct declaration_untagged_variant *untagged_variant_declaration_new(
                struct declaration_scope *parent_scope);
 struct declaration_variant *variant_declaration_new(struct declaration_untagged_variant *untagged_variant,
                const char *tag);
@@ -500,8 +504,7 @@ struct field *variant_get_current_field(struct definition_variant *variant);
  * array.
  */
 struct declaration_array *
-       array_declaration_new(const char *name,
-               size_t len, struct declaration *elem_declaration,
+       array_declaration_new(size_t len, struct declaration *elem_declaration,
                struct declaration_scope *parent_scope);
 
 /*
@@ -509,8 +512,7 @@ struct declaration_array *
  * to the sequence. No need to free them explicitly.
  */
 struct declaration_sequence *
-       sequence_declaration_new(const char *name,
-               struct declaration_integer *len_declaration, 
+       sequence_declaration_new(struct declaration_integer *len_declaration, 
                struct declaration *elem_declaration,
                struct declaration_scope *parent_scope);
 
index 3e1f2181be8d16193966163f158fe7e0a1e46ca2..c218a11a8bb1a2c66fbf7d0c06d81ba322084ef5 100644 (file)
@@ -58,7 +58,7 @@ void _array_declaration_free(struct declaration *declaration)
 }
 
 struct declaration_array *
-       array_declaration_new(const char *name, size_t len,
+       array_declaration_new(size_t len,
                              struct declaration *elem_declaration,
                              struct declaration_scope *parent_scope)
 {
@@ -72,7 +72,6 @@ struct declaration_array *
        array_declaration->elem = elem_declaration;
        array_declaration->scope = new_declaration_scope(parent_scope);
        declaration->id = CTF_TYPE_ARRAY;
-       declaration->name = g_quark_from_string(name);
        /* No need to align the array, the first element will align itself */
        declaration->alignment = 1;
        declaration->copy = array_copy;
index 36e310b0d80ede1ef07b410d21231dccc161ef34..3f7d46bd423127578fffa4e077a448c67eac01a7 100644 (file)
@@ -392,7 +392,7 @@ void _enum_declaration_free(struct declaration *declaration)
 }
 
 struct declaration_enum *
-       _enum_declaration_new(const char *name, struct declaration_integer *integer_declaration)
+       _enum_declaration_new(struct declaration_integer *integer_declaration)
 {
        struct declaration_enum *enum_declaration;
 
@@ -409,7 +409,6 @@ struct declaration_enum *
        declaration_ref(&integer_declaration->p);
        enum_declaration->integer_declaration = integer_declaration;
        enum_declaration->p.id = CTF_TYPE_ENUM;
-       enum_declaration->p.name = g_quark_from_string(name);
        enum_declaration->p.alignment = 1;
        enum_declaration->p.copy = enum_copy;
        enum_declaration->p.declaration_free = _enum_declaration_free;
index 2f6a7f189910e517409a0836254d82aa58bb5d19..a719ee99b2dce596bad6bfe3ce600cc8c209c5fc 100644 (file)
@@ -67,7 +67,7 @@ void _sequence_declaration_free(struct declaration *declaration)
 }
 
 struct declaration_sequence *
-       sequence_declaration_new(const char *name, struct declaration_integer *len_declaration,
+       sequence_declaration_new(struct declaration_integer *len_declaration,
                          struct declaration *elem_declaration,
                          struct declaration_scope *parent_scope)
 {
@@ -83,7 +83,6 @@ struct declaration_sequence *
        sequence_declaration->elem = elem_declaration;
        sequence_declaration->scope = new_declaration_scope(parent_scope);
        declaration->id = CTF_TYPE_SEQUENCE;
-       declaration->name = g_quark_from_string(name);
        declaration->alignment = max(len_declaration->p.alignment, elem_declaration->alignment);
        declaration->copy = sequence_copy;
        declaration->declaration_free = _sequence_declaration_free;
index 41ac7576223b919920598d154e0eba64a5c46116..f8778c845052709464f110cba1099ab662ce2e59 100644 (file)
@@ -54,19 +54,20 @@ void _string_declaration_free(struct declaration *declaration)
        g_free(string_declaration);
 }
 
-struct declaration_string *string_declaration_new(const char *name)
+struct declaration_string *
+       string_declaration_new(enum ctf_string_encoding encoding)
 {
        struct declaration_string *string_declaration;
 
        string_declaration = g_new(struct declaration_string, 1);
        string_declaration->p.id = CTF_TYPE_STRING;
-       string_declaration->p.name = g_quark_from_string(name);
        string_declaration->p.alignment = CHAR_BIT;
        string_declaration->p.copy = string_copy;
        string_declaration->p.declaration_free = _string_declaration_free;
        string_declaration->p.definition_new = _string_definition_new;
        string_declaration->p.definition_free = _string_definition_free;
        string_declaration->p.ref = 1;
+       string_declaration->encoding = encoding;
        return string_declaration;
 }
 
index 21465c732ba0075af41dce513187bae386a262ee..69e3a553a2d64202344d8ca411af21daa07f7d8d 100644 (file)
@@ -74,8 +74,8 @@ void _struct_declaration_free(struct declaration *declaration)
        g_free(struct_declaration);
 }
 
-struct declaration_struct *struct_declaration_new(const char *name,
-                                   struct declaration_scope *parent_scope)
+struct declaration_struct *
+       struct_declaration_new(struct declaration_scope *parent_scope)
 {
        struct declaration_struct *struct_declaration;
        struct declaration *declaration;
@@ -89,7 +89,6 @@ struct declaration_struct *struct_declaration_new(const char *name,
                                                DEFAULT_NR_STRUCT_FIELDS);
        struct_declaration->scope = new_declaration_scope(parent_scope);
        declaration->id = CTF_TYPE_STRUCT;
-       declaration->name = g_quark_from_string(name);
        declaration->alignment = 1;
        declaration->copy = struct_copy;
        declaration->declaration_free = _struct_declaration_free;
index 2ab14a21cd4db6e9ecc031289553ff16702ed2d2..a61d895c274c5041e339e6c9e09eddb5f8ae40de 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* variant.c
+ * variant.c
  *
  * BabelTrace - Variant Type Converter
  *
@@ -68,7 +68,7 @@ void _untagged_variant_declaration_free(struct declaration *declaration)
        g_free(untagged_variant_declaration);
 }
 
-struct declaration_untagged_variant *untagged_variant_declaration_new(const char *name,
+struct declaration_untagged_variant *untagged_variant_declaration_new(
                                      struct declaration_scope *parent_scope)
 {
        struct declaration_untagged_variant *untagged_variant_declaration;
@@ -83,7 +83,6 @@ struct declaration_untagged_variant *untagged_variant_declaration_new(const char
                                                 DEFAULT_NR_STRUCT_FIELDS);
        untagged_variant_declaration->scope = new_declaration_scope(parent_scope);
        declaration->id = CTF_TYPE_UNTAGGED_VARIANT;
-       declaration->name = g_quark_from_string(name);
        declaration->alignment = 1;
        declaration->copy = NULL;
        declaration->declaration_free = _untagged_variant_declaration_free;
This page took 0.056673 seconds and 4 git commands to generate.