X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=formats%2Fctf%2Fmetadata%2Fctf-visitor-semantic-validator.c;h=be5ed8f440e1b51c5672962f0684bc46ebf875d1;hb=b7e35badc2eac52e27b802a9078bfb7c8f3b04a7;hp=af55eb4861d7163463b2efb9af095506cc2dce10;hpb=71444c467e00f96d6b0efaa0eeaaefc4bde615de;p=babeltrace.git diff --git a/formats/ctf/metadata/ctf-visitor-semantic-validator.c b/formats/ctf/metadata/ctf-visitor-semantic-validator.c index af55eb48..be5ed8f4 100644 --- a/formats/ctf/metadata/ctf-visitor-semantic-validator.c +++ b/formats/ctf/metadata/ctf-visitor-semantic-validator.c @@ -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; }