X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fgo-exp.y;h=7521acc7f52b546f8202b26d09e7ba90a1be1730;hb=e98ee8c458f3a8405eb93e71b00f801b4bbe3635;hp=a96e65534fdf5ec96a0b0da5eeb9da83d07223b9;hpb=aee1fcdf979d65c7623533ddd6d871767be9de13;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/go-exp.y b/gdb/go-exp.y index a96e65534f..7521acc7f5 100644 --- a/gdb/go-exp.y +++ b/gdb/go-exp.y @@ -81,7 +81,7 @@ int yyparse (void); static int yylex (void); -void yyerror (const char *); +static void yyerror (const char *); %} @@ -1088,7 +1088,7 @@ lex_one_token (struct parser_state *par_state) last_was_structop = 1; goto symbol; /* Nope, must be a symbol. */ } - /* FALL THRU into number case. */ + /* FALL THRU. */ case '0': case '1': @@ -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_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,18 +1567,18 @@ 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 (); return yyparse (); } -void +static void yyerror (const char *msg) { if (prev_lexptr) lexptr = prev_lexptr; - error (_("A %s in expression, near `%s'."), (msg ? msg : "error"), lexptr); + error (_("A %s in expression, near `%s'."), msg, lexptr); }