Make two cp-name-parser.y constants "const"
authorTom Tromey <tom@tromey.com>
Wed, 30 May 2018 14:19:01 +0000 (08:19 -0600)
committerTom Tromey <tom@tromey.com>
Fri, 1 Jun 2018 16:46:49 +0000 (10:46 -0600)
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).

gdb/ChangeLog
2018-06-01  Tom Tromey  <tom@tromey.com>

* cp-name-parser.y (backslashable, represented): Now const.

gdb/ChangeLog
gdb/cp-name-parser.y

index 0c50d83..f1eed4e 100644 (file)
@@ -1,5 +1,9 @@
 2018-06-01  Tom Tromey  <tom@tromey.com>
 
+       * cp-name-parser.y (backslashable, represented): Now const.
+
+2018-06-01  Tom Tromey  <tom@tromey.com>
+
        * cp-name-parser.y: Include parser-defs.h.
        (parser_fprintf): Remove declaration.
 
index 169a92d..b8a3faa 100644 (file)
@@ -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