[RFA 5/5] Make two cp-name-parser.y constants "const"

Tom Tromey tom@tromey.com
Wed May 30 14:54:00 GMT 2018


This changes "backslashable" and "represented" in cp-name-parser.y to
be const.  This lets the compiler make them read-only (though in my
build it seems that GCC inlines them, which seems even better).

2018-05-30  Tom Tromey  <tom@tromey.com>

	* cp-name-parser.y (backslashable, represented): Now const.
---
 gdb/ChangeLog        | 4 ++++
 gdb/cp-name-parser.y | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/gdb/cp-name-parser.y b/gdb/cp-name-parser.y
index 169a92df6a7..b8a3faa3df8 100644
--- a/gdb/cp-name-parser.y
+++ b/gdb/cp-name-parser.y
@@ -1396,8 +1396,8 @@ parse_number (cpname_state *state, const char *p, int len, int parsed_float,
    return INT;
 }
 
-static char backslashable[] = "abefnrtv";
-static char represented[] = "\a\b\e\f\n\r\t\v";
+static const char backslashable[] = "abefnrtv";
+static const char represented[] = "\a\b\e\f\n\r\t\v";
 
 /* Translate the backslash the way we would in the host character set.  */
 static int
-- 
2.13.6



More information about the Gdb-patches mailing list