Thank you for your feedback!

> For '}' case, can you simply just add
>
> /* Skip over any character after a percent sign.  */
> if (*p == '%' && *(p + 1))
> {
>   p += 2;
>   continue;
> }
>
> without changing the do-while loop to the while loop?

Loop condition (*p++ != '}') must be moved to loop body for it to not
execute after "continue" (we just want to skip over % with following
character without any other increments or checks). Although, loop form
doesn't matter so I changed it back to do-while.

> That's not the same thing though.  Maksim's code is correct,
> although it could certainly be written more clearly.
> Maybe something like
>
>   if (*p == '%')
>     p++;
>   if (*p)
>     p++;

Fixed.


I also noticed that previous patch broke intel (or any alternative)
syntax. This was because the original loop:

while (*p && *p != '}' && *p++ != '|');

incremented p after '|' is found, but loop in my patch didn't:

while (*p && *p != '}' && *p != '|')
  p += (*p == '%' && *(p + 1)) ? 2 : 1;

I fixed it too.

Updated patch is attached. Could you please have a look?

ChangeLog:

2013-04-03  Maxim Kuznetsov  <maks.kuznet...@gmail.com>

        * final.c (do_assembler_dialects): Don't handle curly braces
        escaped by % as dialect delimiters.
        * config/i386/i386.c (ix86_print_operand_punct_valid_p): Add '{' and
        '}'.
        (ix86_print_operand): Handle '{' and '}'.

testsuite/ChangeLog:

2013-04-03  Maxim Kuznetsov  <maks.kuznet...@gmail.com>

        * gcc.target/i386/asm-dialect-2.c: New testcase.

--
Maxim Kuznetsov

Attachment: curly_braces_20130403.patch
Description: Binary data

Reply via email to