diff options
author | Tom Tromey <tom@tromey.com> | 2018-07-22 10:05:14 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-08-28 11:28:15 -0600 |
commit | 5fe3f3e4633df1ea76ff24a2732d7c73dc983b90 (patch) | |
tree | d1becc89bac9fe3f418c0640d305ffc9c4398428 /gdb/go-exp.y | |
parent | 858d8004b05b572c07a414ae3933299976880bab (diff) | |
download | gdb-5fe3f3e4633df1ea76ff24a2732d7c73dc983b90.zip gdb-5fe3f3e4633df1ea76ff24a2732d7c73dc983b90.tar.gz gdb-5fe3f3e4633df1ea76ff24a2732d7c73dc983b90.tar.bz2 |
Remove some uses of VEC from parsers
This changes some uses of VEC in a few parsers to std::vector instead.
Tested by the buildbot.
gdb/ChangeLog
2018-08-28 Tom Tromey <tom@tromey.com>
* c-exp.y (struct token_and_value): Remove typedef and DEF_VEC.
(token_fifo): Now a std::vector.
(yylex, c_parse): Update.
* d-exp.y (struct token_and_value): Remove typedef and DEF_VEC.
(token_fifo): Now a std::vector.
(yylex, d_parse): Update.
* go-exp.y (struct token_and_value): Remove typedef and DEF_VEC.
(token_fifo): Now a std::vector.
(yylex, go_parse): Update.
Diffstat (limited to 'gdb/go-exp.y')
-rw-r--r-- | gdb/go-exp.y | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/gdb/go-exp.y b/gdb/go-exp.y index 47570d5..7521acc 100644 --- a/gdb/go-exp.y +++ b/gdb/go-exp.y @@ -1279,17 +1279,15 @@ lex_one_token (struct parser_state *par_state) } /* An object of this type is pushed on a FIFO by the "outer" lexer. */ -typedef struct +struct token_and_value { int token; YYSTYPE value; -} token_and_value; - -DEF_VEC_O (token_and_value); +}; /* A FIFO of tokens that have been read but not yet returned to the parser. */ -static VEC (token_and_value) *token_fifo; +static std::vector<token_and_value> token_fifo; /* Non-zero if the lexer should return tokens from the FIFO. */ static int popping; @@ -1485,10 +1483,10 @@ yylex (void) { token_and_value current, next; - if (popping && !VEC_empty (token_and_value, token_fifo)) + if (popping && !token_fifo.empty ()) { - token_and_value tv = *VEC_index (token_and_value, token_fifo, 0); - VEC_ordered_remove (token_and_value, token_fifo, 0); + token_and_value tv = token_fifo[0]; + token_fifo.erase (token_fifo.begin ()); yylval = tv.value; /* There's no need to fall through to handle package.name as that can never happen here. In theory. */ @@ -1541,13 +1539,11 @@ yylex (void) } } - VEC_safe_push (token_and_value, token_fifo, &next); - VEC_safe_push (token_and_value, token_fifo, &name2); + token_fifo.push_back (next); + token_fifo.push_back (name2); } else - { - VEC_safe_push (token_and_value, token_fifo, &next); - } + token_fifo.push_back (next); /* If we arrive here we don't have a package-qualified name. */ @@ -1571,7 +1567,7 @@ go_parse (struct parser_state *par_state) last_was_structop = 0; saw_name_at_eof = 0; - VEC_free (token_and_value, token_fifo); + token_fifo.clear (); popping = 0; name_obstack.clear (); |