add docs for assembly and fix global assembly parsing

Previously, global assembly was parsed expecting it to have
the template syntax. However global assembly has no inputs,
outputs, or clobbers, and thus does not have template syntax.
This is now fixed.

This commit also adds a compile error for using volatile
on global assembly, since it is meaningless.

closes #1515
This commit is contained in:
Andrew Kelley
2019-03-20 19:00:23 -04:00
parent 3c7555cb67
commit 15c316b0d8
10 changed files with 417 additions and 167 deletions

View File

@@ -862,8 +862,8 @@ static void render_node_extra(AstRender *ar, AstNode *node, bool grouped) {
case NodeTypeAsmExpr:
{
AstNodeAsmExpr *asm_expr = &node->data.asm_expr;
const char *volatile_str = asm_expr->is_volatile ? " volatile" : "";
fprintf(ar->f, "asm%s (\"%s\"\n", volatile_str, buf_ptr(asm_expr->asm_template));
const char *volatile_str = (asm_expr->volatile_token != nullptr) ? " volatile" : "";
fprintf(ar->f, "asm%s (\"%s\"\n", volatile_str, buf_ptr(&asm_expr->asm_template->data.str_lit.str));
print_indent(ar);
fprintf(ar->f, ": ");
for (size_t i = 0; i < asm_expr->output_list.length; i += 1) {