md-files: Add a note about escaped quotes in braced strings in md files

Message ID 20241031231302.2405042-1-quic_apinski@quicinc.com
State Committed
Commit 4aa4162e365023896ebf6ed56bf0a00994c50639
Headers
Series md-files: Add a note about escaped quotes in braced strings in md files |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 pending Patch applied

Commit Message

Andrew Pinski Oct. 31, 2024, 11:13 p.m. UTC
  While looking into PR 33532, It was noted that \" would be treated
still as " for braced strings in the md file. I think that is still
the correct thing to do. So let's just a note to the documentation
on this behavior and NOT change read-md.cc (read_braced_string).
Since this behavior has been there for the last 23 years and only
one person ran into this behavior and helped with the conversion
from using quoted strings to braced strings; that is you just need
to remove the quote around the brace rather than change all of the
code.

Build the documentation to make sure it looks correct.

gcc/ChangeLog:

	* doc/rtl.texi: Add a note about quotes in braced strings.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
---
 gcc/doc/rtl.texi | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
  

Comments

Jeff Law Nov. 23, 2024, 4:24 a.m. UTC | #1
On 10/31/24 5:13 PM, Andrew Pinski wrote:
> While looking into PR 33532, It was noted that \" would be treated
> still as " for braced strings in the md file. I think that is still
> the correct thing to do. So let's just a note to the documentation
> on this behavior and NOT change read-md.cc (read_braced_string).
> Since this behavior has been there for the last 23 years and only
> one person ran into this behavior and helped with the conversion
> from using quoted strings to braced strings; that is you just need
> to remove the quote around the brace rather than change all of the
> code.
> 
> Build the documentation to make sure it looks correct.
> 
> gcc/ChangeLog:
> 
> 	* doc/rtl.texi: Add a note about quotes in braced strings.
OK
jeff
  

Patch

diff --git a/gcc/doc/rtl.texi b/gcc/doc/rtl.texi
index 0cb36aae09b..8b6edcd6249 100644
--- a/gcc/doc/rtl.texi
+++ b/gcc/doc/rtl.texi
@@ -85,7 +85,10 @@  appear, it is also valid to write a C-style brace block.  The entire
 brace block, including the outermost pair of braces, is considered to be
 the string constant.  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.
+need not escape each quote character with a backslash. Note escaped quotes
+are treated the same as a plain quote character and if you need a escaped
+quote in a C string, you need an extra backslash to escape the backslash
+like @code{"a=\\"c\\";"}.
 
 A vector contains an arbitrary number of pointers to expressions.  The
 number of elements in the vector is explicitly present in the vector.