This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, generic] Support printing of escaped curly braces and vertical bar in assembler output


>> 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.

Ping.

Richard, Jeff, could you please have a look?

--
Maxim Kuznetsov

Attachment: curly_braces_20130403.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]