On 1/26/2016 8:11 AM, Segher Boessenkool wrote:
On Tue, Jan 26, 2016 at 01:11:36PM +0100, Bernd Schmidt wrote:
On 01/26/2016 01:29 AM, Segher Boessenkool wrote:

In my opinion we should not warn for any asm that means the same both
as basic and as extended asm.  The problem then becomes, what *is* the
meaning of a basic asm, what does it clobber.
I think this may be too hard to figure out in general without parsing
the asm string, which we don't really want to do.
That depends on the semantics of basic asm.  With the currently implemented
semantics, it is trivial.

Oh?

asm("cmp al, '#' # if (c == '#') {");

There's a '{', so it might look like it needs to be escaped, but it doesn't. The '{' is just part of a comment. And how do you know it's a comment? Because of the comment marker (#). And how do you know that it's a comment marker and not a literal? Only by doing more assembler parsing that I'm prepared to write.

But more importantly, consider this MIPS statement:

   asm ("sync");

That is the same for both basic and extended. But I absolutely want the warning to flag this statement. This is exactly the kind of "broken" statement that people need to be able to find/fix right now.

And when Jeff makes the changes to basic asm for v7, people may want to be able to find the statements that are affected by that in order to *stop* clobbering so many registers.

I'm not clear what people would use this warning for if we made the change you are suggesting.

dw

Reply via email to