output # <srcline> between #APP and #NO_APP, for asm statements

Alexandre Oliva aoliva@redhat.com
Sat Mar 3 05:50:00 GMT 2007


This patch arranges for us to emit # <line> "<source>" directives
within #APP/#NO_APP, such that errors in the assembly in asm
statements can be reported by the assembler using the source line
number.

A few gotchas:

- If the assembler doesn't recognize # <line>, this won't work.  Since
  it's comment, it shouldn't cause problems either.

- If the line breaks in the asm statement don't match line breaks in
  the asm output, the line number won't quite match the precise
  location of the error.

- There's no currently way to tell the assembler to return to whatever
  logical line number it had before we switch to an "included" file.
  I've adopted '# 0 "" 2' to convey this information, but current
  assemblers don't implement this.  As a result, if there's any error
  in the assembly output emitted by the compiler, it will issue error
  messages referring to the empty file name and a wrong line number.
  It won't reject this line, though.

Tested on x86_64-linux-gnu.  Ok to install?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-asm-line.patch
Type: text/x-patch
Size: 12858 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070303/5c4b1362/attachment.bin>
-------------- next part --------------

-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
FSF Latin America Board Member         http://www.fsfla.org/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}


More information about the Gcc-patches mailing list