https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33532

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |documentation,
                   |                            |internal-improvement
            Summary|bogus escape                |extra escapes in ia64.md
                   |                            |after conversion to use
                   |                            |braced strings

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note the original code used to do:
  "
{
  emit_library_call (gen_rtx_SYMBOL_REF (Pmode,
                                         \"__ia64_save_stack_nonlocal\"),
                     LCT_NORMAL, VOIDmode, XEXP (operands[0], 0), Pmode,
                     operands[1], Pmode);
  DONE;
}")

So there was a need to escape the quotes in that case.

Note ia64.md changed with r0-42897-g1d5d7a21e00696
(https://inbox.sourceware.org/gcc-patches/20020517005241.a26...@redhat.com/)
which removed the outer quotes to use the braced strings.

And the braced strings support was added by
https://gcc.gnu.org/pipermail/gcc-patches/2001-June/053023.html
which was after the original IA64 port was added.

So the escaped quotes is an artifact of a semi-incomplete conversions.

As far as your artificial pattern, there needs to be extra escape for the `\`
there as the md file reader thinks `\"` is just `"`.

That is it should be:
```
(define_insn "artificial"
  [(unspec [(const_int 0)] 9999)]
  ""
{
  return ".section .artificial,\\"r\\",@progbits";
}
  [(set_attr "itanium_class" "ignore")
   (set_attr "predicable" "no")])
```

Maybe the document here could be improved slightly too.

Right now the documentation says:
```
 Double quote characters inside the braces are not
special.  Therefore, if you write string constants in the C code, you
need not escape each quote character with a backslash.
```

But maybe it should be
```
Double quote characters inside the braces are not
special.  Therefore, if you write string constants in the C code, you
need not escape each quote character with a backslash. Note escaped quotes are
treated similarly as quote character and if you need a escaped quote in a C
string, you need an extra backslash to escape the backslash like @code{"\\""}.
```

I will post a patch to update the documentation there.

Reply via email to