This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA 5/5] Make two cp-name-parser.y constants "const"
- From: Tom Tromey <tom at tromey dot com>
- To: gdb-patches at sourceware dot org
- Cc: Tom Tromey <tom at tromey dot com>
- Date: Wed, 30 May 2018 08:29:53 -0600
- Subject: [RFA 5/5] Make two cp-name-parser.y constants "const"
- References: <20180530142953.24934-1-tom@tromey.com>
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