http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57950

--- Comment #8 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Andreas Schwab from comment #7)
> There is no way to know how the newline was written.

Sorry I don't get this. Could you elaborate?

There are some technical limitations of GCC:

* string constants don't have their own location:
* asm expressions only have one location (starting at the "asm" keyword)
* GCC currently doesn't look at all into the string constant given to an asm
expression.

First, it is not clear that the location given to asm expressions needs to be
the location of the asm keyword. It could be the location of the string and it
would be already an improvement.

Second, when printing the assembler, GCC can check for newlines and simply
print the line directive after each newline. I see one potential problem:

 static void f1 ()
{
  __asm__ ("foo\n"
           "foo");
}

This works OK now by pure chance but it will be broken by the above trick. To
reliably fix this, GCC must learn to track locations of multi-line strings.
Interestingly, the same problem we face when improving the diagnostics for
-Wformat: PR52952

Reply via email to