On 11/22/24 2:45 AM, Jakub Jelinek wrote:
On Thu, Nov 21, 2024 at 09:32:51PM +0000, Joseph Myers wrote:
On Sat, 2 Nov 2024, Jakub Jelinek wrote:
+Extended @code{asm} statements outside of functions may not use any
+qualifiers, may not specify clobbers, may not use @code{%}, @code{+} or
+@code{&} modifiers in constraints and can only use constraints which don%'t
+allow using any register.
Just ' in Texinfo, not %'.
@@ -3071,7 +3072,62 @@ c_parser_declaration_or_fndef (c_parser
static void
c_parser_asm_definition (c_parser *parser)
{
- tree asm_str = c_parser_simple_asm_expr (parser);
+ location_t asm_loc = c_parser_peek_token (parser)->location;
The syntax comment above this function needs updating.
The C front-end changes are OK with that fix.
Thanks.
Here is the adjusted patch.
2024-11-22 Jakub Jelinek <ja...@redhat.com>
PR c/41045
gcc/
* output.h (insn_noperands): Declare.
* final.cc (insn_noperands): No longer static.
* varasm.cc (assemble_asm): Handle ASM_EXPR.
* lto-streamer-out.cc (lto_output_toplevel_asms): Add sorry_at
for non-STRING_CST toplevel asm for now.
* doc/extend.texi (Basic @code{asm}, Extended @code{asm}): Document
that extended asm is now allowed outside of functions with certain
restrictions.
gcc/c/
* c-parser.cc (c_parser_asm_string_literal): Add forward declaration.
(c_parser_asm_definition): Parse also extended asm without
clobbers/labels.
* c-typeck.cc (build_asm_expr): Allow extended asm outside of
functions and check extra restrictions.
gcc/cp/
* cp-tree.h (finish_asm_stmt): Add TOPLEV_P argument.
* parser.cc (cp_parser_asm_definition): Parse also extended asm
without clobbers/labels outside of functions.
* semantics.cc (finish_asm_stmt): Add TOPLEV_P argument, if set,
check extra restrictions for extended asm outside of functions.
* pt.cc (tsubst_stmt): Adjust finish_asm_stmt caller.
gcc/testsuite/
* c-c++-common/toplevel-asm-1.c: New test.
* c-c++-common/toplevel-asm-2.c: New test.
* c-c++-common/toplevel-asm-3.c: New test.
final/varasm/lto bits are fine. Consider adding the note about the LTO
limitation in the documentation blurb.
Jason will need to chime in on the C++ FE bits if he hasn't already.
Thanks,
jeff