From 10120fe4d9980139e44012888a91716df2edf2e0 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Mon, 29 Dec 2014 11:51:25 +0100 Subject: Support "asm volatile" (closes: PR#5). The CompCert back-end already treats "asm" inserts as "volatile" in GCC's sense (performing unpredictable side-effects), so no change is required outside of the parser. --- cparser/Parser.vy | 2 ++ cparser/pre_parser.mly | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cparser/Parser.vy b/cparser/Parser.vy index ce1beae0..a058a8d1 100644 --- a/cparser/Parser.vy +++ b/cparser/Parser.vy @@ -822,6 +822,8 @@ jump_statement: asm_statement: | loc = ASM LPAREN template = STRING_LITERAL RPAREN SEMICOLON { let '(wide, chars, _) := template in ASM wide chars loc } +| loc = ASM VOLATILE LPAREN template = STRING_LITERAL RPAREN SEMICOLON + { let '(wide, chars, _) := template in ASM wide chars loc } (* 6.9 *) translation_unit_file: diff --git a/cparser/pre_parser.mly b/cparser/pre_parser.mly index 4755518b..ef356d3a 100644 --- a/cparser/pre_parser.mly +++ b/cparser/pre_parser.mly @@ -616,7 +616,7 @@ jump_statement: {} asm_statement: -| ASM LPAREN string_literals_list RPAREN SEMICOLON +| ASM VOLATILE? LPAREN string_literals_list RPAREN SEMICOLON {} translation_unit_file: -- cgit