Add structure align() attribute, fix empty string support in definition paths
[babeltrace.git] / formats / ctf / metadata / ctf-visitor-semantic-validator.c
index af55eb4861d7163463b2efb9af095506cc2dce10..be5ed8f440e1b51c5672962f0684bc46ebf875d1 100644 (file)
@@ -70,14 +70,27 @@ int ctf_visitor_unary_expression(FILE *fd, int depth, struct ctf_node *node)
                 * We are the length of a type declarator.
                 */
                switch (node->u.unary_expression.type) {
-               case UNARY_SIGNED_CONSTANT:
                case UNARY_UNSIGNED_CONSTANT:
                        break;
                default:
-                       fprintf(fd, "[error]: semantic error (children of type declarator and enum can only be numeric constants)\n");
+                       fprintf(fd, "[error]: semantic error (children of type declarator and enum can only be unsigned numeric constants)\n");
                        goto errperm;
                }
                break;                  /* OK */
+
+       case NODE_STRUCT:
+               /*
+                * We are the size of a struct align attribute.
+                */
+               switch (node->u.unary_expression.type) {
+               case UNARY_UNSIGNED_CONSTANT:
+                       break;
+               default:
+                       fprintf(fd, "[error]: semantic error (structure alignment attribute can only be unsigned numeric constants)\n");
+                       goto errperm;
+               }
+               break;
+
        case NODE_ENUMERATOR:
                /* The enumerator's parent has validated its validity already. */
                break;                  /* OK */
@@ -106,7 +119,6 @@ int ctf_visitor_unary_expression(FILE *fd, int depth, struct ctf_node *node)
        case NODE_ENUM:
        case NODE_STRUCT_OR_VARIANT_DECLARATION:
        case NODE_VARIANT:
-       case NODE_STRUCT:
        default:
                goto errinval;
        }
This page took 0.027738 seconds and 4 git commands to generate.