Skip to content

C front-end: support inline (and its variants) after asm #5928

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions regression/ansi-c/asm2/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
int main()
{
int x, y;
#ifdef __GNUC__
#ifdef __GNUC__
asm goto ("jc %l[error];"
: : "r"(x), "r"(&y) : "memory" : error);
#endif
asm __inline volatile("jc %l[error];" : : "r"(x), "r"(&y) : "memory" : error);
#endif
error:
return 0;
}
7 changes: 3 additions & 4 deletions src/ansi-c/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -2675,10 +2675,9 @@ cprover_exception_statement:

volatile_or_goto_opt:
/* nothing */
| TOK_VOLATILE
| TOK_GOTO
| TOK_GOTO TOK_VOLATILE
| TOK_VOLATILE TOK_GOTO
| volatile_or_goto_opt TOK_VOLATILE
| volatile_or_goto_opt TOK_GOTO
| volatile_or_goto_opt TOK_INLINE
;

/* asm ( assembler template
Expand Down
3 changes: 3 additions & 0 deletions src/ansi-c/scanner.l
Original file line number Diff line number Diff line change
Expand Up @@ -1639,6 +1639,9 @@ __decltype { if(PARSER.cpp98 &&
"__volatile" { yyless(0); BEGIN(GRAMMAR); loc(); return TOK_GCC_ASM_PAREN; }
"__volatile__" { yyless(0); BEGIN(GRAMMAR); loc(); return TOK_GCC_ASM_PAREN; }
"goto" { yyless(0); BEGIN(GRAMMAR); loc(); return TOK_GCC_ASM_PAREN; }
"inline" { yyless(0); BEGIN(GRAMMAR); loc(); return TOK_GCC_ASM_PAREN; }
"__inline" { yyless(0); BEGIN(GRAMMAR); loc(); return TOK_GCC_ASM_PAREN; }
"__inline__" { yyless(0); BEGIN(GRAMMAR); loc(); return TOK_GCC_ASM_PAREN; }
. { yyless(0); BEGIN(GRAMMAR); loc(); PARSER.asm_block_following=true; return TOK_GCC_ASM; }
}

Expand Down