Add missing permission notice in each source file
[babeltrace.git] / formats / ctf / metadata / ctf-visitor-parent-links.c
index 707f03a5c20af4e71fe626985ce68e97b958f9ee..953727e84c3eccc809328f7f7ca6f82e8c7e0cc7 100644 (file)
  *
  * 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.
  */
 
 #include <stdio.h>
@@ -24,6 +32,7 @@
 #include <glib.h>
 #include <inttypes.h>
 #include <errno.h>
+#include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/list.h>
 #include "ctf-scanner.h"
 #include "ctf-parser.h"
@@ -127,14 +136,12 @@ int ctf_visitor_type_declarator(FILE *fd, int depth, struct ctf_node *node)
 
        depth++;
 
-       if (!cds_list_empty(&node->u.type_declarator.pointers)) {
-               cds_list_for_each_entry(iter, &node->u.type_declarator.pointers,
-                                       siblings) {
-                       iter->parent = node;
-                       ret = ctf_visitor_parent_links(fd, depth + 1, iter);
-                       if (ret)
-                               return ret;
-               }
+       bt_list_for_each_entry(iter, &node->u.type_declarator.pointers,
+                               siblings) {
+               iter->parent = node;
+               ret = ctf_visitor_parent_links(fd, depth + 1, iter);
+               if (ret)
+                       return ret;
        }
 
        switch (node->u.type_declarator.type) {
@@ -148,11 +155,14 @@ int ctf_visitor_type_declarator(FILE *fd, int depth, struct ctf_node *node)
                        if (ret)
                                return ret;
                }
-               if (node->u.type_declarator.u.nested.length) {
-                       node->u.type_declarator.u.nested.length->parent = node;
-                       ret = ctf_visitor_parent_links(fd, depth + 1, node->u.type_declarator.u.nested.length);
-                       if (ret)
-                               return ret;
+               if (!node->u.type_declarator.u.nested.abstract_array) {
+                       bt_list_for_each_entry(iter, &node->u.type_declarator.u.nested.length,
+                                               siblings) {
+                               iter->parent = node;
+                               ret = ctf_visitor_parent_links(fd, depth + 1, iter);
+                               if (ret)
+                                       return ret;
+                       }
                }
                if (node->u.type_declarator.bitfield_len) {
                        node->u.type_declarator.bitfield_len = node;
@@ -179,25 +189,37 @@ int ctf_visitor_parent_links(FILE *fd, int depth, struct ctf_node *node)
 
        switch (node->type) {
        case NODE_ROOT:
-               cds_list_for_each_entry(iter, &node->u.root.declaration_list, siblings) {
+               bt_list_for_each_entry(iter, &node->u.root.declaration_list, siblings) {
                        iter->parent = node;
                        ret = ctf_visitor_parent_links(fd, depth + 1, iter);
                        if (ret)
                                return ret;
                }
-               cds_list_for_each_entry(iter, &node->u.root.trace, siblings) {
+               bt_list_for_each_entry(iter, &node->u.root.trace, siblings) {
                        iter->parent = node;
                        ret = ctf_visitor_parent_links(fd, depth + 1, iter);
                        if (ret)
                                return ret;
                }
-               cds_list_for_each_entry(iter, &node->u.root.stream, siblings) {
+               bt_list_for_each_entry(iter, &node->u.root.stream, siblings) {
                        iter->parent = node;
                        ret = ctf_visitor_parent_links(fd, depth + 1, iter);
                        if (ret)
                                return ret;
                }
-               cds_list_for_each_entry(iter, &node->u.root.event, siblings) {
+               bt_list_for_each_entry(iter, &node->u.root.event, siblings) {
+                       iter->parent = node;
+                       ret = ctf_visitor_parent_links(fd, depth + 1, iter);
+                       if (ret)
+                               return ret;
+               }
+               bt_list_for_each_entry(iter, &node->u.root.clock, siblings) {
+                       iter->parent = node;
+                       ret = ctf_visitor_parent_links(fd, depth + 1, iter);
+                       if (ret)
+                               return ret;
+               }
+               bt_list_for_each_entry(iter, &node->u.root.callsite, siblings) {
                        iter->parent = node;
                        ret = ctf_visitor_parent_links(fd, depth + 1, iter);
                        if (ret)
@@ -206,7 +228,7 @@ int ctf_visitor_parent_links(FILE *fd, int depth, struct ctf_node *node)
                break;
 
        case NODE_EVENT:
-               cds_list_for_each_entry(iter, &node->u.event.declaration_list, siblings) {
+               bt_list_for_each_entry(iter, &node->u.event.declaration_list, siblings) {
                        iter->parent = node;
                        ret = ctf_visitor_parent_links(fd, depth + 1, iter);
                        if (ret)
@@ -214,7 +236,15 @@ int ctf_visitor_parent_links(FILE *fd, int depth, struct ctf_node *node)
                }
                break;
        case NODE_STREAM:
-               cds_list_for_each_entry(iter, &node->u.stream.declaration_list, siblings) {
+               bt_list_for_each_entry(iter, &node->u.stream.declaration_list, siblings) {
+                       iter->parent = node;
+                       ret = ctf_visitor_parent_links(fd, depth + 1, iter);
+                       if (ret)
+                               return ret;
+               }
+               break;
+       case NODE_ENV:
+               bt_list_for_each_entry(iter, &node->u.env.declaration_list, siblings) {
                        iter->parent = node;
                        ret = ctf_visitor_parent_links(fd, depth + 1, iter);
                        if (ret)
@@ -222,7 +252,23 @@ int ctf_visitor_parent_links(FILE *fd, int depth, struct ctf_node *node)
                }
                break;
        case NODE_TRACE:
-               cds_list_for_each_entry(iter, &node->u.trace.declaration_list, siblings) {
+               bt_list_for_each_entry(iter, &node->u.trace.declaration_list, siblings) {
+                       iter->parent = node;
+                       ret = ctf_visitor_parent_links(fd, depth + 1, iter);
+                       if (ret)
+                               return ret;
+               }
+               break;
+       case NODE_CLOCK:
+               bt_list_for_each_entry(iter, &node->u.clock.declaration_list, siblings) {
+                       iter->parent = node;
+                       ret = ctf_visitor_parent_links(fd, depth + 1, iter);
+                       if (ret)
+                               return ret;
+               }
+               break;
+       case NODE_CALLSITE:
+               bt_list_for_each_entry(iter, &node->u.callsite.declaration_list, siblings) {
                        iter->parent = node;
                        ret = ctf_visitor_parent_links(fd, depth + 1, iter);
                        if (ret)
@@ -232,13 +278,13 @@ int ctf_visitor_parent_links(FILE *fd, int depth, struct ctf_node *node)
 
        case NODE_CTF_EXPRESSION:
                depth++;
-               cds_list_for_each_entry(iter, &node->u.ctf_expression.left, siblings) {
+               bt_list_for_each_entry(iter, &node->u.ctf_expression.left, siblings) {
                        iter->parent = node;
                        ret = ctf_visitor_parent_links(fd, depth + 1, iter);
                        if (ret)
                                return ret;
                }
-               cds_list_for_each_entry(iter, &node->u.ctf_expression.right, siblings) {
+               bt_list_for_each_entry(iter, &node->u.ctf_expression.right, siblings) {
                        iter->parent = node;
                        ret = ctf_visitor_parent_links(fd, depth + 1, iter);
                        if (ret)
@@ -255,7 +301,7 @@ int ctf_visitor_parent_links(FILE *fd, int depth, struct ctf_node *node)
                ret = ctf_visitor_parent_links(fd, depth + 1, node->u._typedef.type_specifier_list);
                if (ret)
                        return ret;
-               cds_list_for_each_entry(iter, &node->u._typedef.type_declarators, siblings) {
+               bt_list_for_each_entry(iter, &node->u._typedef.type_declarators, siblings) {
                        iter->parent = node;
                        ret = ctf_visitor_parent_links(fd, depth + 1, iter);
                        if (ret)
@@ -269,7 +315,7 @@ int ctf_visitor_parent_links(FILE *fd, int depth, struct ctf_node *node)
                ret = ctf_visitor_parent_links(fd, depth + 1, node->u.typealias_target.type_specifier_list);
                if (ret)
                        return ret;
-               cds_list_for_each_entry(iter, &node->u.typealias_target.type_declarators, siblings) {
+               bt_list_for_each_entry(iter, &node->u.typealias_target.type_declarators, siblings) {
                        iter->parent = node;
                        ret = ctf_visitor_parent_links(fd, depth + 1, iter);
                        if (ret)
@@ -283,7 +329,7 @@ int ctf_visitor_parent_links(FILE *fd, int depth, struct ctf_node *node)
                ret = ctf_visitor_parent_links(fd, depth + 1, node->u.typealias_alias.type_specifier_list);
                if (ret)
                        return ret;
-               cds_list_for_each_entry(iter, &node->u.typealias_alias.type_declarators, siblings) {
+               bt_list_for_each_entry(iter, &node->u.typealias_alias.type_declarators, siblings) {
                        iter->parent = node;
                        ret = ctf_visitor_parent_links(fd, depth + 1, iter);
                        if (ret)
@@ -303,7 +349,7 @@ int ctf_visitor_parent_links(FILE *fd, int depth, struct ctf_node *node)
                break;
 
        case NODE_TYPE_SPECIFIER_LIST:
-               cds_list_for_each_entry(iter, &node->u.type_specifier_list.head, siblings) {
+               bt_list_for_each_entry(iter, &node->u.type_specifier_list.head, siblings) {
                        iter->parent = node;
                        ret = ctf_visitor_parent_links(fd, depth + 1, iter);
                        if (ret)
@@ -325,7 +371,7 @@ int ctf_visitor_parent_links(FILE *fd, int depth, struct ctf_node *node)
                break;
 
        case NODE_FLOATING_POINT:
-               cds_list_for_each_entry(iter, &node->u.floating_point.expressions, siblings) {
+               bt_list_for_each_entry(iter, &node->u.floating_point.expressions, siblings) {
                        iter->parent = node;
                        ret = ctf_visitor_parent_links(fd, depth + 1, iter);
                        if (ret)
@@ -333,7 +379,7 @@ int ctf_visitor_parent_links(FILE *fd, int depth, struct ctf_node *node)
                }
                break;
        case NODE_INTEGER:
-               cds_list_for_each_entry(iter, &node->u.integer.expressions, siblings) {
+               bt_list_for_each_entry(iter, &node->u.integer.expressions, siblings) {
                        iter->parent = node;
                        ret = ctf_visitor_parent_links(fd, depth + 1, iter);
                        if (ret)
@@ -341,7 +387,7 @@ int ctf_visitor_parent_links(FILE *fd, int depth, struct ctf_node *node)
                }
                break;
        case NODE_STRING:
-               cds_list_for_each_entry(iter, &node->u.string.expressions, siblings) {
+               bt_list_for_each_entry(iter, &node->u.string.expressions, siblings) {
                        iter->parent = node;
                        ret = ctf_visitor_parent_links(fd, depth + 1, iter);
                        if (ret)
@@ -349,7 +395,7 @@ int ctf_visitor_parent_links(FILE *fd, int depth, struct ctf_node *node)
                }
                break;
        case NODE_ENUMERATOR:
-               cds_list_for_each_entry(iter, &node->u.enumerator.values, siblings) {
+               bt_list_for_each_entry(iter, &node->u.enumerator.values, siblings) {
                        iter->parent = node;
                        ret = ctf_visitor_parent_links(fd, depth + 1, iter);
                        if (ret)
@@ -364,7 +410,7 @@ int ctf_visitor_parent_links(FILE *fd, int depth, struct ctf_node *node)
                                return ret;
                }
 
-               cds_list_for_each_entry(iter, &node->u._enum.enumerator_list, siblings) {
+               bt_list_for_each_entry(iter, &node->u._enum.enumerator_list, siblings) {
                        iter->parent = node;
                        ret = ctf_visitor_parent_links(fd, depth + 1, iter);
                        if (ret)
@@ -378,7 +424,7 @@ int ctf_visitor_parent_links(FILE *fd, int depth, struct ctf_node *node)
                        node->u.struct_or_variant_declaration.type_specifier_list);
                if (ret)
                        return ret;
-               cds_list_for_each_entry(iter, &node->u.struct_or_variant_declaration.type_declarators, siblings) {
+               bt_list_for_each_entry(iter, &node->u.struct_or_variant_declaration.type_declarators, siblings) {
                        iter->parent = node;
                        ret = ctf_visitor_parent_links(fd, depth + 1, iter);
                        if (ret)
@@ -386,7 +432,7 @@ int ctf_visitor_parent_links(FILE *fd, int depth, struct ctf_node *node)
                }
                break;
        case NODE_VARIANT:
-               cds_list_for_each_entry(iter, &node->u.variant.declaration_list, siblings) {
+               bt_list_for_each_entry(iter, &node->u.variant.declaration_list, siblings) {
                        iter->parent = node;
                        ret = ctf_visitor_parent_links(fd, depth + 1, iter);
                        if (ret)
@@ -394,7 +440,14 @@ int ctf_visitor_parent_links(FILE *fd, int depth, struct ctf_node *node)
                }
                break;
        case NODE_STRUCT:
-               cds_list_for_each_entry(iter, &node->u._struct.declaration_list, siblings) {
+               bt_list_for_each_entry(iter, &node->u._struct.declaration_list, siblings) {
+                       iter->parent = node;
+                       ret = ctf_visitor_parent_links(fd, depth + 1, iter);
+                       if (ret)
+                               return ret;
+               }
+               bt_list_for_each_entry(iter, &node->u._struct.min_align,
+                                       siblings) {
                        iter->parent = node;
                        ret = ctf_visitor_parent_links(fd, depth + 1, iter);
                        if (ret)
This page took 0.028201 seconds and 4 git commands to generate.