This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Make two cp-name-parser.y constants "const"


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7b640f726819bedab1515ce49f03c0de26193b3b

commit 7b640f726819bedab1515ce49f03c0de26193b3b
Author: Tom Tromey <tom@tromey.com>
Date:   Wed May 30 08:19:01 2018 -0600

    Make two cp-name-parser.y constants "const"
    
    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.

Diff:
---
 gdb/ChangeLog        | 4 ++++
 gdb/cp-name-parser.y | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0c50d83..f1eed4e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
 
diff --git a/gdb/cp-name-parser.y b/gdb/cp-name-parser.y
index 169a92d..b8a3faa 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]