2005-03-11 10:24:23 +08:00
|
|
|
|
/* YACC parser for C++ names, for GDB.
|
|
|
|
|
|
2024-01-12 23:30:44 +08:00
|
|
|
|
Copyright (C) 2003-2024 Free Software Foundation, Inc.
|
2005-03-11 10:24:23 +08:00
|
|
|
|
|
|
|
|
|
Parts of the lexer are based on c-exp.y from GDB.
|
|
|
|
|
|
2009-03-18 16:51:11 +08:00
|
|
|
|
This file is part of GDB.
|
2005-03-11 10:24:23 +08:00
|
|
|
|
|
2009-03-18 16:51:11 +08:00
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
|
|
|
(at your option) any later version.
|
2005-03-11 10:24:23 +08:00
|
|
|
|
|
2009-03-18 16:51:11 +08:00
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
2005-03-11 10:24:23 +08:00
|
|
|
|
|
2009-03-18 16:51:11 +08:00
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
2005-03-11 10:24:23 +08:00
|
|
|
|
|
|
|
|
|
/* Note that malloc's and realloc's in this file are transformed to
|
|
|
|
|
xmalloc and xrealloc respectively by the same sed command in the
|
|
|
|
|
makefile that remaps any other malloc/realloc inserted by the parser
|
|
|
|
|
generator. Doing this with #defines and trying to control the interaction
|
|
|
|
|
with include files (<malloc.h> and <stdlib.h> for example) just became
|
|
|
|
|
too messy, particularly when such includes can be inserted at random
|
|
|
|
|
times by the parser generator. */
|
|
|
|
|
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
/* The Bison manual says that %pure-parser is deprecated, but we use
|
|
|
|
|
it anyway because it also works with Byacc. That is also why
|
|
|
|
|
this uses %lex-param and %parse-param rather than the simpler
|
|
|
|
|
%param -- Byacc does not support the latter. */
|
|
|
|
|
%pure-parser
|
|
|
|
|
%lex-param {struct cpname_state *state}
|
|
|
|
|
%parse-param {struct cpname_state *state}
|
|
|
|
|
|
2005-03-11 10:24:23 +08:00
|
|
|
|
%{
|
|
|
|
|
|
2008-08-26 05:50:25 +08:00
|
|
|
|
|
2005-03-11 10:24:23 +08:00
|
|
|
|
#include <unistd.h>
|
2023-04-18 04:33:15 +08:00
|
|
|
|
#include "gdbsupport/gdb-safe-ctype.h"
|
2005-03-11 10:24:23 +08:00
|
|
|
|
#include "demangle.h"
|
2008-02-21 Pedro Alves <pedro@codesorcery.com>
Silence a few -Wmissing-prototypes warnings.
PR build/9877:
* amd64-nat.c: Include "amd64-nat.h".
* fork-child.c (_initialize_fork_child): Ditto.
* gcore.c (_initialize_gcore): Ditto.
* inf-ptrace.c: Include "inf-ptrace.h".
(inf_ptrace_store_registers): Make it static.
* linux-nat.c (linux_nat_terminal_ours): Make it static.
(_initialize_linux_nat): Declare before definition.
* linux-tdep.c: Include "linux-tdep.h".
* linux-thread-db.c (_initialize_thread_db): Declare before
definition.
* proc-service.c (_initialize_proc_service): Ditto.
* remote.c (remote_send_printf): Make it static.
* solib.c: Include "solib.h".
* symfile-mem.c (_initialize_symfile_mem): Declare before
definition.
* ada-lang.c (ada_la_decode, ada_match_name)
(ada_suppress_symbol_printing, ada_is_array_type)
(ada_value_ptr_subscript, ada_array_length)
(ada_to_static_fixed_value): Make them static.
(_initialize_ada_language): Declare before definition.
* ada-tasks.c (ada_get_task_number, ada_get_environment_task)
(ada_task_list_changed, ada_new_objfile_observer): Make them
static.
(_initialize_tasks): Declare before definition.
* addrmap.c (_initialize_addrmap): Declare before definition.
* auxv.c (default_auxv_parse): Make it static.
* bfd-target.c (target_bfd_xfer_partial, target_bfd_xclose): Make
them static.
* breakpoint.c (remove_sal): Add line break.
(expand_line_sal_maybe): Make it static.
* cp-name-parser.y: Include "cp-support.h".
* cp-valprint.c (cp_find_class_member): Make it static.
* eval.c (value_f90_subarray): Ditto.
* exceptions.c (print_any_exception): Ditto.
* findcmd.c (_initialize_mem_search): Declare before definition.
* frame.c (frame_observer_target_changed): Make it static.
* gnu-v3-abi.c (gnuv3_find_method_in): Make it static.
* inf-child.c: Include "inf-child.h".
* inferior.h (valid_inferior_id): Rename to ...
(valid_gdb_inferior_id): ... this.
* infrun.c (infrun_thread_stop_requested, siginfo_make_value):
Make them static.
* jv-lang.c (java_language_arch_info): Make it static.
* m2-typeprint.c (m2_get_discrete_bounds): Ditto.
* osdata.c (info_osdata_command): Make it static.
* regcache.c (regcache_observer_target_changed): Make it static.
* reverse.c (_initialize_reverse): Declare before definition.
* stabsread.c (cleanup_undefined_types_noname)
(cleanup_undefined_types_1): Make them static.
* symfile.c (place_section): Make it static.
* symtab.c (find_pc_sect_psymtab_closer): Make it static.
* target-descriptions.c (_initialize_target_descriptions): Declare
before definition.
* target.c (default_get_ada_task_ptid, find_default_can_async_p)
(find_default_is_async_p, find_default_supports_non_stop): Make
them static.
(target_supports_non_stop): Add prototype.
(dummy_pid_to_str): Make it static.
* utils.c (_initialize_utils): Declare before definition.
* ada-exp.y (_initialize_ada_exp): Declare before definition.
* solib-svr4.c (HAS_LM_DYNAMIC_FROM_LINK_MAP): Add a prototype.
* target.h (struct target_ops): Add a prototype to the
to_can_execute_reverse callback.
* macroscope.c (_initialize_macroscope): Declare before definition.
* cp-namespace.c (_initialize_cp_namespace): Declare before definition.
* python/python.c (_initialize_python): Declare before definition.
* tui/tui-command.c: Include "tui/tui-command.h".
* tui/tui-data.c (init_content_element, init_win_info): Make them
static.
* tui/tui-disasm.c: Include "tui/tui-disasm.h".
* tui/tui-interp.c (_initialize_tui_interp): Declare before
definition.
* tui/tui-layout.c: Include "tui/tui-layout.h".
(_initialize_tui_layout): Declare before definition.
* tui/tui-regs.c: Include "tui/tui-regs.h".
(tui_display_reg_element_at_line): Make it static.
(_initialize_tui_regs): Declare before definition.
* tui/tui-stack.c (_initialize_tui_stack): Declare before
definition.
* tui/tui-win.c: Include "tui/tui-win.h".
(_initialize_tui_win): Declare before definition.
(tui_sigwinch_handler): Make it static. Wrap in ifdef SIGWINCH.
* tui/tui-win.h (tui_sigwinch_handler): Delete declaration.
(tui_get_cmd_list): Add a prototype.
* tui/tui-windata.c: Include tui-windata.h.
* tui/tui-wingeneral.c (box_win): Make it static.
* cli/cli-logging.c (show_logging_command): Make it static.
(_initialize_cli_logging): Declare before definition.
* mi/mi-common.c (_initialize_gdb_mi_common): Declare before
definition.
2009-02-22 00:14:50 +08:00
|
|
|
|
#include "cp-support.h"
|
2018-05-23 00:35:38 +08:00
|
|
|
|
#include "c-support.h"
|
2018-05-30 02:54:59 +08:00
|
|
|
|
#include "parser-defs.h"
|
2024-04-11 06:49:51 +08:00
|
|
|
|
#include "gdbsupport/selftest.h"
|
2018-05-30 02:20:09 +08:00
|
|
|
|
|
|
|
|
|
#define GDB_YY_REMAP_PREFIX cpname
|
|
|
|
|
#include "yy-remap.h"
|
|
|
|
|
|
2018-06-02 01:50:01 +08:00
|
|
|
|
%}
|
|
|
|
|
|
|
|
|
|
%union
|
|
|
|
|
{
|
|
|
|
|
struct demangle_component *comp;
|
|
|
|
|
struct nested {
|
|
|
|
|
struct demangle_component *comp;
|
|
|
|
|
struct demangle_component **last;
|
|
|
|
|
} nested;
|
|
|
|
|
struct {
|
|
|
|
|
struct demangle_component *comp, *last;
|
|
|
|
|
} nested1;
|
|
|
|
|
struct {
|
|
|
|
|
struct demangle_component *comp, **last;
|
|
|
|
|
struct nested fn;
|
|
|
|
|
struct demangle_component *start;
|
|
|
|
|
int fold_flag;
|
|
|
|
|
} abstract;
|
|
|
|
|
int lval;
|
|
|
|
|
const char *opname;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
%{
|
|
|
|
|
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
struct cpname_state
|
|
|
|
|
{
|
2018-06-02 01:50:01 +08:00
|
|
|
|
/* LEXPTR is the current pointer into our lex buffer. PREV_LEXPTR
|
|
|
|
|
is the start of the last token lexed, only used for diagnostics.
|
|
|
|
|
ERROR_LEXPTR is the first place an error occurred. GLOBAL_ERRMSG
|
|
|
|
|
is the first error message encountered. */
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
|
|
|
|
|
const char *lexptr, *prev_lexptr, *error_lexptr, *global_errmsg;
|
|
|
|
|
|
2024-04-12 00:35:09 +08:00
|
|
|
|
demangle_parse_info *demangle_info;
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
|
|
|
|
|
/* The parse tree created by the parser is stored here after a
|
|
|
|
|
successful parse. */
|
|
|
|
|
|
|
|
|
|
struct demangle_component *global_result;
|
2018-06-02 01:50:01 +08:00
|
|
|
|
|
|
|
|
|
struct demangle_component *d_grab ();
|
|
|
|
|
|
|
|
|
|
/* Helper functions. These wrap the demangler tree interface,
|
|
|
|
|
handle allocation from our global store, and return the allocated
|
|
|
|
|
component. */
|
|
|
|
|
|
|
|
|
|
struct demangle_component *fill_comp (enum demangle_component_type d_type,
|
|
|
|
|
struct demangle_component *lhs,
|
|
|
|
|
struct demangle_component *rhs);
|
|
|
|
|
|
|
|
|
|
struct demangle_component *make_operator (const char *name, int args);
|
|
|
|
|
|
|
|
|
|
struct demangle_component *make_dtor (enum gnu_v3_dtor_kinds kind,
|
|
|
|
|
struct demangle_component *name);
|
|
|
|
|
|
|
|
|
|
struct demangle_component *make_builtin_type (const char *name);
|
|
|
|
|
|
|
|
|
|
struct demangle_component *make_name (const char *name, int len);
|
|
|
|
|
|
|
|
|
|
struct demangle_component *d_qualify (struct demangle_component *lhs,
|
|
|
|
|
int qualifiers, int is_method);
|
|
|
|
|
|
|
|
|
|
struct demangle_component *d_int_type (int flags);
|
|
|
|
|
|
|
|
|
|
struct demangle_component *d_unary (const char *name,
|
|
|
|
|
struct demangle_component *lhs);
|
|
|
|
|
|
|
|
|
|
struct demangle_component *d_binary (const char *name,
|
|
|
|
|
struct demangle_component *lhs,
|
|
|
|
|
struct demangle_component *rhs);
|
|
|
|
|
|
|
|
|
|
int parse_number (const char *p, int len, int parsed_float, YYSTYPE *lvalp);
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
};
|
2007-10-22 22:37:36 +08:00
|
|
|
|
|
2018-06-02 01:50:01 +08:00
|
|
|
|
struct demangle_component *
|
|
|
|
|
cpname_state::d_grab ()
|
2007-10-22 22:37:36 +08:00
|
|
|
|
{
|
2024-04-12 00:35:09 +08:00
|
|
|
|
return obstack_new<demangle_component> (&demangle_info->obstack);
|
2007-10-22 22:37:36 +08:00
|
|
|
|
}
|
2005-03-11 10:24:23 +08:00
|
|
|
|
|
|
|
|
|
/* Flags passed to d_qualify. */
|
|
|
|
|
|
|
|
|
|
#define QUAL_CONST 1
|
|
|
|
|
#define QUAL_RESTRICT 2
|
|
|
|
|
#define QUAL_VOLATILE 4
|
|
|
|
|
|
|
|
|
|
/* Flags passed to d_int_type. */
|
|
|
|
|
|
|
|
|
|
#define INT_CHAR (1 << 0)
|
|
|
|
|
#define INT_SHORT (1 << 1)
|
|
|
|
|
#define INT_LONG (1 << 2)
|
|
|
|
|
#define INT_LLONG (1 << 3)
|
|
|
|
|
|
|
|
|
|
#define INT_SIGNED (1 << 4)
|
|
|
|
|
#define INT_UNSIGNED (1 << 5)
|
|
|
|
|
|
|
|
|
|
/* Helper functions. These wrap the demangler tree interface, handle
|
|
|
|
|
allocation from our global store, and return the allocated component. */
|
|
|
|
|
|
2018-06-02 01:50:01 +08:00
|
|
|
|
struct demangle_component *
|
|
|
|
|
cpname_state::fill_comp (enum demangle_component_type d_type,
|
|
|
|
|
struct demangle_component *lhs,
|
|
|
|
|
struct demangle_component *rhs)
|
2005-03-11 10:24:23 +08:00
|
|
|
|
{
|
2018-06-02 01:50:01 +08:00
|
|
|
|
struct demangle_component *ret = d_grab ();
|
2012-01-11 03:29:12 +08:00
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
i = cplus_demangle_fill_component (ret, d_type, lhs, rhs);
|
|
|
|
|
gdb_assert (i);
|
|
|
|
|
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-02 01:50:01 +08:00
|
|
|
|
struct demangle_component *
|
|
|
|
|
cpname_state::make_operator (const char *name, int args)
|
2005-03-11 10:24:23 +08:00
|
|
|
|
{
|
2018-06-02 01:50:01 +08:00
|
|
|
|
struct demangle_component *ret = d_grab ();
|
2012-01-11 03:29:12 +08:00
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
i = cplus_demangle_fill_operator (ret, name, args);
|
|
|
|
|
gdb_assert (i);
|
|
|
|
|
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-02 01:50:01 +08:00
|
|
|
|
struct demangle_component *
|
|
|
|
|
cpname_state::make_dtor (enum gnu_v3_dtor_kinds kind,
|
|
|
|
|
struct demangle_component *name)
|
2005-03-11 10:24:23 +08:00
|
|
|
|
{
|
2018-06-02 01:50:01 +08:00
|
|
|
|
struct demangle_component *ret = d_grab ();
|
2012-01-11 03:29:12 +08:00
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
i = cplus_demangle_fill_dtor (ret, kind, name);
|
|
|
|
|
gdb_assert (i);
|
|
|
|
|
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-02 01:50:01 +08:00
|
|
|
|
struct demangle_component *
|
|
|
|
|
cpname_state::make_builtin_type (const char *name)
|
2005-03-11 10:24:23 +08:00
|
|
|
|
{
|
2018-06-02 01:50:01 +08:00
|
|
|
|
struct demangle_component *ret = d_grab ();
|
2012-01-11 03:29:12 +08:00
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
i = cplus_demangle_fill_builtin_type (ret, name);
|
|
|
|
|
gdb_assert (i);
|
|
|
|
|
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-02 01:50:01 +08:00
|
|
|
|
struct demangle_component *
|
|
|
|
|
cpname_state::make_name (const char *name, int len)
|
2005-03-11 10:24:23 +08:00
|
|
|
|
{
|
2018-06-02 01:50:01 +08:00
|
|
|
|
struct demangle_component *ret = d_grab ();
|
2012-01-11 03:29:12 +08:00
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
i = cplus_demangle_fill_name (ret, name, len);
|
|
|
|
|
gdb_assert (i);
|
|
|
|
|
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define d_left(dc) (dc)->u.s_binary.left
|
|
|
|
|
#define d_right(dc) (dc)->u.s_binary.right
|
|
|
|
|
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
static int yylex (YYSTYPE *, cpname_state *);
|
|
|
|
|
static void yyerror (cpname_state *, const char *);
|
|
|
|
|
%}
|
|
|
|
|
|
2015-02-28 00:33:07 +08:00
|
|
|
|
%type <comp> exp exp1 type start start_opt oper colon_name
|
2005-03-11 10:24:23 +08:00
|
|
|
|
%type <comp> unqualified_name colon_ext_name
|
2015-02-28 00:33:07 +08:00
|
|
|
|
%type <comp> templ template_arg
|
2005-03-11 10:24:23 +08:00
|
|
|
|
%type <comp> builtin_type
|
|
|
|
|
%type <comp> typespec_2 array_indicator
|
|
|
|
|
%type <comp> colon_ext_only ext_only_name
|
|
|
|
|
|
|
|
|
|
%type <comp> demangler_special function conversion_op
|
|
|
|
|
%type <nested> conversion_op_name
|
|
|
|
|
|
|
|
|
|
%type <abstract> abstract_declarator direct_abstract_declarator
|
|
|
|
|
%type <abstract> abstract_declarator_fn
|
|
|
|
|
%type <nested> declarator direct_declarator function_arglist
|
|
|
|
|
|
|
|
|
|
%type <nested> declarator_1 direct_declarator_1
|
|
|
|
|
|
|
|
|
|
%type <nested> template_params function_args
|
|
|
|
|
%type <nested> ptr_operator
|
|
|
|
|
|
|
|
|
|
%type <nested1> nested_name
|
|
|
|
|
|
|
|
|
|
%type <lval> qualifier qualifiers qualifiers_opt
|
|
|
|
|
|
|
|
|
|
%type <lval> int_part int_seq
|
|
|
|
|
|
|
|
|
|
%token <comp> INT
|
|
|
|
|
%token <comp> FLOAT
|
|
|
|
|
|
|
|
|
|
%token <comp> NAME
|
|
|
|
|
%type <comp> name
|
|
|
|
|
|
|
|
|
|
%token STRUCT CLASS UNION ENUM SIZEOF UNSIGNED COLONCOLON
|
|
|
|
|
%token TEMPLATE
|
|
|
|
|
%token ERROR
|
|
|
|
|
%token NEW DELETE OPERATOR
|
|
|
|
|
%token STATIC_CAST REINTERPRET_CAST DYNAMIC_CAST
|
|
|
|
|
|
|
|
|
|
/* Special type cases, put in to allow the parser to distinguish different
|
|
|
|
|
legal basetypes. */
|
|
|
|
|
%token SIGNED_KEYWORD LONG SHORT INT_KEYWORD CONST_KEYWORD VOLATILE_KEYWORD DOUBLE_KEYWORD BOOL
|
|
|
|
|
%token ELLIPSIS RESTRICT VOID FLOAT_KEYWORD CHAR WCHAR_T
|
|
|
|
|
|
|
|
|
|
%token <opname> ASSIGN_MODIFY
|
|
|
|
|
|
|
|
|
|
/* C++ */
|
|
|
|
|
%token TRUEKEYWORD
|
|
|
|
|
%token FALSEKEYWORD
|
|
|
|
|
|
|
|
|
|
/* Non-C++ things we get from the demangler. */
|
|
|
|
|
%token <lval> DEMANGLER_SPECIAL
|
|
|
|
|
%token CONSTRUCTION_VTABLE CONSTRUCTION_IN
|
|
|
|
|
|
|
|
|
|
/* Precedence declarations. */
|
|
|
|
|
|
|
|
|
|
/* Give NAME lower precedence than COLONCOLON, so that nested_name will
|
|
|
|
|
associate greedily. */
|
|
|
|
|
%nonassoc NAME
|
|
|
|
|
|
|
|
|
|
/* Give NEW and DELETE lower precedence than ']', because we can not
|
|
|
|
|
have an array of type operator new. This causes NEW '[' to be
|
|
|
|
|
parsed as operator new[]. */
|
|
|
|
|
%nonassoc NEW DELETE
|
|
|
|
|
|
|
|
|
|
/* Give VOID higher precedence than NAME. Then we can use %prec NAME
|
|
|
|
|
to prefer (VOID) to (function_args). */
|
|
|
|
|
%nonassoc VOID
|
|
|
|
|
|
|
|
|
|
/* Give VOID lower precedence than ')' for similar reasons. */
|
|
|
|
|
%nonassoc ')'
|
|
|
|
|
|
|
|
|
|
%left ','
|
|
|
|
|
%right '=' ASSIGN_MODIFY
|
|
|
|
|
%right '?'
|
|
|
|
|
%left OROR
|
|
|
|
|
%left ANDAND
|
|
|
|
|
%left '|'
|
|
|
|
|
%left '^'
|
|
|
|
|
%left '&'
|
|
|
|
|
%left EQUAL NOTEQUAL
|
2024-04-21 06:33:37 +08:00
|
|
|
|
%left '<' '>' LEQ GEQ SPACESHIP
|
2005-03-11 10:24:23 +08:00
|
|
|
|
%left LSH RSH
|
|
|
|
|
%left '@'
|
|
|
|
|
%left '+' '-'
|
|
|
|
|
%left '*' '/' '%'
|
|
|
|
|
%right UNARY INCREMENT DECREMENT
|
|
|
|
|
|
|
|
|
|
/* We don't need a precedence for '(' in this reduced grammar, and it
|
|
|
|
|
can mask some unpleasant bugs, so disable it for now. */
|
|
|
|
|
|
|
|
|
|
%right ARROW '.' '[' /* '(' */
|
|
|
|
|
%left COLONCOLON
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%%
|
|
|
|
|
|
|
|
|
|
result : start
|
2022-10-13 01:32:56 +08:00
|
|
|
|
{
|
|
|
|
|
state->global_result = $1;
|
|
|
|
|
|
|
|
|
|
/* Avoid warning about "yynerrs" being unused. */
|
|
|
|
|
(void) yynerrs;
|
|
|
|
|
}
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
start : type
|
|
|
|
|
|
|
|
|
|
| demangler_special
|
|
|
|
|
|
|
|
|
|
| function
|
|
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
start_opt : /* */
|
|
|
|
|
{ $$ = NULL; }
|
|
|
|
|
| COLONCOLON start
|
|
|
|
|
{ $$ = $2; }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
function
|
|
|
|
|
/* Function with a return type. declarator_1 is used to prevent
|
|
|
|
|
ambiguity with the next rule. */
|
|
|
|
|
: typespec_2 declarator_1
|
|
|
|
|
{ $$ = $2.comp;
|
|
|
|
|
*$2.last = $1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Function without a return type. We need to use typespec_2
|
|
|
|
|
to prevent conflicts from qualifiers_opt - harmless. The
|
|
|
|
|
start_opt is used to handle "function-local" variables and
|
|
|
|
|
types. */
|
|
|
|
|
| typespec_2 function_arglist start_opt
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->fill_comp (DEMANGLE_COMPONENT_TYPED_NAME,
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
$1, $2.comp);
|
|
|
|
|
if ($3)
|
2018-06-02 01:50:01 +08:00
|
|
|
|
$$ = state->fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME,
|
|
|
|
|
$$, $3);
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
}
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| colon_ext_only function_arglist start_opt
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->fill_comp (DEMANGLE_COMPONENT_TYPED_NAME, $1, $2.comp);
|
|
|
|
|
if ($3) $$ = state->fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME, $$, $3); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
|
|
|
|
|
| conversion_op_name start_opt
|
|
|
|
|
{ $$ = $1.comp;
|
2018-06-02 01:50:01 +08:00
|
|
|
|
if ($2) $$ = state->fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME, $$, $2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| conversion_op_name abstract_declarator_fn
|
|
|
|
|
{ if ($2.last)
|
|
|
|
|
{
|
|
|
|
|
/* First complete the abstract_declarator's type using
|
|
|
|
|
the typespec from the conversion_op_name. */
|
|
|
|
|
*$2.last = *$1.last;
|
|
|
|
|
/* Then complete the conversion_op_name with the type. */
|
|
|
|
|
*$1.last = $2.comp;
|
|
|
|
|
}
|
|
|
|
|
/* If we have an arglist, build a function type. */
|
|
|
|
|
if ($2.fn.comp)
|
2018-06-02 01:50:01 +08:00
|
|
|
|
$$ = state->fill_comp (DEMANGLE_COMPONENT_TYPED_NAME, $1.comp, $2.fn.comp);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
else
|
|
|
|
|
$$ = $1.comp;
|
2018-06-02 01:50:01 +08:00
|
|
|
|
if ($2.start) $$ = state->fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME, $$, $2.start);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
demangler_special
|
|
|
|
|
: DEMANGLER_SPECIAL start
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->fill_comp ((enum demangle_component_type) $1, $2, NULL); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| CONSTRUCTION_VTABLE start CONSTRUCTION_IN start
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->fill_comp (DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE, $2, $4); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
2015-02-28 00:33:07 +08:00
|
|
|
|
oper : OPERATOR NEW
|
2012-09-22 04:01:12 +08:00
|
|
|
|
{
|
|
|
|
|
/* Match the whitespacing of cplus_demangle_operators.
|
|
|
|
|
It would abort on unrecognized string otherwise. */
|
2018-06-02 01:50:01 +08:00
|
|
|
|
$$ = state->make_operator ("new", 3);
|
2012-09-22 04:01:12 +08:00
|
|
|
|
}
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR DELETE
|
2012-09-22 04:01:12 +08:00
|
|
|
|
{
|
|
|
|
|
/* Match the whitespacing of cplus_demangle_operators.
|
|
|
|
|
It would abort on unrecognized string otherwise. */
|
2018-06-02 01:50:01 +08:00
|
|
|
|
$$ = state->make_operator ("delete ", 1);
|
2012-09-22 04:01:12 +08:00
|
|
|
|
}
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR NEW '[' ']'
|
2012-09-22 04:01:12 +08:00
|
|
|
|
{
|
|
|
|
|
/* Match the whitespacing of cplus_demangle_operators.
|
|
|
|
|
It would abort on unrecognized string otherwise. */
|
2018-06-02 01:50:01 +08:00
|
|
|
|
$$ = state->make_operator ("new[]", 3);
|
2012-09-22 04:01:12 +08:00
|
|
|
|
}
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR DELETE '[' ']'
|
2012-09-22 04:01:12 +08:00
|
|
|
|
{
|
|
|
|
|
/* Match the whitespacing of cplus_demangle_operators.
|
|
|
|
|
It would abort on unrecognized string otherwise. */
|
2018-06-02 01:50:01 +08:00
|
|
|
|
$$ = state->make_operator ("delete[] ", 1);
|
2012-09-22 04:01:12 +08:00
|
|
|
|
}
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR '+'
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_operator ("+", 2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR '-'
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_operator ("-", 2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR '*'
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_operator ("*", 2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR '/'
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_operator ("/", 2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR '%'
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_operator ("%", 2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR '^'
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_operator ("^", 2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR '&'
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_operator ("&", 2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR '|'
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_operator ("|", 2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR '~'
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_operator ("~", 1); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR '!'
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_operator ("!", 1); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR '='
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_operator ("=", 2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR '<'
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_operator ("<", 2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR '>'
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_operator (">", 2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR ASSIGN_MODIFY
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_operator ($2, 2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR LSH
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_operator ("<<", 2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR RSH
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_operator (">>", 2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR EQUAL
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_operator ("==", 2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR NOTEQUAL
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_operator ("!=", 2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR LEQ
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_operator ("<=", 2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR GEQ
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_operator (">=", 2); }
|
2024-04-21 06:33:37 +08:00
|
|
|
|
| OPERATOR SPACESHIP
|
|
|
|
|
{ $$ = state->make_operator ("<=>", 2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR ANDAND
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_operator ("&&", 2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR OROR
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_operator ("||", 2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR INCREMENT
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_operator ("++", 1); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR DECREMENT
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_operator ("--", 1); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR ','
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_operator (",", 2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR ARROW '*'
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_operator ("->*", 2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR ARROW
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_operator ("->", 2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR '(' ')'
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_operator ("()", 2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| OPERATOR '[' ']'
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_operator ("[]", 2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* Conversion operators. We don't try to handle some of
|
|
|
|
|
the wackier demangler output for function pointers,
|
|
|
|
|
since it's not clear that it's parseable. */
|
|
|
|
|
conversion_op
|
|
|
|
|
: OPERATOR typespec_2
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->fill_comp (DEMANGLE_COMPONENT_CONVERSION, $2, NULL); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
conversion_op_name
|
|
|
|
|
: nested_name conversion_op
|
|
|
|
|
{ $$.comp = $1.comp;
|
|
|
|
|
d_right ($1.last) = $2;
|
|
|
|
|
$$.last = &d_left ($2);
|
|
|
|
|
}
|
|
|
|
|
| conversion_op
|
|
|
|
|
{ $$.comp = $1;
|
|
|
|
|
$$.last = &d_left ($1);
|
|
|
|
|
}
|
|
|
|
|
| COLONCOLON nested_name conversion_op
|
|
|
|
|
{ $$.comp = $2.comp;
|
|
|
|
|
d_right ($2.last) = $3;
|
|
|
|
|
$$.last = &d_left ($3);
|
|
|
|
|
}
|
|
|
|
|
| COLONCOLON conversion_op
|
|
|
|
|
{ $$.comp = $2;
|
|
|
|
|
$$.last = &d_left ($2);
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* DEMANGLE_COMPONENT_NAME */
|
|
|
|
|
/* This accepts certain invalid placements of '~'. */
|
2015-02-28 00:33:07 +08:00
|
|
|
|
unqualified_name: oper
|
|
|
|
|
| oper '<' template_params '>'
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->fill_comp (DEMANGLE_COMPONENT_TEMPLATE, $1, $3.comp); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| '~' NAME
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_dtor (gnu_v3_complete_object_dtor, $2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* This rule is used in name and nested_name, and expanded inline there
|
|
|
|
|
for efficiency. */
|
|
|
|
|
/*
|
|
|
|
|
scope_id : NAME
|
|
|
|
|
| template
|
|
|
|
|
;
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
colon_name : name
|
|
|
|
|
| COLONCOLON name
|
|
|
|
|
{ $$ = $2; }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* DEMANGLE_COMPONENT_QUAL_NAME */
|
|
|
|
|
/* DEMANGLE_COMPONENT_CTOR / DEMANGLE_COMPONENT_DTOR ? */
|
|
|
|
|
name : nested_name NAME %prec NAME
|
|
|
|
|
{ $$ = $1.comp; d_right ($1.last) = $2; }
|
|
|
|
|
| NAME %prec NAME
|
2015-02-28 00:33:07 +08:00
|
|
|
|
| nested_name templ %prec NAME
|
2005-03-11 10:24:23 +08:00
|
|
|
|
{ $$ = $1.comp; d_right ($1.last) = $2; }
|
2015-02-28 00:33:07 +08:00
|
|
|
|
| templ %prec NAME
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
colon_ext_name : colon_name
|
|
|
|
|
| colon_ext_only
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
colon_ext_only : ext_only_name
|
|
|
|
|
| COLONCOLON ext_only_name
|
|
|
|
|
{ $$ = $2; }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
ext_only_name : nested_name unqualified_name
|
|
|
|
|
{ $$ = $1.comp; d_right ($1.last) = $2; }
|
|
|
|
|
| unqualified_name
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
nested_name : NAME COLONCOLON
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$.comp = state->fill_comp (DEMANGLE_COMPONENT_QUAL_NAME, $1, NULL);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
$$.last = $$.comp;
|
|
|
|
|
}
|
|
|
|
|
| nested_name NAME COLONCOLON
|
|
|
|
|
{ $$.comp = $1.comp;
|
2018-06-02 01:50:01 +08:00
|
|
|
|
d_right ($1.last) = state->fill_comp (DEMANGLE_COMPONENT_QUAL_NAME, $2, NULL);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
$$.last = d_right ($1.last);
|
|
|
|
|
}
|
2015-02-28 00:33:07 +08:00
|
|
|
|
| templ COLONCOLON
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$.comp = state->fill_comp (DEMANGLE_COMPONENT_QUAL_NAME, $1, NULL);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
$$.last = $$.comp;
|
|
|
|
|
}
|
2015-02-28 00:33:07 +08:00
|
|
|
|
| nested_name templ COLONCOLON
|
2005-03-11 10:24:23 +08:00
|
|
|
|
{ $$.comp = $1.comp;
|
2018-06-02 01:50:01 +08:00
|
|
|
|
d_right ($1.last) = state->fill_comp (DEMANGLE_COMPONENT_QUAL_NAME, $2, NULL);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
$$.last = d_right ($1.last);
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* DEMANGLE_COMPONENT_TEMPLATE */
|
|
|
|
|
/* DEMANGLE_COMPONENT_TEMPLATE_ARGLIST */
|
2015-02-28 00:33:07 +08:00
|
|
|
|
templ : NAME '<' template_params '>'
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->fill_comp (DEMANGLE_COMPONENT_TEMPLATE, $1, $3.comp); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
template_params : template_arg
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$.comp = state->fill_comp (DEMANGLE_COMPONENT_TEMPLATE_ARGLIST, $1, NULL);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
$$.last = &d_right ($$.comp); }
|
|
|
|
|
| template_params ',' template_arg
|
|
|
|
|
{ $$.comp = $1.comp;
|
2018-06-02 01:50:01 +08:00
|
|
|
|
*$1.last = state->fill_comp (DEMANGLE_COMPONENT_TEMPLATE_ARGLIST, $3, NULL);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
$$.last = &d_right (*$1.last);
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* "type" is inlined into template_arg and function_args. */
|
|
|
|
|
|
|
|
|
|
/* Also an integral constant-expression of integral type, and a
|
|
|
|
|
pointer to member (?) */
|
|
|
|
|
template_arg : typespec_2
|
|
|
|
|
| typespec_2 abstract_declarator
|
|
|
|
|
{ $$ = $2.comp;
|
|
|
|
|
*$2.last = $1;
|
|
|
|
|
}
|
|
|
|
|
| '&' start
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->fill_comp (DEMANGLE_COMPONENT_UNARY, state->make_operator ("&", 1), $2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| '&' '(' start ')'
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->fill_comp (DEMANGLE_COMPONENT_UNARY, state->make_operator ("&", 1), $3); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| exp
|
2024-04-21 00:44:13 +08:00
|
|
|
|
| function
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
function_args : typespec_2
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$.comp = state->fill_comp (DEMANGLE_COMPONENT_ARGLIST, $1, NULL);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
$$.last = &d_right ($$.comp);
|
|
|
|
|
}
|
|
|
|
|
| typespec_2 abstract_declarator
|
|
|
|
|
{ *$2.last = $1;
|
2018-06-02 01:50:01 +08:00
|
|
|
|
$$.comp = state->fill_comp (DEMANGLE_COMPONENT_ARGLIST, $2.comp, NULL);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
$$.last = &d_right ($$.comp);
|
|
|
|
|
}
|
|
|
|
|
| function_args ',' typespec_2
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ *$1.last = state->fill_comp (DEMANGLE_COMPONENT_ARGLIST, $3, NULL);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
$$.comp = $1.comp;
|
|
|
|
|
$$.last = &d_right (*$1.last);
|
|
|
|
|
}
|
|
|
|
|
| function_args ',' typespec_2 abstract_declarator
|
|
|
|
|
{ *$4.last = $3;
|
2018-06-02 01:50:01 +08:00
|
|
|
|
*$1.last = state->fill_comp (DEMANGLE_COMPONENT_ARGLIST, $4.comp, NULL);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
$$.comp = $1.comp;
|
|
|
|
|
$$.last = &d_right (*$1.last);
|
|
|
|
|
}
|
|
|
|
|
| function_args ',' ELLIPSIS
|
|
|
|
|
{ *$1.last
|
2018-06-02 01:50:01 +08:00
|
|
|
|
= state->fill_comp (DEMANGLE_COMPONENT_ARGLIST,
|
|
|
|
|
state->make_builtin_type ("..."),
|
2005-03-11 10:24:23 +08:00
|
|
|
|
NULL);
|
|
|
|
|
$$.comp = $1.comp;
|
|
|
|
|
$$.last = &d_right (*$1.last);
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
function_arglist: '(' function_args ')' qualifiers_opt %prec NAME
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$.comp = state->fill_comp (DEMANGLE_COMPONENT_FUNCTION_TYPE, NULL, $2.comp);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
$$.last = &d_left ($$.comp);
|
2018-06-02 01:50:01 +08:00
|
|
|
|
$$.comp = state->d_qualify ($$.comp, $4, 1); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| '(' VOID ')' qualifiers_opt
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$.comp = state->fill_comp (DEMANGLE_COMPONENT_FUNCTION_TYPE, NULL, NULL);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
$$.last = &d_left ($$.comp);
|
2018-06-02 01:50:01 +08:00
|
|
|
|
$$.comp = state->d_qualify ($$.comp, $4, 1); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| '(' ')' qualifiers_opt
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$.comp = state->fill_comp (DEMANGLE_COMPONENT_FUNCTION_TYPE, NULL, NULL);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
$$.last = &d_left ($$.comp);
|
2018-06-02 01:50:01 +08:00
|
|
|
|
$$.comp = state->d_qualify ($$.comp, $3, 1); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* Should do something about DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL */
|
|
|
|
|
qualifiers_opt : /* epsilon */
|
|
|
|
|
{ $$ = 0; }
|
|
|
|
|
| qualifiers
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
qualifier : RESTRICT
|
|
|
|
|
{ $$ = QUAL_RESTRICT; }
|
|
|
|
|
| VOLATILE_KEYWORD
|
|
|
|
|
{ $$ = QUAL_VOLATILE; }
|
|
|
|
|
| CONST_KEYWORD
|
|
|
|
|
{ $$ = QUAL_CONST; }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
qualifiers : qualifier
|
|
|
|
|
| qualifier qualifiers
|
|
|
|
|
{ $$ = $1 | $2; }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* This accepts all sorts of invalid constructions and produces
|
|
|
|
|
invalid output for them - an error would be better. */
|
|
|
|
|
|
|
|
|
|
int_part : INT_KEYWORD
|
|
|
|
|
{ $$ = 0; }
|
|
|
|
|
| SIGNED_KEYWORD
|
|
|
|
|
{ $$ = INT_SIGNED; }
|
|
|
|
|
| UNSIGNED
|
|
|
|
|
{ $$ = INT_UNSIGNED; }
|
|
|
|
|
| CHAR
|
|
|
|
|
{ $$ = INT_CHAR; }
|
|
|
|
|
| LONG
|
|
|
|
|
{ $$ = INT_LONG; }
|
|
|
|
|
| SHORT
|
|
|
|
|
{ $$ = INT_SHORT; }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
int_seq : int_part
|
|
|
|
|
| int_seq int_part
|
|
|
|
|
{ $$ = $1 | $2; if ($1 & $2 & INT_LONG) $$ = $1 | INT_LLONG; }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
builtin_type : int_seq
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_int_type ($1); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| FLOAT_KEYWORD
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_builtin_type ("float"); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| DOUBLE_KEYWORD
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_builtin_type ("double"); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| LONG DOUBLE_KEYWORD
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_builtin_type ("long double"); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| BOOL
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_builtin_type ("bool"); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| WCHAR_T
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_builtin_type ("wchar_t"); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| VOID
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->make_builtin_type ("void"); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
ptr_operator : '*' qualifiers_opt
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$.comp = state->fill_comp (DEMANGLE_COMPONENT_POINTER, NULL, NULL);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
$$.last = &d_left ($$.comp);
|
2018-06-02 01:50:01 +08:00
|
|
|
|
$$.comp = state->d_qualify ($$.comp, $2, 0); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
/* g++ seems to allow qualifiers after the reference? */
|
|
|
|
|
| '&'
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$.comp = state->fill_comp (DEMANGLE_COMPONENT_REFERENCE, NULL, NULL);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
$$.last = &d_left ($$.comp); }
|
2017-03-21 04:47:46 +08:00
|
|
|
|
| ANDAND
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$.comp = state->fill_comp (DEMANGLE_COMPONENT_RVALUE_REFERENCE, NULL, NULL);
|
2017-03-21 04:47:46 +08:00
|
|
|
|
$$.last = &d_left ($$.comp); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| nested_name '*' qualifiers_opt
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$.comp = state->fill_comp (DEMANGLE_COMPONENT_PTRMEM_TYPE, $1.comp, NULL);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
/* Convert the innermost DEMANGLE_COMPONENT_QUAL_NAME to a DEMANGLE_COMPONENT_NAME. */
|
|
|
|
|
*$1.last = *d_left ($1.last);
|
|
|
|
|
$$.last = &d_right ($$.comp);
|
2018-06-02 01:50:01 +08:00
|
|
|
|
$$.comp = state->d_qualify ($$.comp, $3, 0); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| COLONCOLON nested_name '*' qualifiers_opt
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$.comp = state->fill_comp (DEMANGLE_COMPONENT_PTRMEM_TYPE, $2.comp, NULL);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
/* Convert the innermost DEMANGLE_COMPONENT_QUAL_NAME to a DEMANGLE_COMPONENT_NAME. */
|
|
|
|
|
*$2.last = *d_left ($2.last);
|
|
|
|
|
$$.last = &d_right ($$.comp);
|
2018-06-02 01:50:01 +08:00
|
|
|
|
$$.comp = state->d_qualify ($$.comp, $4, 0); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
array_indicator : '[' ']'
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->fill_comp (DEMANGLE_COMPONENT_ARRAY_TYPE, NULL, NULL); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| '[' INT ']'
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->fill_comp (DEMANGLE_COMPONENT_ARRAY_TYPE, $2, NULL); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* Details of this approach inspired by the G++ < 3.4 parser. */
|
|
|
|
|
|
|
|
|
|
/* This rule is only used in typespec_2, and expanded inline there for
|
|
|
|
|
efficiency. */
|
|
|
|
|
/*
|
|
|
|
|
typespec : builtin_type
|
|
|
|
|
| colon_name
|
|
|
|
|
;
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
typespec_2 : builtin_type qualifiers
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_qualify ($1, $2, 0); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| builtin_type
|
|
|
|
|
| qualifiers builtin_type qualifiers
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_qualify ($2, $1 | $3, 0); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| qualifiers builtin_type
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_qualify ($2, $1, 0); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
|
|
|
|
|
| name qualifiers
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_qualify ($1, $2, 0); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| name
|
|
|
|
|
| qualifiers name qualifiers
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_qualify ($2, $1 | $3, 0); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| qualifiers name
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_qualify ($2, $1, 0); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
|
|
|
|
|
| COLONCOLON name qualifiers
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_qualify ($2, $3, 0); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| COLONCOLON name
|
|
|
|
|
{ $$ = $2; }
|
|
|
|
|
| qualifiers COLONCOLON name qualifiers
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_qualify ($3, $1 | $4, 0); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
| qualifiers COLONCOLON name
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_qualify ($3, $1, 0); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
abstract_declarator
|
|
|
|
|
: ptr_operator
|
|
|
|
|
{ $$.comp = $1.comp; $$.last = $1.last;
|
|
|
|
|
$$.fn.comp = NULL; $$.fn.last = NULL; }
|
|
|
|
|
| ptr_operator abstract_declarator
|
|
|
|
|
{ $$ = $2; $$.fn.comp = NULL; $$.fn.last = NULL;
|
|
|
|
|
if ($2.fn.comp) { $$.last = $2.fn.last; *$2.last = $2.fn.comp; }
|
|
|
|
|
*$$.last = $1.comp;
|
|
|
|
|
$$.last = $1.last; }
|
|
|
|
|
| direct_abstract_declarator
|
|
|
|
|
{ $$.fn.comp = NULL; $$.fn.last = NULL;
|
|
|
|
|
if ($1.fn.comp) { $$.last = $1.fn.last; *$1.last = $1.fn.comp; }
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
direct_abstract_declarator
|
|
|
|
|
: '(' abstract_declarator ')'
|
|
|
|
|
{ $$ = $2; $$.fn.comp = NULL; $$.fn.last = NULL; $$.fold_flag = 1;
|
|
|
|
|
if ($2.fn.comp) { $$.last = $2.fn.last; *$2.last = $2.fn.comp; }
|
|
|
|
|
}
|
|
|
|
|
| direct_abstract_declarator function_arglist
|
|
|
|
|
{ $$.fold_flag = 0;
|
|
|
|
|
if ($1.fn.comp) { $$.last = $1.fn.last; *$1.last = $1.fn.comp; }
|
|
|
|
|
if ($1.fold_flag)
|
|
|
|
|
{
|
|
|
|
|
*$$.last = $2.comp;
|
|
|
|
|
$$.last = $2.last;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
$$.fn = $2;
|
|
|
|
|
}
|
|
|
|
|
| direct_abstract_declarator array_indicator
|
|
|
|
|
{ $$.fn.comp = NULL; $$.fn.last = NULL; $$.fold_flag = 0;
|
|
|
|
|
if ($1.fn.comp) { $$.last = $1.fn.last; *$1.last = $1.fn.comp; }
|
|
|
|
|
*$1.last = $2;
|
|
|
|
|
$$.last = &d_right ($2);
|
|
|
|
|
}
|
|
|
|
|
| array_indicator
|
|
|
|
|
{ $$.fn.comp = NULL; $$.fn.last = NULL; $$.fold_flag = 0;
|
|
|
|
|
$$.comp = $1;
|
|
|
|
|
$$.last = &d_right ($1);
|
|
|
|
|
}
|
|
|
|
|
/* G++ has the following except for () and (type). Then
|
|
|
|
|
(type) is handled in regcast_or_absdcl and () is handled
|
|
|
|
|
in fcast_or_absdcl.
|
|
|
|
|
|
|
|
|
|
However, this is only useful for function types, and
|
|
|
|
|
generates reduce/reduce conflicts with direct_declarator.
|
|
|
|
|
We're interested in pointer-to-function types, and in
|
|
|
|
|
functions, but not in function types - so leave this
|
|
|
|
|
out. */
|
|
|
|
|
/* | function_arglist */
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
abstract_declarator_fn
|
|
|
|
|
: ptr_operator
|
|
|
|
|
{ $$.comp = $1.comp; $$.last = $1.last;
|
|
|
|
|
$$.fn.comp = NULL; $$.fn.last = NULL; $$.start = NULL; }
|
|
|
|
|
| ptr_operator abstract_declarator_fn
|
|
|
|
|
{ $$ = $2;
|
|
|
|
|
if ($2.last)
|
|
|
|
|
*$$.last = $1.comp;
|
|
|
|
|
else
|
|
|
|
|
$$.comp = $1.comp;
|
|
|
|
|
$$.last = $1.last;
|
|
|
|
|
}
|
|
|
|
|
| direct_abstract_declarator
|
|
|
|
|
{ $$.comp = $1.comp; $$.last = $1.last; $$.fn = $1.fn; $$.start = NULL; }
|
|
|
|
|
| direct_abstract_declarator function_arglist COLONCOLON start
|
|
|
|
|
{ $$.start = $4;
|
|
|
|
|
if ($1.fn.comp) { $$.last = $1.fn.last; *$1.last = $1.fn.comp; }
|
|
|
|
|
if ($1.fold_flag)
|
|
|
|
|
{
|
|
|
|
|
*$$.last = $2.comp;
|
|
|
|
|
$$.last = $2.last;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
$$.fn = $2;
|
|
|
|
|
}
|
|
|
|
|
| function_arglist start_opt
|
|
|
|
|
{ $$.fn = $1;
|
|
|
|
|
$$.start = $2;
|
|
|
|
|
$$.comp = NULL; $$.last = NULL;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
type : typespec_2
|
|
|
|
|
| typespec_2 abstract_declarator
|
|
|
|
|
{ $$ = $2.comp;
|
|
|
|
|
*$2.last = $1;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
declarator : ptr_operator declarator
|
|
|
|
|
{ $$.comp = $2.comp;
|
|
|
|
|
$$.last = $1.last;
|
|
|
|
|
*$2.last = $1.comp; }
|
|
|
|
|
| direct_declarator
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
direct_declarator
|
|
|
|
|
: '(' declarator ')'
|
|
|
|
|
{ $$ = $2; }
|
|
|
|
|
| direct_declarator function_arglist
|
|
|
|
|
{ $$.comp = $1.comp;
|
|
|
|
|
*$1.last = $2.comp;
|
|
|
|
|
$$.last = $2.last;
|
|
|
|
|
}
|
|
|
|
|
| direct_declarator array_indicator
|
|
|
|
|
{ $$.comp = $1.comp;
|
|
|
|
|
*$1.last = $2;
|
|
|
|
|
$$.last = &d_right ($2);
|
|
|
|
|
}
|
|
|
|
|
| colon_ext_name
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$.comp = state->fill_comp (DEMANGLE_COMPONENT_TYPED_NAME, $1, NULL);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
$$.last = &d_right ($$.comp);
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* These are similar to declarator and direct_declarator except that they
|
|
|
|
|
do not permit ( colon_ext_name ), which is ambiguous with a function
|
|
|
|
|
argument list. They also don't permit a few other forms with redundant
|
|
|
|
|
parentheses around the colon_ext_name; any colon_ext_name in parentheses
|
|
|
|
|
must be followed by an argument list or an array indicator, or preceded
|
|
|
|
|
by a pointer. */
|
|
|
|
|
declarator_1 : ptr_operator declarator_1
|
|
|
|
|
{ $$.comp = $2.comp;
|
|
|
|
|
$$.last = $1.last;
|
|
|
|
|
*$2.last = $1.comp; }
|
|
|
|
|
| colon_ext_name
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$.comp = state->fill_comp (DEMANGLE_COMPONENT_TYPED_NAME, $1, NULL);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
$$.last = &d_right ($$.comp);
|
|
|
|
|
}
|
|
|
|
|
| direct_declarator_1
|
|
|
|
|
|
|
|
|
|
/* Function local variable or type. The typespec to
|
|
|
|
|
our left is the type of the containing function.
|
|
|
|
|
This should be OK, because function local types
|
|
|
|
|
can not be templates, so the return types of their
|
|
|
|
|
members will not be mangled. If they are hopefully
|
|
|
|
|
they'll end up to the right of the ::. */
|
|
|
|
|
| colon_ext_name function_arglist COLONCOLON start
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$.comp = state->fill_comp (DEMANGLE_COMPONENT_TYPED_NAME, $1, $2.comp);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
$$.last = $2.last;
|
2018-06-02 01:50:01 +08:00
|
|
|
|
$$.comp = state->fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME, $$.comp, $4);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
}
|
|
|
|
|
| direct_declarator_1 function_arglist COLONCOLON start
|
|
|
|
|
{ $$.comp = $1.comp;
|
|
|
|
|
*$1.last = $2.comp;
|
|
|
|
|
$$.last = $2.last;
|
2018-06-02 01:50:01 +08:00
|
|
|
|
$$.comp = state->fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME, $$.comp, $4);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
direct_declarator_1
|
|
|
|
|
: '(' ptr_operator declarator ')'
|
|
|
|
|
{ $$.comp = $3.comp;
|
|
|
|
|
$$.last = $2.last;
|
|
|
|
|
*$3.last = $2.comp; }
|
|
|
|
|
| direct_declarator_1 function_arglist
|
|
|
|
|
{ $$.comp = $1.comp;
|
|
|
|
|
*$1.last = $2.comp;
|
|
|
|
|
$$.last = $2.last;
|
|
|
|
|
}
|
|
|
|
|
| direct_declarator_1 array_indicator
|
|
|
|
|
{ $$.comp = $1.comp;
|
|
|
|
|
*$1.last = $2;
|
|
|
|
|
$$.last = &d_right ($2);
|
|
|
|
|
}
|
|
|
|
|
| colon_ext_name function_arglist
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$.comp = state->fill_comp (DEMANGLE_COMPONENT_TYPED_NAME, $1, $2.comp);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
$$.last = $2.last;
|
|
|
|
|
}
|
|
|
|
|
| colon_ext_name array_indicator
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$.comp = state->fill_comp (DEMANGLE_COMPONENT_TYPED_NAME, $1, $2);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
$$.last = &d_right ($2);
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : '(' exp1 ')'
|
|
|
|
|
{ $$ = $2; }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* Silly trick. Only allow '>' when parenthesized, in order to
|
|
|
|
|
handle conflict with templates. */
|
|
|
|
|
exp1 : exp
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp1 : exp '>' exp
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_binary (">", $1, $3); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* References. Not allowed everywhere in template parameters, only
|
|
|
|
|
at the top level, but treat them as expressions in case they are wrapped
|
|
|
|
|
in parentheses. */
|
|
|
|
|
exp1 : '&' start
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->fill_comp (DEMANGLE_COMPONENT_UNARY, state->make_operator ("&", 1), $2); }
|
2007-10-23 00:07:13 +08:00
|
|
|
|
| '&' '(' start ')'
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->fill_comp (DEMANGLE_COMPONENT_UNARY, state->make_operator ("&", 1), $3); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* Expressions, not including the comma operator. */
|
|
|
|
|
exp : '-' exp %prec UNARY
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_unary ("-", $2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : '!' exp %prec UNARY
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_unary ("!", $2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : '~' exp %prec UNARY
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_unary ("~", $2); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* Casts. First your normal C-style cast. If exp is a LITERAL, just change
|
|
|
|
|
its type. */
|
|
|
|
|
|
|
|
|
|
exp : '(' type ')' exp %prec UNARY
|
|
|
|
|
{ if ($4->type == DEMANGLE_COMPONENT_LITERAL
|
|
|
|
|
|| $4->type == DEMANGLE_COMPONENT_LITERAL_NEG)
|
|
|
|
|
{
|
|
|
|
|
$$ = $4;
|
|
|
|
|
d_left ($4) = $2;
|
|
|
|
|
}
|
|
|
|
|
else
|
2018-06-02 01:50:01 +08:00
|
|
|
|
$$ = state->fill_comp (DEMANGLE_COMPONENT_UNARY,
|
|
|
|
|
state->fill_comp (DEMANGLE_COMPONENT_CAST, $2, NULL),
|
2005-03-11 10:24:23 +08:00
|
|
|
|
$4);
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* Mangling does not differentiate between these, so we don't need to
|
|
|
|
|
either. */
|
|
|
|
|
exp : STATIC_CAST '<' type '>' '(' exp1 ')' %prec UNARY
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->fill_comp (DEMANGLE_COMPONENT_UNARY,
|
|
|
|
|
state->fill_comp (DEMANGLE_COMPONENT_CAST, $3, NULL),
|
2005-03-11 10:24:23 +08:00
|
|
|
|
$6);
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : DYNAMIC_CAST '<' type '>' '(' exp1 ')' %prec UNARY
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->fill_comp (DEMANGLE_COMPONENT_UNARY,
|
|
|
|
|
state->fill_comp (DEMANGLE_COMPONENT_CAST, $3, NULL),
|
2005-03-11 10:24:23 +08:00
|
|
|
|
$6);
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : REINTERPRET_CAST '<' type '>' '(' exp1 ')' %prec UNARY
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->fill_comp (DEMANGLE_COMPONENT_UNARY,
|
|
|
|
|
state->fill_comp (DEMANGLE_COMPONENT_CAST, $3, NULL),
|
2005-03-11 10:24:23 +08:00
|
|
|
|
$6);
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
2007-10-23 00:07:13 +08:00
|
|
|
|
/* Another form of C++-style cast is "type ( exp1 )". This creates too many
|
|
|
|
|
conflicts to support. For a while we supported the simpler
|
|
|
|
|
"typespec_2 ( exp1 )", but that conflicts with "& ( start )" as a
|
|
|
|
|
reference, deep within the wilderness of abstract declarators:
|
|
|
|
|
Qux<int(&(*))> vs Qux<int(&(var))>, a shift-reduce conflict at the
|
|
|
|
|
innermost left parenthesis. So we do not support function-like casts.
|
|
|
|
|
Fortunately they never appear in demangler output. */
|
2005-03-11 10:24:23 +08:00
|
|
|
|
|
|
|
|
|
/* TO INVESTIGATE: ._0 style anonymous names; anonymous namespaces */
|
|
|
|
|
|
|
|
|
|
/* Binary operators in order of decreasing precedence. */
|
|
|
|
|
|
|
|
|
|
exp : exp '*' exp
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_binary ("*", $1, $3); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp '/' exp
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_binary ("/", $1, $3); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp '%' exp
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_binary ("%", $1, $3); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp '+' exp
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_binary ("+", $1, $3); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp '-' exp
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_binary ("-", $1, $3); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp LSH exp
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_binary ("<<", $1, $3); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp RSH exp
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_binary (">>", $1, $3); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp EQUAL exp
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_binary ("==", $1, $3); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp NOTEQUAL exp
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_binary ("!=", $1, $3); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp LEQ exp
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_binary ("<=", $1, $3); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp GEQ exp
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_binary (">=", $1, $3); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
2024-04-21 06:33:37 +08:00
|
|
|
|
exp : exp SPACESHIP exp
|
|
|
|
|
{ $$ = state->d_binary ("<=>", $1, $3); }
|
|
|
|
|
;
|
|
|
|
|
|
2005-03-11 10:24:23 +08:00
|
|
|
|
exp : exp '<' exp
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_binary ("<", $1, $3); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp '&' exp
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_binary ("&", $1, $3); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp '^' exp
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_binary ("^", $1, $3); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp '|' exp
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_binary ("|", $1, $3); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp ANDAND exp
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_binary ("&&", $1, $3); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp OROR exp
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_binary ("||", $1, $3); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* Not 100% sure these are necessary, but they're harmless. */
|
|
|
|
|
exp : exp ARROW NAME
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_binary ("->", $1, $3); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp '.' NAME
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->d_binary (".", $1, $3); }
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : exp '?' exp ':' exp %prec '?'
|
2018-06-02 01:50:01 +08:00
|
|
|
|
{ $$ = state->fill_comp (DEMANGLE_COMPONENT_TRINARY, state->make_operator ("?", 3),
|
|
|
|
|
state->fill_comp (DEMANGLE_COMPONENT_TRINARY_ARG1, $1,
|
|
|
|
|
state->fill_comp (DEMANGLE_COMPONENT_TRINARY_ARG2, $3, $5)));
|
2005-03-11 10:24:23 +08:00
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : INT
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* Not generally allowed. */
|
|
|
|
|
exp : FLOAT
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : SIZEOF '(' type ')' %prec UNARY
|
2012-09-22 04:01:12 +08:00
|
|
|
|
{
|
|
|
|
|
/* Match the whitespacing of cplus_demangle_operators.
|
|
|
|
|
It would abort on unrecognized string otherwise. */
|
2018-06-02 01:50:01 +08:00
|
|
|
|
$$ = state->d_unary ("sizeof ", $3);
|
2012-09-22 04:01:12 +08:00
|
|
|
|
}
|
2005-03-11 10:24:23 +08:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* C++. */
|
|
|
|
|
exp : TRUEKEYWORD
|
|
|
|
|
{ struct demangle_component *i;
|
2018-06-02 01:50:01 +08:00
|
|
|
|
i = state->make_name ("1", 1);
|
|
|
|
|
$$ = state->fill_comp (DEMANGLE_COMPONENT_LITERAL,
|
|
|
|
|
state->make_builtin_type ( "bool"),
|
2005-03-11 10:24:23 +08:00
|
|
|
|
i);
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
exp : FALSEKEYWORD
|
|
|
|
|
{ struct demangle_component *i;
|
2018-06-02 01:50:01 +08:00
|
|
|
|
i = state->make_name ("0", 1);
|
|
|
|
|
$$ = state->fill_comp (DEMANGLE_COMPONENT_LITERAL,
|
|
|
|
|
state->make_builtin_type ("bool"),
|
2005-03-11 10:24:23 +08:00
|
|
|
|
i);
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* end of C++. */
|
|
|
|
|
|
|
|
|
|
%%
|
|
|
|
|
|
|
|
|
|
/* Apply QUALIFIERS to LHS and return a qualified component. IS_METHOD
|
|
|
|
|
is set if LHS is a method, in which case the qualifiers are logically
|
|
|
|
|
applied to "this". We apply qualifiers in a consistent order; LHS
|
|
|
|
|
may already be qualified; duplicate qualifiers are not created. */
|
|
|
|
|
|
|
|
|
|
struct demangle_component *
|
2018-06-02 01:50:01 +08:00
|
|
|
|
cpname_state::d_qualify (struct demangle_component *lhs, int qualifiers,
|
|
|
|
|
int is_method)
|
2005-03-11 10:24:23 +08:00
|
|
|
|
{
|
|
|
|
|
struct demangle_component **inner_p;
|
|
|
|
|
enum demangle_component_type type;
|
|
|
|
|
|
|
|
|
|
/* For now the order is CONST (innermost), VOLATILE, RESTRICT. */
|
|
|
|
|
|
|
|
|
|
#define HANDLE_QUAL(TYPE, MTYPE, QUAL) \
|
|
|
|
|
if ((qualifiers & QUAL) && (type != TYPE) && (type != MTYPE)) \
|
|
|
|
|
{ \
|
2018-06-02 01:50:01 +08:00
|
|
|
|
*inner_p = fill_comp (is_method ? MTYPE : TYPE, \
|
|
|
|
|
*inner_p, NULL); \
|
2005-03-11 10:24:23 +08:00
|
|
|
|
inner_p = &d_left (*inner_p); \
|
|
|
|
|
type = (*inner_p)->type; \
|
|
|
|
|
} \
|
|
|
|
|
else if (type == TYPE || type == MTYPE) \
|
|
|
|
|
{ \
|
|
|
|
|
inner_p = &d_left (*inner_p); \
|
|
|
|
|
type = (*inner_p)->type; \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inner_p = &lhs;
|
|
|
|
|
|
|
|
|
|
type = (*inner_p)->type;
|
|
|
|
|
|
|
|
|
|
HANDLE_QUAL (DEMANGLE_COMPONENT_RESTRICT, DEMANGLE_COMPONENT_RESTRICT_THIS, QUAL_RESTRICT);
|
|
|
|
|
HANDLE_QUAL (DEMANGLE_COMPONENT_VOLATILE, DEMANGLE_COMPONENT_VOLATILE_THIS, QUAL_VOLATILE);
|
|
|
|
|
HANDLE_QUAL (DEMANGLE_COMPONENT_CONST, DEMANGLE_COMPONENT_CONST_THIS, QUAL_CONST);
|
|
|
|
|
|
|
|
|
|
return lhs;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return a builtin type corresponding to FLAGS. */
|
|
|
|
|
|
2018-06-02 01:50:01 +08:00
|
|
|
|
struct demangle_component *
|
|
|
|
|
cpname_state::d_int_type (int flags)
|
2005-03-11 10:24:23 +08:00
|
|
|
|
{
|
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
|
|
switch (flags)
|
|
|
|
|
{
|
|
|
|
|
case INT_SIGNED | INT_CHAR:
|
|
|
|
|
name = "signed char";
|
|
|
|
|
break;
|
|
|
|
|
case INT_CHAR:
|
|
|
|
|
name = "char";
|
|
|
|
|
break;
|
|
|
|
|
case INT_UNSIGNED | INT_CHAR:
|
|
|
|
|
name = "unsigned char";
|
|
|
|
|
break;
|
|
|
|
|
case 0:
|
|
|
|
|
case INT_SIGNED:
|
|
|
|
|
name = "int";
|
|
|
|
|
break;
|
|
|
|
|
case INT_UNSIGNED:
|
|
|
|
|
name = "unsigned int";
|
|
|
|
|
break;
|
|
|
|
|
case INT_LONG:
|
|
|
|
|
case INT_SIGNED | INT_LONG:
|
|
|
|
|
name = "long";
|
|
|
|
|
break;
|
|
|
|
|
case INT_UNSIGNED | INT_LONG:
|
|
|
|
|
name = "unsigned long";
|
|
|
|
|
break;
|
|
|
|
|
case INT_SHORT:
|
|
|
|
|
case INT_SIGNED | INT_SHORT:
|
|
|
|
|
name = "short";
|
|
|
|
|
break;
|
|
|
|
|
case INT_UNSIGNED | INT_SHORT:
|
|
|
|
|
name = "unsigned short";
|
|
|
|
|
break;
|
|
|
|
|
case INT_LLONG | INT_LONG:
|
|
|
|
|
case INT_SIGNED | INT_LLONG | INT_LONG:
|
|
|
|
|
name = "long long";
|
|
|
|
|
break;
|
|
|
|
|
case INT_UNSIGNED | INT_LLONG | INT_LONG:
|
|
|
|
|
name = "unsigned long long";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-02 01:50:01 +08:00
|
|
|
|
return make_builtin_type (name);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Wrapper to create a unary operation. */
|
|
|
|
|
|
2018-06-02 01:50:01 +08:00
|
|
|
|
struct demangle_component *
|
|
|
|
|
cpname_state::d_unary (const char *name, struct demangle_component *lhs)
|
2005-03-11 10:24:23 +08:00
|
|
|
|
{
|
2018-06-02 01:50:01 +08:00
|
|
|
|
return fill_comp (DEMANGLE_COMPONENT_UNARY, make_operator (name, 1), lhs);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Wrapper to create a binary operation. */
|
|
|
|
|
|
2018-06-02 01:50:01 +08:00
|
|
|
|
struct demangle_component *
|
|
|
|
|
cpname_state::d_binary (const char *name, struct demangle_component *lhs,
|
|
|
|
|
struct demangle_component *rhs)
|
2005-03-11 10:24:23 +08:00
|
|
|
|
{
|
2018-06-02 01:50:01 +08:00
|
|
|
|
return fill_comp (DEMANGLE_COMPONENT_BINARY, make_operator (name, 2),
|
|
|
|
|
fill_comp (DEMANGLE_COMPONENT_BINARY_ARGS, lhs, rhs));
|
2005-03-11 10:24:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Find the end of a symbol name starting at LEXPTR. */
|
|
|
|
|
|
|
|
|
|
static const char *
|
|
|
|
|
symbol_end (const char *lexptr)
|
|
|
|
|
{
|
|
|
|
|
const char *p = lexptr;
|
|
|
|
|
|
2018-05-23 00:35:38 +08:00
|
|
|
|
while (*p && (c_ident_is_alnum (*p) || *p == '_' || *p == '$' || *p == '.'))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
p++;
|
|
|
|
|
|
|
|
|
|
return p;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Take care of parsing a number (anything that starts with a digit).
|
|
|
|
|
The number starts at P and contains LEN characters. Store the result in
|
|
|
|
|
YYLVAL. */
|
|
|
|
|
|
2018-06-02 01:50:01 +08:00
|
|
|
|
int
|
|
|
|
|
cpname_state::parse_number (const char *p, int len, int parsed_float,
|
|
|
|
|
YYSTYPE *lvalp)
|
2005-03-11 10:24:23 +08:00
|
|
|
|
{
|
|
|
|
|
int unsigned_p = 0;
|
|
|
|
|
|
|
|
|
|
/* Number of "L" suffixes encountered. */
|
|
|
|
|
int long_p = 0;
|
|
|
|
|
|
|
|
|
|
struct demangle_component *type, *name;
|
|
|
|
|
enum demangle_component_type literal_type;
|
|
|
|
|
|
|
|
|
|
if (p[0] == '-')
|
|
|
|
|
{
|
|
|
|
|
literal_type = DEMANGLE_COMPONENT_LITERAL_NEG;
|
|
|
|
|
p++;
|
|
|
|
|
len--;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
literal_type = DEMANGLE_COMPONENT_LITERAL;
|
|
|
|
|
|
|
|
|
|
if (parsed_float)
|
|
|
|
|
{
|
|
|
|
|
/* It's a float since it contains a point or an exponent. */
|
|
|
|
|
char c;
|
|
|
|
|
|
|
|
|
|
/* The GDB lexer checks the result of scanf at this point. Not doing
|
gdb, gdbserver, gdbsupport: fix leading space vs tabs issues
Many spots incorrectly use only spaces for indentation (for example,
there are a lot of spots in ada-lang.c). I've always found it awkward
when I needed to edit one of these spots: do I keep the original wrong
indentation, or do I fix it? What if the lines around it are also
wrong, do I fix them too? I probably don't want to fix them in the same
patch, to avoid adding noise to my patch.
So I propose to fix as much as possible once and for all (hopefully).
One typical counter argument for this is that it makes code archeology
more difficult, because git-blame will show this commit as the last
change for these lines. My counter counter argument is: when
git-blaming, you often need to do "blame the file at the parent commit"
anyway, to go past some other refactor that touched the line you are
interested in, but is not the change you are looking for. So you
already need a somewhat efficient way to do this.
Using some interactive tool, rather than plain git-blame, makes this
trivial. For example, I use "tig blame <file>", where going back past
the commit that changed the currently selected line is one keystroke.
It looks like Magit in Emacs does it too (though I've never used it).
Web viewers of Github and Gitlab do it too. My point is that it won't
really make archeology more difficult.
The other typical counter argument is that it will cause conflicts with
existing patches. That's true... but it's a one time cost, and those
are not conflicts that are difficult to resolve. I have also tried "git
rebase --ignore-whitespace", it seems to work well. Although that will
re-introduce the faulty indentation, so one needs to take care of fixing
the indentation in the patch after that (which is easy).
gdb/ChangeLog:
* aarch64-linux-tdep.c: Fix indentation.
* aarch64-ravenscar-thread.c: Fix indentation.
* aarch64-tdep.c: Fix indentation.
* aarch64-tdep.h: Fix indentation.
* ada-lang.c: Fix indentation.
* ada-lang.h: Fix indentation.
* ada-tasks.c: Fix indentation.
* ada-typeprint.c: Fix indentation.
* ada-valprint.c: Fix indentation.
* ada-varobj.c: Fix indentation.
* addrmap.c: Fix indentation.
* addrmap.h: Fix indentation.
* agent.c: Fix indentation.
* aix-thread.c: Fix indentation.
* alpha-bsd-nat.c: Fix indentation.
* alpha-linux-tdep.c: Fix indentation.
* alpha-mdebug-tdep.c: Fix indentation.
* alpha-nbsd-tdep.c: Fix indentation.
* alpha-obsd-tdep.c: Fix indentation.
* alpha-tdep.c: Fix indentation.
* amd64-bsd-nat.c: Fix indentation.
* amd64-darwin-tdep.c: Fix indentation.
* amd64-linux-nat.c: Fix indentation.
* amd64-linux-tdep.c: Fix indentation.
* amd64-nat.c: Fix indentation.
* amd64-obsd-tdep.c: Fix indentation.
* amd64-tdep.c: Fix indentation.
* amd64-windows-tdep.c: Fix indentation.
* annotate.c: Fix indentation.
* arc-tdep.c: Fix indentation.
* arch-utils.c: Fix indentation.
* arch/arm-get-next-pcs.c: Fix indentation.
* arch/arm.c: Fix indentation.
* arm-linux-nat.c: Fix indentation.
* arm-linux-tdep.c: Fix indentation.
* arm-nbsd-tdep.c: Fix indentation.
* arm-pikeos-tdep.c: Fix indentation.
* arm-tdep.c: Fix indentation.
* arm-tdep.h: Fix indentation.
* arm-wince-tdep.c: Fix indentation.
* auto-load.c: Fix indentation.
* auxv.c: Fix indentation.
* avr-tdep.c: Fix indentation.
* ax-gdb.c: Fix indentation.
* ax-general.c: Fix indentation.
* bfin-linux-tdep.c: Fix indentation.
* block.c: Fix indentation.
* block.h: Fix indentation.
* blockframe.c: Fix indentation.
* bpf-tdep.c: Fix indentation.
* break-catch-sig.c: Fix indentation.
* break-catch-syscall.c: Fix indentation.
* break-catch-throw.c: Fix indentation.
* breakpoint.c: Fix indentation.
* breakpoint.h: Fix indentation.
* bsd-uthread.c: Fix indentation.
* btrace.c: Fix indentation.
* build-id.c: Fix indentation.
* buildsym-legacy.h: Fix indentation.
* buildsym.c: Fix indentation.
* c-typeprint.c: Fix indentation.
* c-valprint.c: Fix indentation.
* c-varobj.c: Fix indentation.
* charset.c: Fix indentation.
* cli/cli-cmds.c: Fix indentation.
* cli/cli-decode.c: Fix indentation.
* cli/cli-decode.h: Fix indentation.
* cli/cli-script.c: Fix indentation.
* cli/cli-setshow.c: Fix indentation.
* coff-pe-read.c: Fix indentation.
* coffread.c: Fix indentation.
* compile/compile-cplus-types.c: Fix indentation.
* compile/compile-object-load.c: Fix indentation.
* compile/compile-object-run.c: Fix indentation.
* completer.c: Fix indentation.
* corefile.c: Fix indentation.
* corelow.c: Fix indentation.
* cp-abi.h: Fix indentation.
* cp-namespace.c: Fix indentation.
* cp-support.c: Fix indentation.
* cp-valprint.c: Fix indentation.
* cris-linux-tdep.c: Fix indentation.
* cris-tdep.c: Fix indentation.
* darwin-nat-info.c: Fix indentation.
* darwin-nat.c: Fix indentation.
* darwin-nat.h: Fix indentation.
* dbxread.c: Fix indentation.
* dcache.c: Fix indentation.
* disasm.c: Fix indentation.
* dtrace-probe.c: Fix indentation.
* dwarf2/abbrev.c: Fix indentation.
* dwarf2/attribute.c: Fix indentation.
* dwarf2/expr.c: Fix indentation.
* dwarf2/frame.c: Fix indentation.
* dwarf2/index-cache.c: Fix indentation.
* dwarf2/index-write.c: Fix indentation.
* dwarf2/line-header.c: Fix indentation.
* dwarf2/loc.c: Fix indentation.
* dwarf2/macro.c: Fix indentation.
* dwarf2/read.c: Fix indentation.
* dwarf2/read.h: Fix indentation.
* elfread.c: Fix indentation.
* eval.c: Fix indentation.
* event-top.c: Fix indentation.
* exec.c: Fix indentation.
* exec.h: Fix indentation.
* expprint.c: Fix indentation.
* f-lang.c: Fix indentation.
* f-typeprint.c: Fix indentation.
* f-valprint.c: Fix indentation.
* fbsd-nat.c: Fix indentation.
* fbsd-tdep.c: Fix indentation.
* findvar.c: Fix indentation.
* fork-child.c: Fix indentation.
* frame-unwind.c: Fix indentation.
* frame-unwind.h: Fix indentation.
* frame.c: Fix indentation.
* frv-linux-tdep.c: Fix indentation.
* frv-tdep.c: Fix indentation.
* frv-tdep.h: Fix indentation.
* ft32-tdep.c: Fix indentation.
* gcore.c: Fix indentation.
* gdb_bfd.c: Fix indentation.
* gdbarch.sh: Fix indentation.
* gdbarch.c: Re-generate
* gdbarch.h: Re-generate.
* gdbcore.h: Fix indentation.
* gdbthread.h: Fix indentation.
* gdbtypes.c: Fix indentation.
* gdbtypes.h: Fix indentation.
* glibc-tdep.c: Fix indentation.
* gnu-nat.c: Fix indentation.
* gnu-nat.h: Fix indentation.
* gnu-v2-abi.c: Fix indentation.
* gnu-v3-abi.c: Fix indentation.
* go32-nat.c: Fix indentation.
* guile/guile-internal.h: Fix indentation.
* guile/scm-cmd.c: Fix indentation.
* guile/scm-frame.c: Fix indentation.
* guile/scm-iterator.c: Fix indentation.
* guile/scm-math.c: Fix indentation.
* guile/scm-ports.c: Fix indentation.
* guile/scm-pretty-print.c: Fix indentation.
* guile/scm-value.c: Fix indentation.
* h8300-tdep.c: Fix indentation.
* hppa-linux-nat.c: Fix indentation.
* hppa-linux-tdep.c: Fix indentation.
* hppa-nbsd-nat.c: Fix indentation.
* hppa-nbsd-tdep.c: Fix indentation.
* hppa-obsd-nat.c: Fix indentation.
* hppa-tdep.c: Fix indentation.
* hppa-tdep.h: Fix indentation.
* i386-bsd-nat.c: Fix indentation.
* i386-darwin-nat.c: Fix indentation.
* i386-darwin-tdep.c: Fix indentation.
* i386-dicos-tdep.c: Fix indentation.
* i386-gnu-nat.c: Fix indentation.
* i386-linux-nat.c: Fix indentation.
* i386-linux-tdep.c: Fix indentation.
* i386-nto-tdep.c: Fix indentation.
* i386-obsd-tdep.c: Fix indentation.
* i386-sol2-nat.c: Fix indentation.
* i386-tdep.c: Fix indentation.
* i386-tdep.h: Fix indentation.
* i386-windows-tdep.c: Fix indentation.
* i387-tdep.c: Fix indentation.
* i387-tdep.h: Fix indentation.
* ia64-libunwind-tdep.c: Fix indentation.
* ia64-libunwind-tdep.h: Fix indentation.
* ia64-linux-nat.c: Fix indentation.
* ia64-linux-tdep.c: Fix indentation.
* ia64-tdep.c: Fix indentation.
* ia64-tdep.h: Fix indentation.
* ia64-vms-tdep.c: Fix indentation.
* infcall.c: Fix indentation.
* infcmd.c: Fix indentation.
* inferior.c: Fix indentation.
* infrun.c: Fix indentation.
* iq2000-tdep.c: Fix indentation.
* language.c: Fix indentation.
* linespec.c: Fix indentation.
* linux-fork.c: Fix indentation.
* linux-nat.c: Fix indentation.
* linux-tdep.c: Fix indentation.
* linux-thread-db.c: Fix indentation.
* lm32-tdep.c: Fix indentation.
* m2-lang.c: Fix indentation.
* m2-typeprint.c: Fix indentation.
* m2-valprint.c: Fix indentation.
* m32c-tdep.c: Fix indentation.
* m32r-linux-tdep.c: Fix indentation.
* m32r-tdep.c: Fix indentation.
* m68hc11-tdep.c: Fix indentation.
* m68k-bsd-nat.c: Fix indentation.
* m68k-linux-nat.c: Fix indentation.
* m68k-linux-tdep.c: Fix indentation.
* m68k-tdep.c: Fix indentation.
* machoread.c: Fix indentation.
* macrocmd.c: Fix indentation.
* macroexp.c: Fix indentation.
* macroscope.c: Fix indentation.
* macrotab.c: Fix indentation.
* macrotab.h: Fix indentation.
* main.c: Fix indentation.
* mdebugread.c: Fix indentation.
* mep-tdep.c: Fix indentation.
* mi/mi-cmd-catch.c: Fix indentation.
* mi/mi-cmd-disas.c: Fix indentation.
* mi/mi-cmd-env.c: Fix indentation.
* mi/mi-cmd-stack.c: Fix indentation.
* mi/mi-cmd-var.c: Fix indentation.
* mi/mi-cmds.c: Fix indentation.
* mi/mi-main.c: Fix indentation.
* mi/mi-parse.c: Fix indentation.
* microblaze-tdep.c: Fix indentation.
* minidebug.c: Fix indentation.
* minsyms.c: Fix indentation.
* mips-linux-nat.c: Fix indentation.
* mips-linux-tdep.c: Fix indentation.
* mips-nbsd-tdep.c: Fix indentation.
* mips-tdep.c: Fix indentation.
* mn10300-linux-tdep.c: Fix indentation.
* mn10300-tdep.c: Fix indentation.
* moxie-tdep.c: Fix indentation.
* msp430-tdep.c: Fix indentation.
* namespace.h: Fix indentation.
* nat/fork-inferior.c: Fix indentation.
* nat/gdb_ptrace.h: Fix indentation.
* nat/linux-namespaces.c: Fix indentation.
* nat/linux-osdata.c: Fix indentation.
* nat/netbsd-nat.c: Fix indentation.
* nat/x86-dregs.c: Fix indentation.
* nbsd-nat.c: Fix indentation.
* nbsd-tdep.c: Fix indentation.
* nios2-linux-tdep.c: Fix indentation.
* nios2-tdep.c: Fix indentation.
* nto-procfs.c: Fix indentation.
* nto-tdep.c: Fix indentation.
* objfiles.c: Fix indentation.
* objfiles.h: Fix indentation.
* opencl-lang.c: Fix indentation.
* or1k-tdep.c: Fix indentation.
* osabi.c: Fix indentation.
* osabi.h: Fix indentation.
* osdata.c: Fix indentation.
* p-lang.c: Fix indentation.
* p-typeprint.c: Fix indentation.
* p-valprint.c: Fix indentation.
* parse.c: Fix indentation.
* ppc-linux-nat.c: Fix indentation.
* ppc-linux-tdep.c: Fix indentation.
* ppc-nbsd-nat.c: Fix indentation.
* ppc-nbsd-tdep.c: Fix indentation.
* ppc-obsd-nat.c: Fix indentation.
* ppc-ravenscar-thread.c: Fix indentation.
* ppc-sysv-tdep.c: Fix indentation.
* ppc64-tdep.c: Fix indentation.
* printcmd.c: Fix indentation.
* proc-api.c: Fix indentation.
* producer.c: Fix indentation.
* producer.h: Fix indentation.
* prologue-value.c: Fix indentation.
* prologue-value.h: Fix indentation.
* psymtab.c: Fix indentation.
* python/py-arch.c: Fix indentation.
* python/py-bpevent.c: Fix indentation.
* python/py-event.c: Fix indentation.
* python/py-event.h: Fix indentation.
* python/py-finishbreakpoint.c: Fix indentation.
* python/py-frame.c: Fix indentation.
* python/py-framefilter.c: Fix indentation.
* python/py-inferior.c: Fix indentation.
* python/py-infthread.c: Fix indentation.
* python/py-objfile.c: Fix indentation.
* python/py-prettyprint.c: Fix indentation.
* python/py-registers.c: Fix indentation.
* python/py-signalevent.c: Fix indentation.
* python/py-stopevent.c: Fix indentation.
* python/py-stopevent.h: Fix indentation.
* python/py-threadevent.c: Fix indentation.
* python/py-tui.c: Fix indentation.
* python/py-unwind.c: Fix indentation.
* python/py-value.c: Fix indentation.
* python/py-xmethods.c: Fix indentation.
* python/python-internal.h: Fix indentation.
* python/python.c: Fix indentation.
* ravenscar-thread.c: Fix indentation.
* record-btrace.c: Fix indentation.
* record-full.c: Fix indentation.
* record.c: Fix indentation.
* reggroups.c: Fix indentation.
* regset.h: Fix indentation.
* remote-fileio.c: Fix indentation.
* remote.c: Fix indentation.
* reverse.c: Fix indentation.
* riscv-linux-tdep.c: Fix indentation.
* riscv-ravenscar-thread.c: Fix indentation.
* riscv-tdep.c: Fix indentation.
* rl78-tdep.c: Fix indentation.
* rs6000-aix-tdep.c: Fix indentation.
* rs6000-lynx178-tdep.c: Fix indentation.
* rs6000-nat.c: Fix indentation.
* rs6000-tdep.c: Fix indentation.
* rust-lang.c: Fix indentation.
* rx-tdep.c: Fix indentation.
* s12z-tdep.c: Fix indentation.
* s390-linux-tdep.c: Fix indentation.
* score-tdep.c: Fix indentation.
* ser-base.c: Fix indentation.
* ser-mingw.c: Fix indentation.
* ser-uds.c: Fix indentation.
* ser-unix.c: Fix indentation.
* serial.c: Fix indentation.
* sh-linux-tdep.c: Fix indentation.
* sh-nbsd-tdep.c: Fix indentation.
* sh-tdep.c: Fix indentation.
* skip.c: Fix indentation.
* sol-thread.c: Fix indentation.
* solib-aix.c: Fix indentation.
* solib-darwin.c: Fix indentation.
* solib-frv.c: Fix indentation.
* solib-svr4.c: Fix indentation.
* solib.c: Fix indentation.
* source.c: Fix indentation.
* sparc-linux-tdep.c: Fix indentation.
* sparc-nbsd-tdep.c: Fix indentation.
* sparc-obsd-tdep.c: Fix indentation.
* sparc-ravenscar-thread.c: Fix indentation.
* sparc-tdep.c: Fix indentation.
* sparc64-linux-tdep.c: Fix indentation.
* sparc64-nbsd-tdep.c: Fix indentation.
* sparc64-obsd-tdep.c: Fix indentation.
* sparc64-tdep.c: Fix indentation.
* stabsread.c: Fix indentation.
* stack.c: Fix indentation.
* stap-probe.c: Fix indentation.
* stubs/ia64vms-stub.c: Fix indentation.
* stubs/m32r-stub.c: Fix indentation.
* stubs/m68k-stub.c: Fix indentation.
* stubs/sh-stub.c: Fix indentation.
* stubs/sparc-stub.c: Fix indentation.
* symfile-mem.c: Fix indentation.
* symfile.c: Fix indentation.
* symfile.h: Fix indentation.
* symmisc.c: Fix indentation.
* symtab.c: Fix indentation.
* symtab.h: Fix indentation.
* target-float.c: Fix indentation.
* target.c: Fix indentation.
* target.h: Fix indentation.
* tic6x-tdep.c: Fix indentation.
* tilegx-linux-tdep.c: Fix indentation.
* tilegx-tdep.c: Fix indentation.
* top.c: Fix indentation.
* tracefile-tfile.c: Fix indentation.
* tracepoint.c: Fix indentation.
* tui/tui-disasm.c: Fix indentation.
* tui/tui-io.c: Fix indentation.
* tui/tui-regs.c: Fix indentation.
* tui/tui-stack.c: Fix indentation.
* tui/tui-win.c: Fix indentation.
* tui/tui-winsource.c: Fix indentation.
* tui/tui.c: Fix indentation.
* typeprint.c: Fix indentation.
* ui-out.h: Fix indentation.
* unittests/copy_bitwise-selftests.c: Fix indentation.
* unittests/memory-map-selftests.c: Fix indentation.
* utils.c: Fix indentation.
* v850-tdep.c: Fix indentation.
* valarith.c: Fix indentation.
* valops.c: Fix indentation.
* valprint.c: Fix indentation.
* valprint.h: Fix indentation.
* value.c: Fix indentation.
* value.h: Fix indentation.
* varobj.c: Fix indentation.
* vax-tdep.c: Fix indentation.
* windows-nat.c: Fix indentation.
* windows-tdep.c: Fix indentation.
* xcoffread.c: Fix indentation.
* xml-syscall.c: Fix indentation.
* xml-tdesc.c: Fix indentation.
* xstormy16-tdep.c: Fix indentation.
* xtensa-config.c: Fix indentation.
* xtensa-linux-nat.c: Fix indentation.
* xtensa-linux-tdep.c: Fix indentation.
* xtensa-tdep.c: Fix indentation.
gdbserver/ChangeLog:
* ax.cc: Fix indentation.
* dll.cc: Fix indentation.
* inferiors.h: Fix indentation.
* linux-low.cc: Fix indentation.
* linux-nios2-low.cc: Fix indentation.
* linux-ppc-ipa.cc: Fix indentation.
* linux-ppc-low.cc: Fix indentation.
* linux-x86-low.cc: Fix indentation.
* linux-xtensa-low.cc: Fix indentation.
* regcache.cc: Fix indentation.
* server.cc: Fix indentation.
* tracepoint.cc: Fix indentation.
gdbsupport/ChangeLog:
* common-exceptions.h: Fix indentation.
* event-loop.cc: Fix indentation.
* fileio.cc: Fix indentation.
* filestuff.cc: Fix indentation.
* gdb-dlfcn.cc: Fix indentation.
* gdb_string_view.h: Fix indentation.
* job-control.cc: Fix indentation.
* signals.cc: Fix indentation.
Change-Id: I4bad7ae6be0fbe14168b8ebafb98ffe14964a695
2020-11-02 23:26:14 +08:00
|
|
|
|
this leaves our error checking slightly weaker but only for invalid
|
|
|
|
|
data. */
|
2005-03-11 10:24:23 +08:00
|
|
|
|
|
|
|
|
|
/* See if it has `f' or `l' suffix (float or long double). */
|
|
|
|
|
|
|
|
|
|
c = TOLOWER (p[len - 1]);
|
|
|
|
|
|
|
|
|
|
if (c == 'f')
|
|
|
|
|
{
|
|
|
|
|
len--;
|
2018-06-02 01:50:01 +08:00
|
|
|
|
type = make_builtin_type ("float");
|
2005-03-11 10:24:23 +08:00
|
|
|
|
}
|
|
|
|
|
else if (c == 'l')
|
|
|
|
|
{
|
|
|
|
|
len--;
|
2018-06-02 01:50:01 +08:00
|
|
|
|
type = make_builtin_type ("long double");
|
2005-03-11 10:24:23 +08:00
|
|
|
|
}
|
|
|
|
|
else if (ISDIGIT (c) || c == '.')
|
2018-06-02 01:50:01 +08:00
|
|
|
|
type = make_builtin_type ("double");
|
2005-03-11 10:24:23 +08:00
|
|
|
|
else
|
|
|
|
|
return ERROR;
|
|
|
|
|
|
2018-06-02 01:50:01 +08:00
|
|
|
|
name = make_name (p, len);
|
|
|
|
|
lvalp->comp = fill_comp (literal_type, type, name);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
|
|
|
|
|
return FLOAT;
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-12 02:43:06 +08:00
|
|
|
|
/* Note that we do not automatically generate unsigned types. This
|
|
|
|
|
can't be done because we don't have access to the gdbarch
|
|
|
|
|
here. */
|
|
|
|
|
|
|
|
|
|
int base = 10;
|
|
|
|
|
if (len > 1 && p[0] == '0')
|
|
|
|
|
{
|
|
|
|
|
if (p[1] == 'x' || p[1] == 'X')
|
|
|
|
|
{
|
|
|
|
|
base = 16;
|
|
|
|
|
p += 2;
|
|
|
|
|
len -= 2;
|
|
|
|
|
}
|
|
|
|
|
else if (p[1] == 'b' || p[1] == 'B')
|
|
|
|
|
{
|
|
|
|
|
base = 2;
|
|
|
|
|
p += 2;
|
|
|
|
|
len -= 2;
|
|
|
|
|
}
|
|
|
|
|
else if (p[1] == 'd' || p[1] == 'D' || p[1] == 't' || p[1] == 'T')
|
|
|
|
|
{
|
|
|
|
|
/* Apparently gdb extensions. */
|
|
|
|
|
base = 10;
|
|
|
|
|
p += 2;
|
|
|
|
|
len -= 2;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
base = 8;
|
|
|
|
|
}
|
2005-03-11 10:24:23 +08:00
|
|
|
|
|
|
|
|
|
long_p = 0;
|
|
|
|
|
unsigned_p = 0;
|
|
|
|
|
while (len > 0)
|
|
|
|
|
{
|
|
|
|
|
if (p[len - 1] == 'l' || p[len - 1] == 'L')
|
|
|
|
|
{
|
|
|
|
|
len--;
|
|
|
|
|
long_p++;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (p[len - 1] == 'u' || p[len - 1] == 'U')
|
|
|
|
|
{
|
|
|
|
|
len--;
|
|
|
|
|
unsigned_p++;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-12 02:43:06 +08:00
|
|
|
|
/* Use gdb_mpz here in case a 128-bit value appears. */
|
|
|
|
|
gdb_mpz value (0);
|
|
|
|
|
for (int off = 0; off < len; ++off)
|
|
|
|
|
{
|
|
|
|
|
int dig;
|
|
|
|
|
if (ISDIGIT (p[off]))
|
|
|
|
|
dig = p[off] - '0';
|
|
|
|
|
else
|
|
|
|
|
dig = TOLOWER (p[off]) - 'a' + 10;
|
|
|
|
|
if (dig >= base)
|
|
|
|
|
return ERROR;
|
|
|
|
|
value *= base;
|
|
|
|
|
value += dig;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string printed = value.str ();
|
|
|
|
|
const char *copy = obstack_strdup (&demangle_info->obstack, printed);
|
|
|
|
|
|
2005-03-11 10:24:23 +08:00
|
|
|
|
if (long_p == 0)
|
|
|
|
|
{
|
2024-04-12 10:00:09 +08:00
|
|
|
|
if (unsigned_p)
|
|
|
|
|
type = make_builtin_type ("unsigned int");
|
|
|
|
|
else
|
|
|
|
|
type = make_builtin_type ("int");
|
2005-03-11 10:24:23 +08:00
|
|
|
|
}
|
|
|
|
|
else if (long_p == 1)
|
|
|
|
|
{
|
2024-04-12 10:00:09 +08:00
|
|
|
|
if (unsigned_p)
|
|
|
|
|
type = make_builtin_type ("unsigned long");
|
|
|
|
|
else
|
|
|
|
|
type = make_builtin_type ("long");
|
2005-03-11 10:24:23 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2024-04-12 10:00:09 +08:00
|
|
|
|
if (unsigned_p)
|
|
|
|
|
type = make_builtin_type ("unsigned long long");
|
|
|
|
|
else
|
|
|
|
|
type = make_builtin_type ("long long");
|
2005-03-11 10:24:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-04-12 02:43:06 +08:00
|
|
|
|
name = make_name (copy, strlen (copy));
|
|
|
|
|
lvalp->comp = fill_comp (literal_type, type, name);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
|
2024-04-12 02:43:06 +08:00
|
|
|
|
return INT;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-05-30 22:19:01 +08:00
|
|
|
|
static const char backslashable[] = "abefnrtv";
|
|
|
|
|
static const char represented[] = "\a\b\e\f\n\r\t\v";
|
2005-03-11 10:24:23 +08:00
|
|
|
|
|
|
|
|
|
/* Translate the backslash the way we would in the host character set. */
|
|
|
|
|
static int
|
|
|
|
|
c_parse_backslash (int host_char, int *target_char)
|
|
|
|
|
{
|
|
|
|
|
const char *ix;
|
|
|
|
|
ix = strchr (backslashable, host_char);
|
|
|
|
|
if (! ix)
|
|
|
|
|
return 0;
|
|
|
|
|
else
|
|
|
|
|
*target_char = represented[ix - backslashable];
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Parse a C escape sequence. STRING_PTR points to a variable
|
|
|
|
|
containing a pointer to the string to parse. That pointer
|
|
|
|
|
should point to the character after the \. That pointer
|
|
|
|
|
is updated past the characters we use. The value of the
|
|
|
|
|
escape sequence is returned.
|
|
|
|
|
|
|
|
|
|
A negative value means the sequence \ newline was seen,
|
|
|
|
|
which is supposed to be equivalent to nothing at all.
|
|
|
|
|
|
|
|
|
|
If \ is followed by a null character, we return a negative
|
|
|
|
|
value and leave the string pointer pointing at the null character.
|
|
|
|
|
|
|
|
|
|
If \ is followed by 000, we return 0 and leave the string pointer
|
|
|
|
|
after the zeros. A value of 0 does not mean end of string. */
|
|
|
|
|
|
|
|
|
|
static int
|
2008-10-28 03:28:52 +08:00
|
|
|
|
cp_parse_escape (const char **string_ptr)
|
2005-03-11 10:24:23 +08:00
|
|
|
|
{
|
2005-05-29 00:48:58 +08:00
|
|
|
|
int target_char;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
int c = *(*string_ptr)++;
|
|
|
|
|
if (c_parse_backslash (c, &target_char))
|
|
|
|
|
return target_char;
|
|
|
|
|
else
|
|
|
|
|
switch (c)
|
|
|
|
|
{
|
|
|
|
|
case '\n':
|
|
|
|
|
return -2;
|
|
|
|
|
case 0:
|
|
|
|
|
(*string_ptr)--;
|
|
|
|
|
return 0;
|
|
|
|
|
case '^':
|
|
|
|
|
{
|
|
|
|
|
c = *(*string_ptr)++;
|
|
|
|
|
|
|
|
|
|
if (c == '?')
|
|
|
|
|
return 0177;
|
|
|
|
|
else if (c == '\\')
|
2008-10-28 03:28:52 +08:00
|
|
|
|
target_char = cp_parse_escape (string_ptr);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
else
|
|
|
|
|
target_char = c;
|
|
|
|
|
|
|
|
|
|
/* Now target_char is something like `c', and we want to find
|
|
|
|
|
its control-character equivalent. */
|
|
|
|
|
target_char = target_char & 037;
|
|
|
|
|
|
|
|
|
|
return target_char;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case '0':
|
|
|
|
|
case '1':
|
|
|
|
|
case '2':
|
|
|
|
|
case '3':
|
|
|
|
|
case '4':
|
|
|
|
|
case '5':
|
|
|
|
|
case '6':
|
|
|
|
|
case '7':
|
|
|
|
|
{
|
|
|
|
|
int i = c - '0';
|
|
|
|
|
int count = 0;
|
|
|
|
|
while (++count < 3)
|
|
|
|
|
{
|
|
|
|
|
c = (**string_ptr);
|
|
|
|
|
if (c >= '0' && c <= '7')
|
|
|
|
|
{
|
|
|
|
|
(*string_ptr)++;
|
|
|
|
|
i *= 8;
|
|
|
|
|
i += c - '0';
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
default:
|
2005-05-29 00:48:58 +08:00
|
|
|
|
return c;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define HANDLE_SPECIAL(string, comp) \
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, string)) \
|
2005-03-11 10:24:23 +08:00
|
|
|
|
{ \
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->lexptr = tokstart + sizeof (string) - 1; \
|
|
|
|
|
lvalp->lval = comp; \
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return DEMANGLER_SPECIAL; \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define HANDLE_TOKEN2(string, token) \
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
if (state->lexptr[1] == string[1]) \
|
2005-03-11 10:24:23 +08:00
|
|
|
|
{ \
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->lexptr += 2; \
|
|
|
|
|
lvalp->opname = string; \
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return token; \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define HANDLE_TOKEN3(string, token) \
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
if (state->lexptr[1] == string[1] && state->lexptr[2] == string[2]) \
|
2005-03-11 10:24:23 +08:00
|
|
|
|
{ \
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->lexptr += 3; \
|
|
|
|
|
lvalp->opname = string; \
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return token; \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Read one token, getting characters through LEXPTR. */
|
|
|
|
|
|
|
|
|
|
static int
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
yylex (YYSTYPE *lvalp, cpname_state *state)
|
2005-03-11 10:24:23 +08:00
|
|
|
|
{
|
|
|
|
|
int c;
|
|
|
|
|
int namelen;
|
2010-05-06 08:08:44 +08:00
|
|
|
|
const char *tokstart;
|
2024-04-11 06:49:51 +08:00
|
|
|
|
char *copy;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
|
|
|
|
|
retry:
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->prev_lexptr = state->lexptr;
|
|
|
|
|
tokstart = state->lexptr;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
|
|
|
|
|
switch (c = *tokstart)
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
case ' ':
|
|
|
|
|
case '\t':
|
|
|
|
|
case '\n':
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->lexptr++;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
goto retry;
|
|
|
|
|
|
|
|
|
|
case '\'':
|
|
|
|
|
/* We either have a character constant ('0' or '\177' for example)
|
|
|
|
|
or we have a quoted symbol reference ('foo(int,int)' in C++
|
|
|
|
|
for example). */
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->lexptr++;
|
|
|
|
|
c = *state->lexptr++;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
if (c == '\\')
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
c = cp_parse_escape (&state->lexptr);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
else if (c == '\'')
|
|
|
|
|
{
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
yyerror (state, _("empty character constant"));
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return ERROR;
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-11 06:49:51 +08:00
|
|
|
|
/* We over-allocate here, but it doesn't really matter . */
|
|
|
|
|
copy = (char *) obstack_alloc (&state->demangle_info->obstack, 30);
|
|
|
|
|
xsnprintf (copy, 30, "%d", c);
|
|
|
|
|
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
c = *state->lexptr++;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
if (c != '\'')
|
|
|
|
|
{
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
yyerror (state, _("invalid character constant"));
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return ERROR;
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-02 01:50:01 +08:00
|
|
|
|
lvalp->comp
|
|
|
|
|
= state->fill_comp (DEMANGLE_COMPONENT_LITERAL,
|
|
|
|
|
state->make_builtin_type ("char"),
|
2024-04-11 06:49:51 +08:00
|
|
|
|
state->make_name (copy, strlen (copy)));
|
2005-03-11 10:24:23 +08:00
|
|
|
|
|
|
|
|
|
return INT;
|
|
|
|
|
|
|
|
|
|
case '(':
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "(anonymous namespace)"))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
{
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->lexptr += 21;
|
2018-06-02 01:50:01 +08:00
|
|
|
|
lvalp->comp = state->make_name ("(anonymous namespace)",
|
|
|
|
|
sizeof "(anonymous namespace)" - 1);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return NAME;
|
|
|
|
|
}
|
2023-10-16 01:09:07 +08:00
|
|
|
|
[[fallthrough]];
|
2005-03-11 10:24:23 +08:00
|
|
|
|
|
|
|
|
|
case ')':
|
|
|
|
|
case ',':
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->lexptr++;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return c;
|
|
|
|
|
|
|
|
|
|
case '.':
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
if (state->lexptr[1] == '.' && state->lexptr[2] == '.')
|
2005-03-11 10:24:23 +08:00
|
|
|
|
{
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->lexptr += 3;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return ELLIPSIS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Might be a floating point number. */
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
if (state->lexptr[1] < '0' || state->lexptr[1] > '9')
|
2005-03-11 10:24:23 +08:00
|
|
|
|
goto symbol; /* Nope, must be a symbol. */
|
|
|
|
|
|
|
|
|
|
goto try_number;
|
|
|
|
|
|
|
|
|
|
case '-':
|
|
|
|
|
HANDLE_TOKEN2 ("-=", ASSIGN_MODIFY);
|
|
|
|
|
HANDLE_TOKEN2 ("--", DECREMENT);
|
|
|
|
|
HANDLE_TOKEN2 ("->", ARROW);
|
|
|
|
|
|
|
|
|
|
/* For construction vtables. This is kind of hokey. */
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "-in-"))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
{
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->lexptr += 4;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return CONSTRUCTION_IN;
|
|
|
|
|
}
|
|
|
|
|
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
if (state->lexptr[1] < '0' || state->lexptr[1] > '9')
|
2005-03-11 10:24:23 +08:00
|
|
|
|
{
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->lexptr++;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return '-';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try_number:
|
2023-12-01 04:59:16 +08:00
|
|
|
|
[[fallthrough]];
|
2005-03-11 10:24:23 +08:00
|
|
|
|
case '0':
|
|
|
|
|
case '1':
|
|
|
|
|
case '2':
|
|
|
|
|
case '3':
|
|
|
|
|
case '4':
|
|
|
|
|
case '5':
|
|
|
|
|
case '6':
|
|
|
|
|
case '7':
|
|
|
|
|
case '8':
|
|
|
|
|
case '9':
|
|
|
|
|
{
|
|
|
|
|
/* It's a number. */
|
|
|
|
|
int got_dot = 0, got_e = 0, toktype;
|
|
|
|
|
const char *p = tokstart;
|
|
|
|
|
int hex = 0;
|
|
|
|
|
|
|
|
|
|
if (c == '-')
|
|
|
|
|
p++;
|
|
|
|
|
|
|
|
|
|
if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
|
|
|
|
|
{
|
|
|
|
|
p += 2;
|
|
|
|
|
hex = 1;
|
|
|
|
|
}
|
|
|
|
|
else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
|
|
|
|
|
{
|
|
|
|
|
p += 2;
|
|
|
|
|
hex = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-20 10:22:11 +08:00
|
|
|
|
/* If the token includes the C++14 digits separator, we make a
|
|
|
|
|
copy so that we don't have to handle the separator in
|
|
|
|
|
parse_number. */
|
|
|
|
|
std::optional<std::string> no_tick;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
for (;; ++p)
|
|
|
|
|
{
|
|
|
|
|
/* This test includes !hex because 'e' is a valid hex digit
|
|
|
|
|
and thus does not indicate a floating point number when
|
|
|
|
|
the radix is hex. */
|
|
|
|
|
if (!hex && !got_e && (*p == 'e' || *p == 'E'))
|
|
|
|
|
got_dot = got_e = 1;
|
|
|
|
|
/* This test does not include !hex, because a '.' always indicates
|
|
|
|
|
a decimal floating point number regardless of the radix.
|
|
|
|
|
|
|
|
|
|
NOTE drow/2005-03-09: This comment is not accurate in C99;
|
|
|
|
|
however, it's not clear that all the floating point support
|
|
|
|
|
in this file is doing any good here. */
|
|
|
|
|
else if (!got_dot && *p == '.')
|
|
|
|
|
got_dot = 1;
|
|
|
|
|
else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
|
|
|
|
|
&& (*p == '-' || *p == '+'))
|
2024-04-20 10:22:11 +08:00
|
|
|
|
{
|
|
|
|
|
/* This is the sign of the exponent, not the end of
|
|
|
|
|
the number. */
|
|
|
|
|
}
|
|
|
|
|
/* C++14 allows a separator. */
|
|
|
|
|
else if (*p == '\'')
|
|
|
|
|
{
|
|
|
|
|
if (!no_tick.has_value ())
|
|
|
|
|
no_tick.emplace (tokstart, p);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2005-03-11 10:24:23 +08:00
|
|
|
|
/* We will take any letters or digits. parse_number will
|
|
|
|
|
complain if past the radix, or if L or U are not final. */
|
|
|
|
|
else if (! ISALNUM (*p))
|
|
|
|
|
break;
|
2024-04-20 10:22:11 +08:00
|
|
|
|
if (no_tick.has_value ())
|
|
|
|
|
no_tick->push_back (*p);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
}
|
2024-04-20 10:22:11 +08:00
|
|
|
|
if (no_tick.has_value ())
|
|
|
|
|
toktype = state->parse_number (no_tick->c_str (),
|
|
|
|
|
no_tick->length (),
|
|
|
|
|
got_dot|got_e, lvalp);
|
|
|
|
|
else
|
|
|
|
|
toktype = state->parse_number (tokstart, p - tokstart,
|
|
|
|
|
got_dot|got_e, lvalp);
|
gdb, gdbserver, gdbsupport: fix leading space vs tabs issues
Many spots incorrectly use only spaces for indentation (for example,
there are a lot of spots in ada-lang.c). I've always found it awkward
when I needed to edit one of these spots: do I keep the original wrong
indentation, or do I fix it? What if the lines around it are also
wrong, do I fix them too? I probably don't want to fix them in the same
patch, to avoid adding noise to my patch.
So I propose to fix as much as possible once and for all (hopefully).
One typical counter argument for this is that it makes code archeology
more difficult, because git-blame will show this commit as the last
change for these lines. My counter counter argument is: when
git-blaming, you often need to do "blame the file at the parent commit"
anyway, to go past some other refactor that touched the line you are
interested in, but is not the change you are looking for. So you
already need a somewhat efficient way to do this.
Using some interactive tool, rather than plain git-blame, makes this
trivial. For example, I use "tig blame <file>", where going back past
the commit that changed the currently selected line is one keystroke.
It looks like Magit in Emacs does it too (though I've never used it).
Web viewers of Github and Gitlab do it too. My point is that it won't
really make archeology more difficult.
The other typical counter argument is that it will cause conflicts with
existing patches. That's true... but it's a one time cost, and those
are not conflicts that are difficult to resolve. I have also tried "git
rebase --ignore-whitespace", it seems to work well. Although that will
re-introduce the faulty indentation, so one needs to take care of fixing
the indentation in the patch after that (which is easy).
gdb/ChangeLog:
* aarch64-linux-tdep.c: Fix indentation.
* aarch64-ravenscar-thread.c: Fix indentation.
* aarch64-tdep.c: Fix indentation.
* aarch64-tdep.h: Fix indentation.
* ada-lang.c: Fix indentation.
* ada-lang.h: Fix indentation.
* ada-tasks.c: Fix indentation.
* ada-typeprint.c: Fix indentation.
* ada-valprint.c: Fix indentation.
* ada-varobj.c: Fix indentation.
* addrmap.c: Fix indentation.
* addrmap.h: Fix indentation.
* agent.c: Fix indentation.
* aix-thread.c: Fix indentation.
* alpha-bsd-nat.c: Fix indentation.
* alpha-linux-tdep.c: Fix indentation.
* alpha-mdebug-tdep.c: Fix indentation.
* alpha-nbsd-tdep.c: Fix indentation.
* alpha-obsd-tdep.c: Fix indentation.
* alpha-tdep.c: Fix indentation.
* amd64-bsd-nat.c: Fix indentation.
* amd64-darwin-tdep.c: Fix indentation.
* amd64-linux-nat.c: Fix indentation.
* amd64-linux-tdep.c: Fix indentation.
* amd64-nat.c: Fix indentation.
* amd64-obsd-tdep.c: Fix indentation.
* amd64-tdep.c: Fix indentation.
* amd64-windows-tdep.c: Fix indentation.
* annotate.c: Fix indentation.
* arc-tdep.c: Fix indentation.
* arch-utils.c: Fix indentation.
* arch/arm-get-next-pcs.c: Fix indentation.
* arch/arm.c: Fix indentation.
* arm-linux-nat.c: Fix indentation.
* arm-linux-tdep.c: Fix indentation.
* arm-nbsd-tdep.c: Fix indentation.
* arm-pikeos-tdep.c: Fix indentation.
* arm-tdep.c: Fix indentation.
* arm-tdep.h: Fix indentation.
* arm-wince-tdep.c: Fix indentation.
* auto-load.c: Fix indentation.
* auxv.c: Fix indentation.
* avr-tdep.c: Fix indentation.
* ax-gdb.c: Fix indentation.
* ax-general.c: Fix indentation.
* bfin-linux-tdep.c: Fix indentation.
* block.c: Fix indentation.
* block.h: Fix indentation.
* blockframe.c: Fix indentation.
* bpf-tdep.c: Fix indentation.
* break-catch-sig.c: Fix indentation.
* break-catch-syscall.c: Fix indentation.
* break-catch-throw.c: Fix indentation.
* breakpoint.c: Fix indentation.
* breakpoint.h: Fix indentation.
* bsd-uthread.c: Fix indentation.
* btrace.c: Fix indentation.
* build-id.c: Fix indentation.
* buildsym-legacy.h: Fix indentation.
* buildsym.c: Fix indentation.
* c-typeprint.c: Fix indentation.
* c-valprint.c: Fix indentation.
* c-varobj.c: Fix indentation.
* charset.c: Fix indentation.
* cli/cli-cmds.c: Fix indentation.
* cli/cli-decode.c: Fix indentation.
* cli/cli-decode.h: Fix indentation.
* cli/cli-script.c: Fix indentation.
* cli/cli-setshow.c: Fix indentation.
* coff-pe-read.c: Fix indentation.
* coffread.c: Fix indentation.
* compile/compile-cplus-types.c: Fix indentation.
* compile/compile-object-load.c: Fix indentation.
* compile/compile-object-run.c: Fix indentation.
* completer.c: Fix indentation.
* corefile.c: Fix indentation.
* corelow.c: Fix indentation.
* cp-abi.h: Fix indentation.
* cp-namespace.c: Fix indentation.
* cp-support.c: Fix indentation.
* cp-valprint.c: Fix indentation.
* cris-linux-tdep.c: Fix indentation.
* cris-tdep.c: Fix indentation.
* darwin-nat-info.c: Fix indentation.
* darwin-nat.c: Fix indentation.
* darwin-nat.h: Fix indentation.
* dbxread.c: Fix indentation.
* dcache.c: Fix indentation.
* disasm.c: Fix indentation.
* dtrace-probe.c: Fix indentation.
* dwarf2/abbrev.c: Fix indentation.
* dwarf2/attribute.c: Fix indentation.
* dwarf2/expr.c: Fix indentation.
* dwarf2/frame.c: Fix indentation.
* dwarf2/index-cache.c: Fix indentation.
* dwarf2/index-write.c: Fix indentation.
* dwarf2/line-header.c: Fix indentation.
* dwarf2/loc.c: Fix indentation.
* dwarf2/macro.c: Fix indentation.
* dwarf2/read.c: Fix indentation.
* dwarf2/read.h: Fix indentation.
* elfread.c: Fix indentation.
* eval.c: Fix indentation.
* event-top.c: Fix indentation.
* exec.c: Fix indentation.
* exec.h: Fix indentation.
* expprint.c: Fix indentation.
* f-lang.c: Fix indentation.
* f-typeprint.c: Fix indentation.
* f-valprint.c: Fix indentation.
* fbsd-nat.c: Fix indentation.
* fbsd-tdep.c: Fix indentation.
* findvar.c: Fix indentation.
* fork-child.c: Fix indentation.
* frame-unwind.c: Fix indentation.
* frame-unwind.h: Fix indentation.
* frame.c: Fix indentation.
* frv-linux-tdep.c: Fix indentation.
* frv-tdep.c: Fix indentation.
* frv-tdep.h: Fix indentation.
* ft32-tdep.c: Fix indentation.
* gcore.c: Fix indentation.
* gdb_bfd.c: Fix indentation.
* gdbarch.sh: Fix indentation.
* gdbarch.c: Re-generate
* gdbarch.h: Re-generate.
* gdbcore.h: Fix indentation.
* gdbthread.h: Fix indentation.
* gdbtypes.c: Fix indentation.
* gdbtypes.h: Fix indentation.
* glibc-tdep.c: Fix indentation.
* gnu-nat.c: Fix indentation.
* gnu-nat.h: Fix indentation.
* gnu-v2-abi.c: Fix indentation.
* gnu-v3-abi.c: Fix indentation.
* go32-nat.c: Fix indentation.
* guile/guile-internal.h: Fix indentation.
* guile/scm-cmd.c: Fix indentation.
* guile/scm-frame.c: Fix indentation.
* guile/scm-iterator.c: Fix indentation.
* guile/scm-math.c: Fix indentation.
* guile/scm-ports.c: Fix indentation.
* guile/scm-pretty-print.c: Fix indentation.
* guile/scm-value.c: Fix indentation.
* h8300-tdep.c: Fix indentation.
* hppa-linux-nat.c: Fix indentation.
* hppa-linux-tdep.c: Fix indentation.
* hppa-nbsd-nat.c: Fix indentation.
* hppa-nbsd-tdep.c: Fix indentation.
* hppa-obsd-nat.c: Fix indentation.
* hppa-tdep.c: Fix indentation.
* hppa-tdep.h: Fix indentation.
* i386-bsd-nat.c: Fix indentation.
* i386-darwin-nat.c: Fix indentation.
* i386-darwin-tdep.c: Fix indentation.
* i386-dicos-tdep.c: Fix indentation.
* i386-gnu-nat.c: Fix indentation.
* i386-linux-nat.c: Fix indentation.
* i386-linux-tdep.c: Fix indentation.
* i386-nto-tdep.c: Fix indentation.
* i386-obsd-tdep.c: Fix indentation.
* i386-sol2-nat.c: Fix indentation.
* i386-tdep.c: Fix indentation.
* i386-tdep.h: Fix indentation.
* i386-windows-tdep.c: Fix indentation.
* i387-tdep.c: Fix indentation.
* i387-tdep.h: Fix indentation.
* ia64-libunwind-tdep.c: Fix indentation.
* ia64-libunwind-tdep.h: Fix indentation.
* ia64-linux-nat.c: Fix indentation.
* ia64-linux-tdep.c: Fix indentation.
* ia64-tdep.c: Fix indentation.
* ia64-tdep.h: Fix indentation.
* ia64-vms-tdep.c: Fix indentation.
* infcall.c: Fix indentation.
* infcmd.c: Fix indentation.
* inferior.c: Fix indentation.
* infrun.c: Fix indentation.
* iq2000-tdep.c: Fix indentation.
* language.c: Fix indentation.
* linespec.c: Fix indentation.
* linux-fork.c: Fix indentation.
* linux-nat.c: Fix indentation.
* linux-tdep.c: Fix indentation.
* linux-thread-db.c: Fix indentation.
* lm32-tdep.c: Fix indentation.
* m2-lang.c: Fix indentation.
* m2-typeprint.c: Fix indentation.
* m2-valprint.c: Fix indentation.
* m32c-tdep.c: Fix indentation.
* m32r-linux-tdep.c: Fix indentation.
* m32r-tdep.c: Fix indentation.
* m68hc11-tdep.c: Fix indentation.
* m68k-bsd-nat.c: Fix indentation.
* m68k-linux-nat.c: Fix indentation.
* m68k-linux-tdep.c: Fix indentation.
* m68k-tdep.c: Fix indentation.
* machoread.c: Fix indentation.
* macrocmd.c: Fix indentation.
* macroexp.c: Fix indentation.
* macroscope.c: Fix indentation.
* macrotab.c: Fix indentation.
* macrotab.h: Fix indentation.
* main.c: Fix indentation.
* mdebugread.c: Fix indentation.
* mep-tdep.c: Fix indentation.
* mi/mi-cmd-catch.c: Fix indentation.
* mi/mi-cmd-disas.c: Fix indentation.
* mi/mi-cmd-env.c: Fix indentation.
* mi/mi-cmd-stack.c: Fix indentation.
* mi/mi-cmd-var.c: Fix indentation.
* mi/mi-cmds.c: Fix indentation.
* mi/mi-main.c: Fix indentation.
* mi/mi-parse.c: Fix indentation.
* microblaze-tdep.c: Fix indentation.
* minidebug.c: Fix indentation.
* minsyms.c: Fix indentation.
* mips-linux-nat.c: Fix indentation.
* mips-linux-tdep.c: Fix indentation.
* mips-nbsd-tdep.c: Fix indentation.
* mips-tdep.c: Fix indentation.
* mn10300-linux-tdep.c: Fix indentation.
* mn10300-tdep.c: Fix indentation.
* moxie-tdep.c: Fix indentation.
* msp430-tdep.c: Fix indentation.
* namespace.h: Fix indentation.
* nat/fork-inferior.c: Fix indentation.
* nat/gdb_ptrace.h: Fix indentation.
* nat/linux-namespaces.c: Fix indentation.
* nat/linux-osdata.c: Fix indentation.
* nat/netbsd-nat.c: Fix indentation.
* nat/x86-dregs.c: Fix indentation.
* nbsd-nat.c: Fix indentation.
* nbsd-tdep.c: Fix indentation.
* nios2-linux-tdep.c: Fix indentation.
* nios2-tdep.c: Fix indentation.
* nto-procfs.c: Fix indentation.
* nto-tdep.c: Fix indentation.
* objfiles.c: Fix indentation.
* objfiles.h: Fix indentation.
* opencl-lang.c: Fix indentation.
* or1k-tdep.c: Fix indentation.
* osabi.c: Fix indentation.
* osabi.h: Fix indentation.
* osdata.c: Fix indentation.
* p-lang.c: Fix indentation.
* p-typeprint.c: Fix indentation.
* p-valprint.c: Fix indentation.
* parse.c: Fix indentation.
* ppc-linux-nat.c: Fix indentation.
* ppc-linux-tdep.c: Fix indentation.
* ppc-nbsd-nat.c: Fix indentation.
* ppc-nbsd-tdep.c: Fix indentation.
* ppc-obsd-nat.c: Fix indentation.
* ppc-ravenscar-thread.c: Fix indentation.
* ppc-sysv-tdep.c: Fix indentation.
* ppc64-tdep.c: Fix indentation.
* printcmd.c: Fix indentation.
* proc-api.c: Fix indentation.
* producer.c: Fix indentation.
* producer.h: Fix indentation.
* prologue-value.c: Fix indentation.
* prologue-value.h: Fix indentation.
* psymtab.c: Fix indentation.
* python/py-arch.c: Fix indentation.
* python/py-bpevent.c: Fix indentation.
* python/py-event.c: Fix indentation.
* python/py-event.h: Fix indentation.
* python/py-finishbreakpoint.c: Fix indentation.
* python/py-frame.c: Fix indentation.
* python/py-framefilter.c: Fix indentation.
* python/py-inferior.c: Fix indentation.
* python/py-infthread.c: Fix indentation.
* python/py-objfile.c: Fix indentation.
* python/py-prettyprint.c: Fix indentation.
* python/py-registers.c: Fix indentation.
* python/py-signalevent.c: Fix indentation.
* python/py-stopevent.c: Fix indentation.
* python/py-stopevent.h: Fix indentation.
* python/py-threadevent.c: Fix indentation.
* python/py-tui.c: Fix indentation.
* python/py-unwind.c: Fix indentation.
* python/py-value.c: Fix indentation.
* python/py-xmethods.c: Fix indentation.
* python/python-internal.h: Fix indentation.
* python/python.c: Fix indentation.
* ravenscar-thread.c: Fix indentation.
* record-btrace.c: Fix indentation.
* record-full.c: Fix indentation.
* record.c: Fix indentation.
* reggroups.c: Fix indentation.
* regset.h: Fix indentation.
* remote-fileio.c: Fix indentation.
* remote.c: Fix indentation.
* reverse.c: Fix indentation.
* riscv-linux-tdep.c: Fix indentation.
* riscv-ravenscar-thread.c: Fix indentation.
* riscv-tdep.c: Fix indentation.
* rl78-tdep.c: Fix indentation.
* rs6000-aix-tdep.c: Fix indentation.
* rs6000-lynx178-tdep.c: Fix indentation.
* rs6000-nat.c: Fix indentation.
* rs6000-tdep.c: Fix indentation.
* rust-lang.c: Fix indentation.
* rx-tdep.c: Fix indentation.
* s12z-tdep.c: Fix indentation.
* s390-linux-tdep.c: Fix indentation.
* score-tdep.c: Fix indentation.
* ser-base.c: Fix indentation.
* ser-mingw.c: Fix indentation.
* ser-uds.c: Fix indentation.
* ser-unix.c: Fix indentation.
* serial.c: Fix indentation.
* sh-linux-tdep.c: Fix indentation.
* sh-nbsd-tdep.c: Fix indentation.
* sh-tdep.c: Fix indentation.
* skip.c: Fix indentation.
* sol-thread.c: Fix indentation.
* solib-aix.c: Fix indentation.
* solib-darwin.c: Fix indentation.
* solib-frv.c: Fix indentation.
* solib-svr4.c: Fix indentation.
* solib.c: Fix indentation.
* source.c: Fix indentation.
* sparc-linux-tdep.c: Fix indentation.
* sparc-nbsd-tdep.c: Fix indentation.
* sparc-obsd-tdep.c: Fix indentation.
* sparc-ravenscar-thread.c: Fix indentation.
* sparc-tdep.c: Fix indentation.
* sparc64-linux-tdep.c: Fix indentation.
* sparc64-nbsd-tdep.c: Fix indentation.
* sparc64-obsd-tdep.c: Fix indentation.
* sparc64-tdep.c: Fix indentation.
* stabsread.c: Fix indentation.
* stack.c: Fix indentation.
* stap-probe.c: Fix indentation.
* stubs/ia64vms-stub.c: Fix indentation.
* stubs/m32r-stub.c: Fix indentation.
* stubs/m68k-stub.c: Fix indentation.
* stubs/sh-stub.c: Fix indentation.
* stubs/sparc-stub.c: Fix indentation.
* symfile-mem.c: Fix indentation.
* symfile.c: Fix indentation.
* symfile.h: Fix indentation.
* symmisc.c: Fix indentation.
* symtab.c: Fix indentation.
* symtab.h: Fix indentation.
* target-float.c: Fix indentation.
* target.c: Fix indentation.
* target.h: Fix indentation.
* tic6x-tdep.c: Fix indentation.
* tilegx-linux-tdep.c: Fix indentation.
* tilegx-tdep.c: Fix indentation.
* top.c: Fix indentation.
* tracefile-tfile.c: Fix indentation.
* tracepoint.c: Fix indentation.
* tui/tui-disasm.c: Fix indentation.
* tui/tui-io.c: Fix indentation.
* tui/tui-regs.c: Fix indentation.
* tui/tui-stack.c: Fix indentation.
* tui/tui-win.c: Fix indentation.
* tui/tui-winsource.c: Fix indentation.
* tui/tui.c: Fix indentation.
* typeprint.c: Fix indentation.
* ui-out.h: Fix indentation.
* unittests/copy_bitwise-selftests.c: Fix indentation.
* unittests/memory-map-selftests.c: Fix indentation.
* utils.c: Fix indentation.
* v850-tdep.c: Fix indentation.
* valarith.c: Fix indentation.
* valops.c: Fix indentation.
* valprint.c: Fix indentation.
* valprint.h: Fix indentation.
* value.c: Fix indentation.
* value.h: Fix indentation.
* varobj.c: Fix indentation.
* vax-tdep.c: Fix indentation.
* windows-nat.c: Fix indentation.
* windows-tdep.c: Fix indentation.
* xcoffread.c: Fix indentation.
* xml-syscall.c: Fix indentation.
* xml-tdesc.c: Fix indentation.
* xstormy16-tdep.c: Fix indentation.
* xtensa-config.c: Fix indentation.
* xtensa-linux-nat.c: Fix indentation.
* xtensa-linux-tdep.c: Fix indentation.
* xtensa-tdep.c: Fix indentation.
gdbserver/ChangeLog:
* ax.cc: Fix indentation.
* dll.cc: Fix indentation.
* inferiors.h: Fix indentation.
* linux-low.cc: Fix indentation.
* linux-nios2-low.cc: Fix indentation.
* linux-ppc-ipa.cc: Fix indentation.
* linux-ppc-low.cc: Fix indentation.
* linux-x86-low.cc: Fix indentation.
* linux-xtensa-low.cc: Fix indentation.
* regcache.cc: Fix indentation.
* server.cc: Fix indentation.
* tracepoint.cc: Fix indentation.
gdbsupport/ChangeLog:
* common-exceptions.h: Fix indentation.
* event-loop.cc: Fix indentation.
* fileio.cc: Fix indentation.
* filestuff.cc: Fix indentation.
* gdb-dlfcn.cc: Fix indentation.
* gdb_string_view.h: Fix indentation.
* job-control.cc: Fix indentation.
* signals.cc: Fix indentation.
Change-Id: I4bad7ae6be0fbe14168b8ebafb98ffe14964a695
2020-11-02 23:26:14 +08:00
|
|
|
|
if (toktype == ERROR)
|
2005-03-11 10:24:23 +08:00
|
|
|
|
{
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
yyerror (state, _("invalid number"));
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return ERROR;
|
|
|
|
|
}
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->lexptr = p;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return toktype;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case '+':
|
|
|
|
|
HANDLE_TOKEN2 ("+=", ASSIGN_MODIFY);
|
|
|
|
|
HANDLE_TOKEN2 ("++", INCREMENT);
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->lexptr++;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return c;
|
|
|
|
|
case '*':
|
|
|
|
|
HANDLE_TOKEN2 ("*=", ASSIGN_MODIFY);
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->lexptr++;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return c;
|
|
|
|
|
case '/':
|
|
|
|
|
HANDLE_TOKEN2 ("/=", ASSIGN_MODIFY);
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->lexptr++;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return c;
|
|
|
|
|
case '%':
|
|
|
|
|
HANDLE_TOKEN2 ("%=", ASSIGN_MODIFY);
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->lexptr++;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return c;
|
|
|
|
|
case '|':
|
|
|
|
|
HANDLE_TOKEN2 ("|=", ASSIGN_MODIFY);
|
|
|
|
|
HANDLE_TOKEN2 ("||", OROR);
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->lexptr++;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return c;
|
|
|
|
|
case '&':
|
|
|
|
|
HANDLE_TOKEN2 ("&=", ASSIGN_MODIFY);
|
|
|
|
|
HANDLE_TOKEN2 ("&&", ANDAND);
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->lexptr++;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return c;
|
|
|
|
|
case '^':
|
|
|
|
|
HANDLE_TOKEN2 ("^=", ASSIGN_MODIFY);
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->lexptr++;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return c;
|
|
|
|
|
case '!':
|
|
|
|
|
HANDLE_TOKEN2 ("!=", NOTEQUAL);
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->lexptr++;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return c;
|
|
|
|
|
case '<':
|
|
|
|
|
HANDLE_TOKEN3 ("<<=", ASSIGN_MODIFY);
|
2024-04-21 06:33:37 +08:00
|
|
|
|
HANDLE_TOKEN3 ("<=>", SPACESHIP);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
HANDLE_TOKEN2 ("<=", LEQ);
|
|
|
|
|
HANDLE_TOKEN2 ("<<", LSH);
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->lexptr++;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return c;
|
|
|
|
|
case '>':
|
|
|
|
|
HANDLE_TOKEN3 (">>=", ASSIGN_MODIFY);
|
|
|
|
|
HANDLE_TOKEN2 (">=", GEQ);
|
|
|
|
|
HANDLE_TOKEN2 (">>", RSH);
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->lexptr++;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return c;
|
|
|
|
|
case '=':
|
|
|
|
|
HANDLE_TOKEN2 ("==", EQUAL);
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->lexptr++;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return c;
|
|
|
|
|
case ':':
|
|
|
|
|
HANDLE_TOKEN2 ("::", COLONCOLON);
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->lexptr++;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return c;
|
|
|
|
|
|
|
|
|
|
case '[':
|
|
|
|
|
case ']':
|
|
|
|
|
case '?':
|
|
|
|
|
case '@':
|
|
|
|
|
case '~':
|
|
|
|
|
case '{':
|
|
|
|
|
case '}':
|
|
|
|
|
symbol:
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->lexptr++;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return c;
|
|
|
|
|
|
|
|
|
|
case '"':
|
|
|
|
|
/* These can't occur in C++ names. */
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
yyerror (state, _("unexpected string literal"));
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return ERROR;
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-23 00:35:38 +08:00
|
|
|
|
if (!(c == '_' || c == '$' || c_ident_is_alpha (c)))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
{
|
|
|
|
|
/* We must have come across a bad character (e.g. ';'). */
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
yyerror (state, _("invalid character"));
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return ERROR;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* It's a name. See how long it is. */
|
|
|
|
|
namelen = 0;
|
|
|
|
|
do
|
|
|
|
|
c = tokstart[++namelen];
|
2018-05-23 00:35:38 +08:00
|
|
|
|
while (c_ident_is_alnum (c) || c == '_' || c == '$');
|
2005-03-11 10:24:23 +08:00
|
|
|
|
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->lexptr += namelen;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
|
|
|
|
|
/* Catch specific keywords. Notice that some of the keywords contain
|
|
|
|
|
spaces, and are sorted by the length of the first word. They must
|
|
|
|
|
all include a trailing space in the string comparison. */
|
|
|
|
|
switch (namelen)
|
|
|
|
|
{
|
|
|
|
|
case 16:
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "reinterpret_cast"))
|
gdb, gdbserver, gdbsupport: fix leading space vs tabs issues
Many spots incorrectly use only spaces for indentation (for example,
there are a lot of spots in ada-lang.c). I've always found it awkward
when I needed to edit one of these spots: do I keep the original wrong
indentation, or do I fix it? What if the lines around it are also
wrong, do I fix them too? I probably don't want to fix them in the same
patch, to avoid adding noise to my patch.
So I propose to fix as much as possible once and for all (hopefully).
One typical counter argument for this is that it makes code archeology
more difficult, because git-blame will show this commit as the last
change for these lines. My counter counter argument is: when
git-blaming, you often need to do "blame the file at the parent commit"
anyway, to go past some other refactor that touched the line you are
interested in, but is not the change you are looking for. So you
already need a somewhat efficient way to do this.
Using some interactive tool, rather than plain git-blame, makes this
trivial. For example, I use "tig blame <file>", where going back past
the commit that changed the currently selected line is one keystroke.
It looks like Magit in Emacs does it too (though I've never used it).
Web viewers of Github and Gitlab do it too. My point is that it won't
really make archeology more difficult.
The other typical counter argument is that it will cause conflicts with
existing patches. That's true... but it's a one time cost, and those
are not conflicts that are difficult to resolve. I have also tried "git
rebase --ignore-whitespace", it seems to work well. Although that will
re-introduce the faulty indentation, so one needs to take care of fixing
the indentation in the patch after that (which is easy).
gdb/ChangeLog:
* aarch64-linux-tdep.c: Fix indentation.
* aarch64-ravenscar-thread.c: Fix indentation.
* aarch64-tdep.c: Fix indentation.
* aarch64-tdep.h: Fix indentation.
* ada-lang.c: Fix indentation.
* ada-lang.h: Fix indentation.
* ada-tasks.c: Fix indentation.
* ada-typeprint.c: Fix indentation.
* ada-valprint.c: Fix indentation.
* ada-varobj.c: Fix indentation.
* addrmap.c: Fix indentation.
* addrmap.h: Fix indentation.
* agent.c: Fix indentation.
* aix-thread.c: Fix indentation.
* alpha-bsd-nat.c: Fix indentation.
* alpha-linux-tdep.c: Fix indentation.
* alpha-mdebug-tdep.c: Fix indentation.
* alpha-nbsd-tdep.c: Fix indentation.
* alpha-obsd-tdep.c: Fix indentation.
* alpha-tdep.c: Fix indentation.
* amd64-bsd-nat.c: Fix indentation.
* amd64-darwin-tdep.c: Fix indentation.
* amd64-linux-nat.c: Fix indentation.
* amd64-linux-tdep.c: Fix indentation.
* amd64-nat.c: Fix indentation.
* amd64-obsd-tdep.c: Fix indentation.
* amd64-tdep.c: Fix indentation.
* amd64-windows-tdep.c: Fix indentation.
* annotate.c: Fix indentation.
* arc-tdep.c: Fix indentation.
* arch-utils.c: Fix indentation.
* arch/arm-get-next-pcs.c: Fix indentation.
* arch/arm.c: Fix indentation.
* arm-linux-nat.c: Fix indentation.
* arm-linux-tdep.c: Fix indentation.
* arm-nbsd-tdep.c: Fix indentation.
* arm-pikeos-tdep.c: Fix indentation.
* arm-tdep.c: Fix indentation.
* arm-tdep.h: Fix indentation.
* arm-wince-tdep.c: Fix indentation.
* auto-load.c: Fix indentation.
* auxv.c: Fix indentation.
* avr-tdep.c: Fix indentation.
* ax-gdb.c: Fix indentation.
* ax-general.c: Fix indentation.
* bfin-linux-tdep.c: Fix indentation.
* block.c: Fix indentation.
* block.h: Fix indentation.
* blockframe.c: Fix indentation.
* bpf-tdep.c: Fix indentation.
* break-catch-sig.c: Fix indentation.
* break-catch-syscall.c: Fix indentation.
* break-catch-throw.c: Fix indentation.
* breakpoint.c: Fix indentation.
* breakpoint.h: Fix indentation.
* bsd-uthread.c: Fix indentation.
* btrace.c: Fix indentation.
* build-id.c: Fix indentation.
* buildsym-legacy.h: Fix indentation.
* buildsym.c: Fix indentation.
* c-typeprint.c: Fix indentation.
* c-valprint.c: Fix indentation.
* c-varobj.c: Fix indentation.
* charset.c: Fix indentation.
* cli/cli-cmds.c: Fix indentation.
* cli/cli-decode.c: Fix indentation.
* cli/cli-decode.h: Fix indentation.
* cli/cli-script.c: Fix indentation.
* cli/cli-setshow.c: Fix indentation.
* coff-pe-read.c: Fix indentation.
* coffread.c: Fix indentation.
* compile/compile-cplus-types.c: Fix indentation.
* compile/compile-object-load.c: Fix indentation.
* compile/compile-object-run.c: Fix indentation.
* completer.c: Fix indentation.
* corefile.c: Fix indentation.
* corelow.c: Fix indentation.
* cp-abi.h: Fix indentation.
* cp-namespace.c: Fix indentation.
* cp-support.c: Fix indentation.
* cp-valprint.c: Fix indentation.
* cris-linux-tdep.c: Fix indentation.
* cris-tdep.c: Fix indentation.
* darwin-nat-info.c: Fix indentation.
* darwin-nat.c: Fix indentation.
* darwin-nat.h: Fix indentation.
* dbxread.c: Fix indentation.
* dcache.c: Fix indentation.
* disasm.c: Fix indentation.
* dtrace-probe.c: Fix indentation.
* dwarf2/abbrev.c: Fix indentation.
* dwarf2/attribute.c: Fix indentation.
* dwarf2/expr.c: Fix indentation.
* dwarf2/frame.c: Fix indentation.
* dwarf2/index-cache.c: Fix indentation.
* dwarf2/index-write.c: Fix indentation.
* dwarf2/line-header.c: Fix indentation.
* dwarf2/loc.c: Fix indentation.
* dwarf2/macro.c: Fix indentation.
* dwarf2/read.c: Fix indentation.
* dwarf2/read.h: Fix indentation.
* elfread.c: Fix indentation.
* eval.c: Fix indentation.
* event-top.c: Fix indentation.
* exec.c: Fix indentation.
* exec.h: Fix indentation.
* expprint.c: Fix indentation.
* f-lang.c: Fix indentation.
* f-typeprint.c: Fix indentation.
* f-valprint.c: Fix indentation.
* fbsd-nat.c: Fix indentation.
* fbsd-tdep.c: Fix indentation.
* findvar.c: Fix indentation.
* fork-child.c: Fix indentation.
* frame-unwind.c: Fix indentation.
* frame-unwind.h: Fix indentation.
* frame.c: Fix indentation.
* frv-linux-tdep.c: Fix indentation.
* frv-tdep.c: Fix indentation.
* frv-tdep.h: Fix indentation.
* ft32-tdep.c: Fix indentation.
* gcore.c: Fix indentation.
* gdb_bfd.c: Fix indentation.
* gdbarch.sh: Fix indentation.
* gdbarch.c: Re-generate
* gdbarch.h: Re-generate.
* gdbcore.h: Fix indentation.
* gdbthread.h: Fix indentation.
* gdbtypes.c: Fix indentation.
* gdbtypes.h: Fix indentation.
* glibc-tdep.c: Fix indentation.
* gnu-nat.c: Fix indentation.
* gnu-nat.h: Fix indentation.
* gnu-v2-abi.c: Fix indentation.
* gnu-v3-abi.c: Fix indentation.
* go32-nat.c: Fix indentation.
* guile/guile-internal.h: Fix indentation.
* guile/scm-cmd.c: Fix indentation.
* guile/scm-frame.c: Fix indentation.
* guile/scm-iterator.c: Fix indentation.
* guile/scm-math.c: Fix indentation.
* guile/scm-ports.c: Fix indentation.
* guile/scm-pretty-print.c: Fix indentation.
* guile/scm-value.c: Fix indentation.
* h8300-tdep.c: Fix indentation.
* hppa-linux-nat.c: Fix indentation.
* hppa-linux-tdep.c: Fix indentation.
* hppa-nbsd-nat.c: Fix indentation.
* hppa-nbsd-tdep.c: Fix indentation.
* hppa-obsd-nat.c: Fix indentation.
* hppa-tdep.c: Fix indentation.
* hppa-tdep.h: Fix indentation.
* i386-bsd-nat.c: Fix indentation.
* i386-darwin-nat.c: Fix indentation.
* i386-darwin-tdep.c: Fix indentation.
* i386-dicos-tdep.c: Fix indentation.
* i386-gnu-nat.c: Fix indentation.
* i386-linux-nat.c: Fix indentation.
* i386-linux-tdep.c: Fix indentation.
* i386-nto-tdep.c: Fix indentation.
* i386-obsd-tdep.c: Fix indentation.
* i386-sol2-nat.c: Fix indentation.
* i386-tdep.c: Fix indentation.
* i386-tdep.h: Fix indentation.
* i386-windows-tdep.c: Fix indentation.
* i387-tdep.c: Fix indentation.
* i387-tdep.h: Fix indentation.
* ia64-libunwind-tdep.c: Fix indentation.
* ia64-libunwind-tdep.h: Fix indentation.
* ia64-linux-nat.c: Fix indentation.
* ia64-linux-tdep.c: Fix indentation.
* ia64-tdep.c: Fix indentation.
* ia64-tdep.h: Fix indentation.
* ia64-vms-tdep.c: Fix indentation.
* infcall.c: Fix indentation.
* infcmd.c: Fix indentation.
* inferior.c: Fix indentation.
* infrun.c: Fix indentation.
* iq2000-tdep.c: Fix indentation.
* language.c: Fix indentation.
* linespec.c: Fix indentation.
* linux-fork.c: Fix indentation.
* linux-nat.c: Fix indentation.
* linux-tdep.c: Fix indentation.
* linux-thread-db.c: Fix indentation.
* lm32-tdep.c: Fix indentation.
* m2-lang.c: Fix indentation.
* m2-typeprint.c: Fix indentation.
* m2-valprint.c: Fix indentation.
* m32c-tdep.c: Fix indentation.
* m32r-linux-tdep.c: Fix indentation.
* m32r-tdep.c: Fix indentation.
* m68hc11-tdep.c: Fix indentation.
* m68k-bsd-nat.c: Fix indentation.
* m68k-linux-nat.c: Fix indentation.
* m68k-linux-tdep.c: Fix indentation.
* m68k-tdep.c: Fix indentation.
* machoread.c: Fix indentation.
* macrocmd.c: Fix indentation.
* macroexp.c: Fix indentation.
* macroscope.c: Fix indentation.
* macrotab.c: Fix indentation.
* macrotab.h: Fix indentation.
* main.c: Fix indentation.
* mdebugread.c: Fix indentation.
* mep-tdep.c: Fix indentation.
* mi/mi-cmd-catch.c: Fix indentation.
* mi/mi-cmd-disas.c: Fix indentation.
* mi/mi-cmd-env.c: Fix indentation.
* mi/mi-cmd-stack.c: Fix indentation.
* mi/mi-cmd-var.c: Fix indentation.
* mi/mi-cmds.c: Fix indentation.
* mi/mi-main.c: Fix indentation.
* mi/mi-parse.c: Fix indentation.
* microblaze-tdep.c: Fix indentation.
* minidebug.c: Fix indentation.
* minsyms.c: Fix indentation.
* mips-linux-nat.c: Fix indentation.
* mips-linux-tdep.c: Fix indentation.
* mips-nbsd-tdep.c: Fix indentation.
* mips-tdep.c: Fix indentation.
* mn10300-linux-tdep.c: Fix indentation.
* mn10300-tdep.c: Fix indentation.
* moxie-tdep.c: Fix indentation.
* msp430-tdep.c: Fix indentation.
* namespace.h: Fix indentation.
* nat/fork-inferior.c: Fix indentation.
* nat/gdb_ptrace.h: Fix indentation.
* nat/linux-namespaces.c: Fix indentation.
* nat/linux-osdata.c: Fix indentation.
* nat/netbsd-nat.c: Fix indentation.
* nat/x86-dregs.c: Fix indentation.
* nbsd-nat.c: Fix indentation.
* nbsd-tdep.c: Fix indentation.
* nios2-linux-tdep.c: Fix indentation.
* nios2-tdep.c: Fix indentation.
* nto-procfs.c: Fix indentation.
* nto-tdep.c: Fix indentation.
* objfiles.c: Fix indentation.
* objfiles.h: Fix indentation.
* opencl-lang.c: Fix indentation.
* or1k-tdep.c: Fix indentation.
* osabi.c: Fix indentation.
* osabi.h: Fix indentation.
* osdata.c: Fix indentation.
* p-lang.c: Fix indentation.
* p-typeprint.c: Fix indentation.
* p-valprint.c: Fix indentation.
* parse.c: Fix indentation.
* ppc-linux-nat.c: Fix indentation.
* ppc-linux-tdep.c: Fix indentation.
* ppc-nbsd-nat.c: Fix indentation.
* ppc-nbsd-tdep.c: Fix indentation.
* ppc-obsd-nat.c: Fix indentation.
* ppc-ravenscar-thread.c: Fix indentation.
* ppc-sysv-tdep.c: Fix indentation.
* ppc64-tdep.c: Fix indentation.
* printcmd.c: Fix indentation.
* proc-api.c: Fix indentation.
* producer.c: Fix indentation.
* producer.h: Fix indentation.
* prologue-value.c: Fix indentation.
* prologue-value.h: Fix indentation.
* psymtab.c: Fix indentation.
* python/py-arch.c: Fix indentation.
* python/py-bpevent.c: Fix indentation.
* python/py-event.c: Fix indentation.
* python/py-event.h: Fix indentation.
* python/py-finishbreakpoint.c: Fix indentation.
* python/py-frame.c: Fix indentation.
* python/py-framefilter.c: Fix indentation.
* python/py-inferior.c: Fix indentation.
* python/py-infthread.c: Fix indentation.
* python/py-objfile.c: Fix indentation.
* python/py-prettyprint.c: Fix indentation.
* python/py-registers.c: Fix indentation.
* python/py-signalevent.c: Fix indentation.
* python/py-stopevent.c: Fix indentation.
* python/py-stopevent.h: Fix indentation.
* python/py-threadevent.c: Fix indentation.
* python/py-tui.c: Fix indentation.
* python/py-unwind.c: Fix indentation.
* python/py-value.c: Fix indentation.
* python/py-xmethods.c: Fix indentation.
* python/python-internal.h: Fix indentation.
* python/python.c: Fix indentation.
* ravenscar-thread.c: Fix indentation.
* record-btrace.c: Fix indentation.
* record-full.c: Fix indentation.
* record.c: Fix indentation.
* reggroups.c: Fix indentation.
* regset.h: Fix indentation.
* remote-fileio.c: Fix indentation.
* remote.c: Fix indentation.
* reverse.c: Fix indentation.
* riscv-linux-tdep.c: Fix indentation.
* riscv-ravenscar-thread.c: Fix indentation.
* riscv-tdep.c: Fix indentation.
* rl78-tdep.c: Fix indentation.
* rs6000-aix-tdep.c: Fix indentation.
* rs6000-lynx178-tdep.c: Fix indentation.
* rs6000-nat.c: Fix indentation.
* rs6000-tdep.c: Fix indentation.
* rust-lang.c: Fix indentation.
* rx-tdep.c: Fix indentation.
* s12z-tdep.c: Fix indentation.
* s390-linux-tdep.c: Fix indentation.
* score-tdep.c: Fix indentation.
* ser-base.c: Fix indentation.
* ser-mingw.c: Fix indentation.
* ser-uds.c: Fix indentation.
* ser-unix.c: Fix indentation.
* serial.c: Fix indentation.
* sh-linux-tdep.c: Fix indentation.
* sh-nbsd-tdep.c: Fix indentation.
* sh-tdep.c: Fix indentation.
* skip.c: Fix indentation.
* sol-thread.c: Fix indentation.
* solib-aix.c: Fix indentation.
* solib-darwin.c: Fix indentation.
* solib-frv.c: Fix indentation.
* solib-svr4.c: Fix indentation.
* solib.c: Fix indentation.
* source.c: Fix indentation.
* sparc-linux-tdep.c: Fix indentation.
* sparc-nbsd-tdep.c: Fix indentation.
* sparc-obsd-tdep.c: Fix indentation.
* sparc-ravenscar-thread.c: Fix indentation.
* sparc-tdep.c: Fix indentation.
* sparc64-linux-tdep.c: Fix indentation.
* sparc64-nbsd-tdep.c: Fix indentation.
* sparc64-obsd-tdep.c: Fix indentation.
* sparc64-tdep.c: Fix indentation.
* stabsread.c: Fix indentation.
* stack.c: Fix indentation.
* stap-probe.c: Fix indentation.
* stubs/ia64vms-stub.c: Fix indentation.
* stubs/m32r-stub.c: Fix indentation.
* stubs/m68k-stub.c: Fix indentation.
* stubs/sh-stub.c: Fix indentation.
* stubs/sparc-stub.c: Fix indentation.
* symfile-mem.c: Fix indentation.
* symfile.c: Fix indentation.
* symfile.h: Fix indentation.
* symmisc.c: Fix indentation.
* symtab.c: Fix indentation.
* symtab.h: Fix indentation.
* target-float.c: Fix indentation.
* target.c: Fix indentation.
* target.h: Fix indentation.
* tic6x-tdep.c: Fix indentation.
* tilegx-linux-tdep.c: Fix indentation.
* tilegx-tdep.c: Fix indentation.
* top.c: Fix indentation.
* tracefile-tfile.c: Fix indentation.
* tracepoint.c: Fix indentation.
* tui/tui-disasm.c: Fix indentation.
* tui/tui-io.c: Fix indentation.
* tui/tui-regs.c: Fix indentation.
* tui/tui-stack.c: Fix indentation.
* tui/tui-win.c: Fix indentation.
* tui/tui-winsource.c: Fix indentation.
* tui/tui.c: Fix indentation.
* typeprint.c: Fix indentation.
* ui-out.h: Fix indentation.
* unittests/copy_bitwise-selftests.c: Fix indentation.
* unittests/memory-map-selftests.c: Fix indentation.
* utils.c: Fix indentation.
* v850-tdep.c: Fix indentation.
* valarith.c: Fix indentation.
* valops.c: Fix indentation.
* valprint.c: Fix indentation.
* valprint.h: Fix indentation.
* value.c: Fix indentation.
* value.h: Fix indentation.
* varobj.c: Fix indentation.
* vax-tdep.c: Fix indentation.
* windows-nat.c: Fix indentation.
* windows-tdep.c: Fix indentation.
* xcoffread.c: Fix indentation.
* xml-syscall.c: Fix indentation.
* xml-tdesc.c: Fix indentation.
* xstormy16-tdep.c: Fix indentation.
* xtensa-config.c: Fix indentation.
* xtensa-linux-nat.c: Fix indentation.
* xtensa-linux-tdep.c: Fix indentation.
* xtensa-tdep.c: Fix indentation.
gdbserver/ChangeLog:
* ax.cc: Fix indentation.
* dll.cc: Fix indentation.
* inferiors.h: Fix indentation.
* linux-low.cc: Fix indentation.
* linux-nios2-low.cc: Fix indentation.
* linux-ppc-ipa.cc: Fix indentation.
* linux-ppc-low.cc: Fix indentation.
* linux-x86-low.cc: Fix indentation.
* linux-xtensa-low.cc: Fix indentation.
* regcache.cc: Fix indentation.
* server.cc: Fix indentation.
* tracepoint.cc: Fix indentation.
gdbsupport/ChangeLog:
* common-exceptions.h: Fix indentation.
* event-loop.cc: Fix indentation.
* fileio.cc: Fix indentation.
* filestuff.cc: Fix indentation.
* gdb-dlfcn.cc: Fix indentation.
* gdb_string_view.h: Fix indentation.
* job-control.cc: Fix indentation.
* signals.cc: Fix indentation.
Change-Id: I4bad7ae6be0fbe14168b8ebafb98ffe14964a695
2020-11-02 23:26:14 +08:00
|
|
|
|
return REINTERPRET_CAST;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
break;
|
|
|
|
|
case 12:
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "construction vtable for "))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
{
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->lexptr = tokstart + 24;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return CONSTRUCTION_VTABLE;
|
|
|
|
|
}
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "dynamic_cast"))
|
gdb, gdbserver, gdbsupport: fix leading space vs tabs issues
Many spots incorrectly use only spaces for indentation (for example,
there are a lot of spots in ada-lang.c). I've always found it awkward
when I needed to edit one of these spots: do I keep the original wrong
indentation, or do I fix it? What if the lines around it are also
wrong, do I fix them too? I probably don't want to fix them in the same
patch, to avoid adding noise to my patch.
So I propose to fix as much as possible once and for all (hopefully).
One typical counter argument for this is that it makes code archeology
more difficult, because git-blame will show this commit as the last
change for these lines. My counter counter argument is: when
git-blaming, you often need to do "blame the file at the parent commit"
anyway, to go past some other refactor that touched the line you are
interested in, but is not the change you are looking for. So you
already need a somewhat efficient way to do this.
Using some interactive tool, rather than plain git-blame, makes this
trivial. For example, I use "tig blame <file>", where going back past
the commit that changed the currently selected line is one keystroke.
It looks like Magit in Emacs does it too (though I've never used it).
Web viewers of Github and Gitlab do it too. My point is that it won't
really make archeology more difficult.
The other typical counter argument is that it will cause conflicts with
existing patches. That's true... but it's a one time cost, and those
are not conflicts that are difficult to resolve. I have also tried "git
rebase --ignore-whitespace", it seems to work well. Although that will
re-introduce the faulty indentation, so one needs to take care of fixing
the indentation in the patch after that (which is easy).
gdb/ChangeLog:
* aarch64-linux-tdep.c: Fix indentation.
* aarch64-ravenscar-thread.c: Fix indentation.
* aarch64-tdep.c: Fix indentation.
* aarch64-tdep.h: Fix indentation.
* ada-lang.c: Fix indentation.
* ada-lang.h: Fix indentation.
* ada-tasks.c: Fix indentation.
* ada-typeprint.c: Fix indentation.
* ada-valprint.c: Fix indentation.
* ada-varobj.c: Fix indentation.
* addrmap.c: Fix indentation.
* addrmap.h: Fix indentation.
* agent.c: Fix indentation.
* aix-thread.c: Fix indentation.
* alpha-bsd-nat.c: Fix indentation.
* alpha-linux-tdep.c: Fix indentation.
* alpha-mdebug-tdep.c: Fix indentation.
* alpha-nbsd-tdep.c: Fix indentation.
* alpha-obsd-tdep.c: Fix indentation.
* alpha-tdep.c: Fix indentation.
* amd64-bsd-nat.c: Fix indentation.
* amd64-darwin-tdep.c: Fix indentation.
* amd64-linux-nat.c: Fix indentation.
* amd64-linux-tdep.c: Fix indentation.
* amd64-nat.c: Fix indentation.
* amd64-obsd-tdep.c: Fix indentation.
* amd64-tdep.c: Fix indentation.
* amd64-windows-tdep.c: Fix indentation.
* annotate.c: Fix indentation.
* arc-tdep.c: Fix indentation.
* arch-utils.c: Fix indentation.
* arch/arm-get-next-pcs.c: Fix indentation.
* arch/arm.c: Fix indentation.
* arm-linux-nat.c: Fix indentation.
* arm-linux-tdep.c: Fix indentation.
* arm-nbsd-tdep.c: Fix indentation.
* arm-pikeos-tdep.c: Fix indentation.
* arm-tdep.c: Fix indentation.
* arm-tdep.h: Fix indentation.
* arm-wince-tdep.c: Fix indentation.
* auto-load.c: Fix indentation.
* auxv.c: Fix indentation.
* avr-tdep.c: Fix indentation.
* ax-gdb.c: Fix indentation.
* ax-general.c: Fix indentation.
* bfin-linux-tdep.c: Fix indentation.
* block.c: Fix indentation.
* block.h: Fix indentation.
* blockframe.c: Fix indentation.
* bpf-tdep.c: Fix indentation.
* break-catch-sig.c: Fix indentation.
* break-catch-syscall.c: Fix indentation.
* break-catch-throw.c: Fix indentation.
* breakpoint.c: Fix indentation.
* breakpoint.h: Fix indentation.
* bsd-uthread.c: Fix indentation.
* btrace.c: Fix indentation.
* build-id.c: Fix indentation.
* buildsym-legacy.h: Fix indentation.
* buildsym.c: Fix indentation.
* c-typeprint.c: Fix indentation.
* c-valprint.c: Fix indentation.
* c-varobj.c: Fix indentation.
* charset.c: Fix indentation.
* cli/cli-cmds.c: Fix indentation.
* cli/cli-decode.c: Fix indentation.
* cli/cli-decode.h: Fix indentation.
* cli/cli-script.c: Fix indentation.
* cli/cli-setshow.c: Fix indentation.
* coff-pe-read.c: Fix indentation.
* coffread.c: Fix indentation.
* compile/compile-cplus-types.c: Fix indentation.
* compile/compile-object-load.c: Fix indentation.
* compile/compile-object-run.c: Fix indentation.
* completer.c: Fix indentation.
* corefile.c: Fix indentation.
* corelow.c: Fix indentation.
* cp-abi.h: Fix indentation.
* cp-namespace.c: Fix indentation.
* cp-support.c: Fix indentation.
* cp-valprint.c: Fix indentation.
* cris-linux-tdep.c: Fix indentation.
* cris-tdep.c: Fix indentation.
* darwin-nat-info.c: Fix indentation.
* darwin-nat.c: Fix indentation.
* darwin-nat.h: Fix indentation.
* dbxread.c: Fix indentation.
* dcache.c: Fix indentation.
* disasm.c: Fix indentation.
* dtrace-probe.c: Fix indentation.
* dwarf2/abbrev.c: Fix indentation.
* dwarf2/attribute.c: Fix indentation.
* dwarf2/expr.c: Fix indentation.
* dwarf2/frame.c: Fix indentation.
* dwarf2/index-cache.c: Fix indentation.
* dwarf2/index-write.c: Fix indentation.
* dwarf2/line-header.c: Fix indentation.
* dwarf2/loc.c: Fix indentation.
* dwarf2/macro.c: Fix indentation.
* dwarf2/read.c: Fix indentation.
* dwarf2/read.h: Fix indentation.
* elfread.c: Fix indentation.
* eval.c: Fix indentation.
* event-top.c: Fix indentation.
* exec.c: Fix indentation.
* exec.h: Fix indentation.
* expprint.c: Fix indentation.
* f-lang.c: Fix indentation.
* f-typeprint.c: Fix indentation.
* f-valprint.c: Fix indentation.
* fbsd-nat.c: Fix indentation.
* fbsd-tdep.c: Fix indentation.
* findvar.c: Fix indentation.
* fork-child.c: Fix indentation.
* frame-unwind.c: Fix indentation.
* frame-unwind.h: Fix indentation.
* frame.c: Fix indentation.
* frv-linux-tdep.c: Fix indentation.
* frv-tdep.c: Fix indentation.
* frv-tdep.h: Fix indentation.
* ft32-tdep.c: Fix indentation.
* gcore.c: Fix indentation.
* gdb_bfd.c: Fix indentation.
* gdbarch.sh: Fix indentation.
* gdbarch.c: Re-generate
* gdbarch.h: Re-generate.
* gdbcore.h: Fix indentation.
* gdbthread.h: Fix indentation.
* gdbtypes.c: Fix indentation.
* gdbtypes.h: Fix indentation.
* glibc-tdep.c: Fix indentation.
* gnu-nat.c: Fix indentation.
* gnu-nat.h: Fix indentation.
* gnu-v2-abi.c: Fix indentation.
* gnu-v3-abi.c: Fix indentation.
* go32-nat.c: Fix indentation.
* guile/guile-internal.h: Fix indentation.
* guile/scm-cmd.c: Fix indentation.
* guile/scm-frame.c: Fix indentation.
* guile/scm-iterator.c: Fix indentation.
* guile/scm-math.c: Fix indentation.
* guile/scm-ports.c: Fix indentation.
* guile/scm-pretty-print.c: Fix indentation.
* guile/scm-value.c: Fix indentation.
* h8300-tdep.c: Fix indentation.
* hppa-linux-nat.c: Fix indentation.
* hppa-linux-tdep.c: Fix indentation.
* hppa-nbsd-nat.c: Fix indentation.
* hppa-nbsd-tdep.c: Fix indentation.
* hppa-obsd-nat.c: Fix indentation.
* hppa-tdep.c: Fix indentation.
* hppa-tdep.h: Fix indentation.
* i386-bsd-nat.c: Fix indentation.
* i386-darwin-nat.c: Fix indentation.
* i386-darwin-tdep.c: Fix indentation.
* i386-dicos-tdep.c: Fix indentation.
* i386-gnu-nat.c: Fix indentation.
* i386-linux-nat.c: Fix indentation.
* i386-linux-tdep.c: Fix indentation.
* i386-nto-tdep.c: Fix indentation.
* i386-obsd-tdep.c: Fix indentation.
* i386-sol2-nat.c: Fix indentation.
* i386-tdep.c: Fix indentation.
* i386-tdep.h: Fix indentation.
* i386-windows-tdep.c: Fix indentation.
* i387-tdep.c: Fix indentation.
* i387-tdep.h: Fix indentation.
* ia64-libunwind-tdep.c: Fix indentation.
* ia64-libunwind-tdep.h: Fix indentation.
* ia64-linux-nat.c: Fix indentation.
* ia64-linux-tdep.c: Fix indentation.
* ia64-tdep.c: Fix indentation.
* ia64-tdep.h: Fix indentation.
* ia64-vms-tdep.c: Fix indentation.
* infcall.c: Fix indentation.
* infcmd.c: Fix indentation.
* inferior.c: Fix indentation.
* infrun.c: Fix indentation.
* iq2000-tdep.c: Fix indentation.
* language.c: Fix indentation.
* linespec.c: Fix indentation.
* linux-fork.c: Fix indentation.
* linux-nat.c: Fix indentation.
* linux-tdep.c: Fix indentation.
* linux-thread-db.c: Fix indentation.
* lm32-tdep.c: Fix indentation.
* m2-lang.c: Fix indentation.
* m2-typeprint.c: Fix indentation.
* m2-valprint.c: Fix indentation.
* m32c-tdep.c: Fix indentation.
* m32r-linux-tdep.c: Fix indentation.
* m32r-tdep.c: Fix indentation.
* m68hc11-tdep.c: Fix indentation.
* m68k-bsd-nat.c: Fix indentation.
* m68k-linux-nat.c: Fix indentation.
* m68k-linux-tdep.c: Fix indentation.
* m68k-tdep.c: Fix indentation.
* machoread.c: Fix indentation.
* macrocmd.c: Fix indentation.
* macroexp.c: Fix indentation.
* macroscope.c: Fix indentation.
* macrotab.c: Fix indentation.
* macrotab.h: Fix indentation.
* main.c: Fix indentation.
* mdebugread.c: Fix indentation.
* mep-tdep.c: Fix indentation.
* mi/mi-cmd-catch.c: Fix indentation.
* mi/mi-cmd-disas.c: Fix indentation.
* mi/mi-cmd-env.c: Fix indentation.
* mi/mi-cmd-stack.c: Fix indentation.
* mi/mi-cmd-var.c: Fix indentation.
* mi/mi-cmds.c: Fix indentation.
* mi/mi-main.c: Fix indentation.
* mi/mi-parse.c: Fix indentation.
* microblaze-tdep.c: Fix indentation.
* minidebug.c: Fix indentation.
* minsyms.c: Fix indentation.
* mips-linux-nat.c: Fix indentation.
* mips-linux-tdep.c: Fix indentation.
* mips-nbsd-tdep.c: Fix indentation.
* mips-tdep.c: Fix indentation.
* mn10300-linux-tdep.c: Fix indentation.
* mn10300-tdep.c: Fix indentation.
* moxie-tdep.c: Fix indentation.
* msp430-tdep.c: Fix indentation.
* namespace.h: Fix indentation.
* nat/fork-inferior.c: Fix indentation.
* nat/gdb_ptrace.h: Fix indentation.
* nat/linux-namespaces.c: Fix indentation.
* nat/linux-osdata.c: Fix indentation.
* nat/netbsd-nat.c: Fix indentation.
* nat/x86-dregs.c: Fix indentation.
* nbsd-nat.c: Fix indentation.
* nbsd-tdep.c: Fix indentation.
* nios2-linux-tdep.c: Fix indentation.
* nios2-tdep.c: Fix indentation.
* nto-procfs.c: Fix indentation.
* nto-tdep.c: Fix indentation.
* objfiles.c: Fix indentation.
* objfiles.h: Fix indentation.
* opencl-lang.c: Fix indentation.
* or1k-tdep.c: Fix indentation.
* osabi.c: Fix indentation.
* osabi.h: Fix indentation.
* osdata.c: Fix indentation.
* p-lang.c: Fix indentation.
* p-typeprint.c: Fix indentation.
* p-valprint.c: Fix indentation.
* parse.c: Fix indentation.
* ppc-linux-nat.c: Fix indentation.
* ppc-linux-tdep.c: Fix indentation.
* ppc-nbsd-nat.c: Fix indentation.
* ppc-nbsd-tdep.c: Fix indentation.
* ppc-obsd-nat.c: Fix indentation.
* ppc-ravenscar-thread.c: Fix indentation.
* ppc-sysv-tdep.c: Fix indentation.
* ppc64-tdep.c: Fix indentation.
* printcmd.c: Fix indentation.
* proc-api.c: Fix indentation.
* producer.c: Fix indentation.
* producer.h: Fix indentation.
* prologue-value.c: Fix indentation.
* prologue-value.h: Fix indentation.
* psymtab.c: Fix indentation.
* python/py-arch.c: Fix indentation.
* python/py-bpevent.c: Fix indentation.
* python/py-event.c: Fix indentation.
* python/py-event.h: Fix indentation.
* python/py-finishbreakpoint.c: Fix indentation.
* python/py-frame.c: Fix indentation.
* python/py-framefilter.c: Fix indentation.
* python/py-inferior.c: Fix indentation.
* python/py-infthread.c: Fix indentation.
* python/py-objfile.c: Fix indentation.
* python/py-prettyprint.c: Fix indentation.
* python/py-registers.c: Fix indentation.
* python/py-signalevent.c: Fix indentation.
* python/py-stopevent.c: Fix indentation.
* python/py-stopevent.h: Fix indentation.
* python/py-threadevent.c: Fix indentation.
* python/py-tui.c: Fix indentation.
* python/py-unwind.c: Fix indentation.
* python/py-value.c: Fix indentation.
* python/py-xmethods.c: Fix indentation.
* python/python-internal.h: Fix indentation.
* python/python.c: Fix indentation.
* ravenscar-thread.c: Fix indentation.
* record-btrace.c: Fix indentation.
* record-full.c: Fix indentation.
* record.c: Fix indentation.
* reggroups.c: Fix indentation.
* regset.h: Fix indentation.
* remote-fileio.c: Fix indentation.
* remote.c: Fix indentation.
* reverse.c: Fix indentation.
* riscv-linux-tdep.c: Fix indentation.
* riscv-ravenscar-thread.c: Fix indentation.
* riscv-tdep.c: Fix indentation.
* rl78-tdep.c: Fix indentation.
* rs6000-aix-tdep.c: Fix indentation.
* rs6000-lynx178-tdep.c: Fix indentation.
* rs6000-nat.c: Fix indentation.
* rs6000-tdep.c: Fix indentation.
* rust-lang.c: Fix indentation.
* rx-tdep.c: Fix indentation.
* s12z-tdep.c: Fix indentation.
* s390-linux-tdep.c: Fix indentation.
* score-tdep.c: Fix indentation.
* ser-base.c: Fix indentation.
* ser-mingw.c: Fix indentation.
* ser-uds.c: Fix indentation.
* ser-unix.c: Fix indentation.
* serial.c: Fix indentation.
* sh-linux-tdep.c: Fix indentation.
* sh-nbsd-tdep.c: Fix indentation.
* sh-tdep.c: Fix indentation.
* skip.c: Fix indentation.
* sol-thread.c: Fix indentation.
* solib-aix.c: Fix indentation.
* solib-darwin.c: Fix indentation.
* solib-frv.c: Fix indentation.
* solib-svr4.c: Fix indentation.
* solib.c: Fix indentation.
* source.c: Fix indentation.
* sparc-linux-tdep.c: Fix indentation.
* sparc-nbsd-tdep.c: Fix indentation.
* sparc-obsd-tdep.c: Fix indentation.
* sparc-ravenscar-thread.c: Fix indentation.
* sparc-tdep.c: Fix indentation.
* sparc64-linux-tdep.c: Fix indentation.
* sparc64-nbsd-tdep.c: Fix indentation.
* sparc64-obsd-tdep.c: Fix indentation.
* sparc64-tdep.c: Fix indentation.
* stabsread.c: Fix indentation.
* stack.c: Fix indentation.
* stap-probe.c: Fix indentation.
* stubs/ia64vms-stub.c: Fix indentation.
* stubs/m32r-stub.c: Fix indentation.
* stubs/m68k-stub.c: Fix indentation.
* stubs/sh-stub.c: Fix indentation.
* stubs/sparc-stub.c: Fix indentation.
* symfile-mem.c: Fix indentation.
* symfile.c: Fix indentation.
* symfile.h: Fix indentation.
* symmisc.c: Fix indentation.
* symtab.c: Fix indentation.
* symtab.h: Fix indentation.
* target-float.c: Fix indentation.
* target.c: Fix indentation.
* target.h: Fix indentation.
* tic6x-tdep.c: Fix indentation.
* tilegx-linux-tdep.c: Fix indentation.
* tilegx-tdep.c: Fix indentation.
* top.c: Fix indentation.
* tracefile-tfile.c: Fix indentation.
* tracepoint.c: Fix indentation.
* tui/tui-disasm.c: Fix indentation.
* tui/tui-io.c: Fix indentation.
* tui/tui-regs.c: Fix indentation.
* tui/tui-stack.c: Fix indentation.
* tui/tui-win.c: Fix indentation.
* tui/tui-winsource.c: Fix indentation.
* tui/tui.c: Fix indentation.
* typeprint.c: Fix indentation.
* ui-out.h: Fix indentation.
* unittests/copy_bitwise-selftests.c: Fix indentation.
* unittests/memory-map-selftests.c: Fix indentation.
* utils.c: Fix indentation.
* v850-tdep.c: Fix indentation.
* valarith.c: Fix indentation.
* valops.c: Fix indentation.
* valprint.c: Fix indentation.
* valprint.h: Fix indentation.
* value.c: Fix indentation.
* value.h: Fix indentation.
* varobj.c: Fix indentation.
* vax-tdep.c: Fix indentation.
* windows-nat.c: Fix indentation.
* windows-tdep.c: Fix indentation.
* xcoffread.c: Fix indentation.
* xml-syscall.c: Fix indentation.
* xml-tdesc.c: Fix indentation.
* xstormy16-tdep.c: Fix indentation.
* xtensa-config.c: Fix indentation.
* xtensa-linux-nat.c: Fix indentation.
* xtensa-linux-tdep.c: Fix indentation.
* xtensa-tdep.c: Fix indentation.
gdbserver/ChangeLog:
* ax.cc: Fix indentation.
* dll.cc: Fix indentation.
* inferiors.h: Fix indentation.
* linux-low.cc: Fix indentation.
* linux-nios2-low.cc: Fix indentation.
* linux-ppc-ipa.cc: Fix indentation.
* linux-ppc-low.cc: Fix indentation.
* linux-x86-low.cc: Fix indentation.
* linux-xtensa-low.cc: Fix indentation.
* regcache.cc: Fix indentation.
* server.cc: Fix indentation.
* tracepoint.cc: Fix indentation.
gdbsupport/ChangeLog:
* common-exceptions.h: Fix indentation.
* event-loop.cc: Fix indentation.
* fileio.cc: Fix indentation.
* filestuff.cc: Fix indentation.
* gdb-dlfcn.cc: Fix indentation.
* gdb_string_view.h: Fix indentation.
* job-control.cc: Fix indentation.
* signals.cc: Fix indentation.
Change-Id: I4bad7ae6be0fbe14168b8ebafb98ffe14964a695
2020-11-02 23:26:14 +08:00
|
|
|
|
return DYNAMIC_CAST;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
break;
|
|
|
|
|
case 11:
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "static_cast"))
|
gdb, gdbserver, gdbsupport: fix leading space vs tabs issues
Many spots incorrectly use only spaces for indentation (for example,
there are a lot of spots in ada-lang.c). I've always found it awkward
when I needed to edit one of these spots: do I keep the original wrong
indentation, or do I fix it? What if the lines around it are also
wrong, do I fix them too? I probably don't want to fix them in the same
patch, to avoid adding noise to my patch.
So I propose to fix as much as possible once and for all (hopefully).
One typical counter argument for this is that it makes code archeology
more difficult, because git-blame will show this commit as the last
change for these lines. My counter counter argument is: when
git-blaming, you often need to do "blame the file at the parent commit"
anyway, to go past some other refactor that touched the line you are
interested in, but is not the change you are looking for. So you
already need a somewhat efficient way to do this.
Using some interactive tool, rather than plain git-blame, makes this
trivial. For example, I use "tig blame <file>", where going back past
the commit that changed the currently selected line is one keystroke.
It looks like Magit in Emacs does it too (though I've never used it).
Web viewers of Github and Gitlab do it too. My point is that it won't
really make archeology more difficult.
The other typical counter argument is that it will cause conflicts with
existing patches. That's true... but it's a one time cost, and those
are not conflicts that are difficult to resolve. I have also tried "git
rebase --ignore-whitespace", it seems to work well. Although that will
re-introduce the faulty indentation, so one needs to take care of fixing
the indentation in the patch after that (which is easy).
gdb/ChangeLog:
* aarch64-linux-tdep.c: Fix indentation.
* aarch64-ravenscar-thread.c: Fix indentation.
* aarch64-tdep.c: Fix indentation.
* aarch64-tdep.h: Fix indentation.
* ada-lang.c: Fix indentation.
* ada-lang.h: Fix indentation.
* ada-tasks.c: Fix indentation.
* ada-typeprint.c: Fix indentation.
* ada-valprint.c: Fix indentation.
* ada-varobj.c: Fix indentation.
* addrmap.c: Fix indentation.
* addrmap.h: Fix indentation.
* agent.c: Fix indentation.
* aix-thread.c: Fix indentation.
* alpha-bsd-nat.c: Fix indentation.
* alpha-linux-tdep.c: Fix indentation.
* alpha-mdebug-tdep.c: Fix indentation.
* alpha-nbsd-tdep.c: Fix indentation.
* alpha-obsd-tdep.c: Fix indentation.
* alpha-tdep.c: Fix indentation.
* amd64-bsd-nat.c: Fix indentation.
* amd64-darwin-tdep.c: Fix indentation.
* amd64-linux-nat.c: Fix indentation.
* amd64-linux-tdep.c: Fix indentation.
* amd64-nat.c: Fix indentation.
* amd64-obsd-tdep.c: Fix indentation.
* amd64-tdep.c: Fix indentation.
* amd64-windows-tdep.c: Fix indentation.
* annotate.c: Fix indentation.
* arc-tdep.c: Fix indentation.
* arch-utils.c: Fix indentation.
* arch/arm-get-next-pcs.c: Fix indentation.
* arch/arm.c: Fix indentation.
* arm-linux-nat.c: Fix indentation.
* arm-linux-tdep.c: Fix indentation.
* arm-nbsd-tdep.c: Fix indentation.
* arm-pikeos-tdep.c: Fix indentation.
* arm-tdep.c: Fix indentation.
* arm-tdep.h: Fix indentation.
* arm-wince-tdep.c: Fix indentation.
* auto-load.c: Fix indentation.
* auxv.c: Fix indentation.
* avr-tdep.c: Fix indentation.
* ax-gdb.c: Fix indentation.
* ax-general.c: Fix indentation.
* bfin-linux-tdep.c: Fix indentation.
* block.c: Fix indentation.
* block.h: Fix indentation.
* blockframe.c: Fix indentation.
* bpf-tdep.c: Fix indentation.
* break-catch-sig.c: Fix indentation.
* break-catch-syscall.c: Fix indentation.
* break-catch-throw.c: Fix indentation.
* breakpoint.c: Fix indentation.
* breakpoint.h: Fix indentation.
* bsd-uthread.c: Fix indentation.
* btrace.c: Fix indentation.
* build-id.c: Fix indentation.
* buildsym-legacy.h: Fix indentation.
* buildsym.c: Fix indentation.
* c-typeprint.c: Fix indentation.
* c-valprint.c: Fix indentation.
* c-varobj.c: Fix indentation.
* charset.c: Fix indentation.
* cli/cli-cmds.c: Fix indentation.
* cli/cli-decode.c: Fix indentation.
* cli/cli-decode.h: Fix indentation.
* cli/cli-script.c: Fix indentation.
* cli/cli-setshow.c: Fix indentation.
* coff-pe-read.c: Fix indentation.
* coffread.c: Fix indentation.
* compile/compile-cplus-types.c: Fix indentation.
* compile/compile-object-load.c: Fix indentation.
* compile/compile-object-run.c: Fix indentation.
* completer.c: Fix indentation.
* corefile.c: Fix indentation.
* corelow.c: Fix indentation.
* cp-abi.h: Fix indentation.
* cp-namespace.c: Fix indentation.
* cp-support.c: Fix indentation.
* cp-valprint.c: Fix indentation.
* cris-linux-tdep.c: Fix indentation.
* cris-tdep.c: Fix indentation.
* darwin-nat-info.c: Fix indentation.
* darwin-nat.c: Fix indentation.
* darwin-nat.h: Fix indentation.
* dbxread.c: Fix indentation.
* dcache.c: Fix indentation.
* disasm.c: Fix indentation.
* dtrace-probe.c: Fix indentation.
* dwarf2/abbrev.c: Fix indentation.
* dwarf2/attribute.c: Fix indentation.
* dwarf2/expr.c: Fix indentation.
* dwarf2/frame.c: Fix indentation.
* dwarf2/index-cache.c: Fix indentation.
* dwarf2/index-write.c: Fix indentation.
* dwarf2/line-header.c: Fix indentation.
* dwarf2/loc.c: Fix indentation.
* dwarf2/macro.c: Fix indentation.
* dwarf2/read.c: Fix indentation.
* dwarf2/read.h: Fix indentation.
* elfread.c: Fix indentation.
* eval.c: Fix indentation.
* event-top.c: Fix indentation.
* exec.c: Fix indentation.
* exec.h: Fix indentation.
* expprint.c: Fix indentation.
* f-lang.c: Fix indentation.
* f-typeprint.c: Fix indentation.
* f-valprint.c: Fix indentation.
* fbsd-nat.c: Fix indentation.
* fbsd-tdep.c: Fix indentation.
* findvar.c: Fix indentation.
* fork-child.c: Fix indentation.
* frame-unwind.c: Fix indentation.
* frame-unwind.h: Fix indentation.
* frame.c: Fix indentation.
* frv-linux-tdep.c: Fix indentation.
* frv-tdep.c: Fix indentation.
* frv-tdep.h: Fix indentation.
* ft32-tdep.c: Fix indentation.
* gcore.c: Fix indentation.
* gdb_bfd.c: Fix indentation.
* gdbarch.sh: Fix indentation.
* gdbarch.c: Re-generate
* gdbarch.h: Re-generate.
* gdbcore.h: Fix indentation.
* gdbthread.h: Fix indentation.
* gdbtypes.c: Fix indentation.
* gdbtypes.h: Fix indentation.
* glibc-tdep.c: Fix indentation.
* gnu-nat.c: Fix indentation.
* gnu-nat.h: Fix indentation.
* gnu-v2-abi.c: Fix indentation.
* gnu-v3-abi.c: Fix indentation.
* go32-nat.c: Fix indentation.
* guile/guile-internal.h: Fix indentation.
* guile/scm-cmd.c: Fix indentation.
* guile/scm-frame.c: Fix indentation.
* guile/scm-iterator.c: Fix indentation.
* guile/scm-math.c: Fix indentation.
* guile/scm-ports.c: Fix indentation.
* guile/scm-pretty-print.c: Fix indentation.
* guile/scm-value.c: Fix indentation.
* h8300-tdep.c: Fix indentation.
* hppa-linux-nat.c: Fix indentation.
* hppa-linux-tdep.c: Fix indentation.
* hppa-nbsd-nat.c: Fix indentation.
* hppa-nbsd-tdep.c: Fix indentation.
* hppa-obsd-nat.c: Fix indentation.
* hppa-tdep.c: Fix indentation.
* hppa-tdep.h: Fix indentation.
* i386-bsd-nat.c: Fix indentation.
* i386-darwin-nat.c: Fix indentation.
* i386-darwin-tdep.c: Fix indentation.
* i386-dicos-tdep.c: Fix indentation.
* i386-gnu-nat.c: Fix indentation.
* i386-linux-nat.c: Fix indentation.
* i386-linux-tdep.c: Fix indentation.
* i386-nto-tdep.c: Fix indentation.
* i386-obsd-tdep.c: Fix indentation.
* i386-sol2-nat.c: Fix indentation.
* i386-tdep.c: Fix indentation.
* i386-tdep.h: Fix indentation.
* i386-windows-tdep.c: Fix indentation.
* i387-tdep.c: Fix indentation.
* i387-tdep.h: Fix indentation.
* ia64-libunwind-tdep.c: Fix indentation.
* ia64-libunwind-tdep.h: Fix indentation.
* ia64-linux-nat.c: Fix indentation.
* ia64-linux-tdep.c: Fix indentation.
* ia64-tdep.c: Fix indentation.
* ia64-tdep.h: Fix indentation.
* ia64-vms-tdep.c: Fix indentation.
* infcall.c: Fix indentation.
* infcmd.c: Fix indentation.
* inferior.c: Fix indentation.
* infrun.c: Fix indentation.
* iq2000-tdep.c: Fix indentation.
* language.c: Fix indentation.
* linespec.c: Fix indentation.
* linux-fork.c: Fix indentation.
* linux-nat.c: Fix indentation.
* linux-tdep.c: Fix indentation.
* linux-thread-db.c: Fix indentation.
* lm32-tdep.c: Fix indentation.
* m2-lang.c: Fix indentation.
* m2-typeprint.c: Fix indentation.
* m2-valprint.c: Fix indentation.
* m32c-tdep.c: Fix indentation.
* m32r-linux-tdep.c: Fix indentation.
* m32r-tdep.c: Fix indentation.
* m68hc11-tdep.c: Fix indentation.
* m68k-bsd-nat.c: Fix indentation.
* m68k-linux-nat.c: Fix indentation.
* m68k-linux-tdep.c: Fix indentation.
* m68k-tdep.c: Fix indentation.
* machoread.c: Fix indentation.
* macrocmd.c: Fix indentation.
* macroexp.c: Fix indentation.
* macroscope.c: Fix indentation.
* macrotab.c: Fix indentation.
* macrotab.h: Fix indentation.
* main.c: Fix indentation.
* mdebugread.c: Fix indentation.
* mep-tdep.c: Fix indentation.
* mi/mi-cmd-catch.c: Fix indentation.
* mi/mi-cmd-disas.c: Fix indentation.
* mi/mi-cmd-env.c: Fix indentation.
* mi/mi-cmd-stack.c: Fix indentation.
* mi/mi-cmd-var.c: Fix indentation.
* mi/mi-cmds.c: Fix indentation.
* mi/mi-main.c: Fix indentation.
* mi/mi-parse.c: Fix indentation.
* microblaze-tdep.c: Fix indentation.
* minidebug.c: Fix indentation.
* minsyms.c: Fix indentation.
* mips-linux-nat.c: Fix indentation.
* mips-linux-tdep.c: Fix indentation.
* mips-nbsd-tdep.c: Fix indentation.
* mips-tdep.c: Fix indentation.
* mn10300-linux-tdep.c: Fix indentation.
* mn10300-tdep.c: Fix indentation.
* moxie-tdep.c: Fix indentation.
* msp430-tdep.c: Fix indentation.
* namespace.h: Fix indentation.
* nat/fork-inferior.c: Fix indentation.
* nat/gdb_ptrace.h: Fix indentation.
* nat/linux-namespaces.c: Fix indentation.
* nat/linux-osdata.c: Fix indentation.
* nat/netbsd-nat.c: Fix indentation.
* nat/x86-dregs.c: Fix indentation.
* nbsd-nat.c: Fix indentation.
* nbsd-tdep.c: Fix indentation.
* nios2-linux-tdep.c: Fix indentation.
* nios2-tdep.c: Fix indentation.
* nto-procfs.c: Fix indentation.
* nto-tdep.c: Fix indentation.
* objfiles.c: Fix indentation.
* objfiles.h: Fix indentation.
* opencl-lang.c: Fix indentation.
* or1k-tdep.c: Fix indentation.
* osabi.c: Fix indentation.
* osabi.h: Fix indentation.
* osdata.c: Fix indentation.
* p-lang.c: Fix indentation.
* p-typeprint.c: Fix indentation.
* p-valprint.c: Fix indentation.
* parse.c: Fix indentation.
* ppc-linux-nat.c: Fix indentation.
* ppc-linux-tdep.c: Fix indentation.
* ppc-nbsd-nat.c: Fix indentation.
* ppc-nbsd-tdep.c: Fix indentation.
* ppc-obsd-nat.c: Fix indentation.
* ppc-ravenscar-thread.c: Fix indentation.
* ppc-sysv-tdep.c: Fix indentation.
* ppc64-tdep.c: Fix indentation.
* printcmd.c: Fix indentation.
* proc-api.c: Fix indentation.
* producer.c: Fix indentation.
* producer.h: Fix indentation.
* prologue-value.c: Fix indentation.
* prologue-value.h: Fix indentation.
* psymtab.c: Fix indentation.
* python/py-arch.c: Fix indentation.
* python/py-bpevent.c: Fix indentation.
* python/py-event.c: Fix indentation.
* python/py-event.h: Fix indentation.
* python/py-finishbreakpoint.c: Fix indentation.
* python/py-frame.c: Fix indentation.
* python/py-framefilter.c: Fix indentation.
* python/py-inferior.c: Fix indentation.
* python/py-infthread.c: Fix indentation.
* python/py-objfile.c: Fix indentation.
* python/py-prettyprint.c: Fix indentation.
* python/py-registers.c: Fix indentation.
* python/py-signalevent.c: Fix indentation.
* python/py-stopevent.c: Fix indentation.
* python/py-stopevent.h: Fix indentation.
* python/py-threadevent.c: Fix indentation.
* python/py-tui.c: Fix indentation.
* python/py-unwind.c: Fix indentation.
* python/py-value.c: Fix indentation.
* python/py-xmethods.c: Fix indentation.
* python/python-internal.h: Fix indentation.
* python/python.c: Fix indentation.
* ravenscar-thread.c: Fix indentation.
* record-btrace.c: Fix indentation.
* record-full.c: Fix indentation.
* record.c: Fix indentation.
* reggroups.c: Fix indentation.
* regset.h: Fix indentation.
* remote-fileio.c: Fix indentation.
* remote.c: Fix indentation.
* reverse.c: Fix indentation.
* riscv-linux-tdep.c: Fix indentation.
* riscv-ravenscar-thread.c: Fix indentation.
* riscv-tdep.c: Fix indentation.
* rl78-tdep.c: Fix indentation.
* rs6000-aix-tdep.c: Fix indentation.
* rs6000-lynx178-tdep.c: Fix indentation.
* rs6000-nat.c: Fix indentation.
* rs6000-tdep.c: Fix indentation.
* rust-lang.c: Fix indentation.
* rx-tdep.c: Fix indentation.
* s12z-tdep.c: Fix indentation.
* s390-linux-tdep.c: Fix indentation.
* score-tdep.c: Fix indentation.
* ser-base.c: Fix indentation.
* ser-mingw.c: Fix indentation.
* ser-uds.c: Fix indentation.
* ser-unix.c: Fix indentation.
* serial.c: Fix indentation.
* sh-linux-tdep.c: Fix indentation.
* sh-nbsd-tdep.c: Fix indentation.
* sh-tdep.c: Fix indentation.
* skip.c: Fix indentation.
* sol-thread.c: Fix indentation.
* solib-aix.c: Fix indentation.
* solib-darwin.c: Fix indentation.
* solib-frv.c: Fix indentation.
* solib-svr4.c: Fix indentation.
* solib.c: Fix indentation.
* source.c: Fix indentation.
* sparc-linux-tdep.c: Fix indentation.
* sparc-nbsd-tdep.c: Fix indentation.
* sparc-obsd-tdep.c: Fix indentation.
* sparc-ravenscar-thread.c: Fix indentation.
* sparc-tdep.c: Fix indentation.
* sparc64-linux-tdep.c: Fix indentation.
* sparc64-nbsd-tdep.c: Fix indentation.
* sparc64-obsd-tdep.c: Fix indentation.
* sparc64-tdep.c: Fix indentation.
* stabsread.c: Fix indentation.
* stack.c: Fix indentation.
* stap-probe.c: Fix indentation.
* stubs/ia64vms-stub.c: Fix indentation.
* stubs/m32r-stub.c: Fix indentation.
* stubs/m68k-stub.c: Fix indentation.
* stubs/sh-stub.c: Fix indentation.
* stubs/sparc-stub.c: Fix indentation.
* symfile-mem.c: Fix indentation.
* symfile.c: Fix indentation.
* symfile.h: Fix indentation.
* symmisc.c: Fix indentation.
* symtab.c: Fix indentation.
* symtab.h: Fix indentation.
* target-float.c: Fix indentation.
* target.c: Fix indentation.
* target.h: Fix indentation.
* tic6x-tdep.c: Fix indentation.
* tilegx-linux-tdep.c: Fix indentation.
* tilegx-tdep.c: Fix indentation.
* top.c: Fix indentation.
* tracefile-tfile.c: Fix indentation.
* tracepoint.c: Fix indentation.
* tui/tui-disasm.c: Fix indentation.
* tui/tui-io.c: Fix indentation.
* tui/tui-regs.c: Fix indentation.
* tui/tui-stack.c: Fix indentation.
* tui/tui-win.c: Fix indentation.
* tui/tui-winsource.c: Fix indentation.
* tui/tui.c: Fix indentation.
* typeprint.c: Fix indentation.
* ui-out.h: Fix indentation.
* unittests/copy_bitwise-selftests.c: Fix indentation.
* unittests/memory-map-selftests.c: Fix indentation.
* utils.c: Fix indentation.
* v850-tdep.c: Fix indentation.
* valarith.c: Fix indentation.
* valops.c: Fix indentation.
* valprint.c: Fix indentation.
* valprint.h: Fix indentation.
* value.c: Fix indentation.
* value.h: Fix indentation.
* varobj.c: Fix indentation.
* vax-tdep.c: Fix indentation.
* windows-nat.c: Fix indentation.
* windows-tdep.c: Fix indentation.
* xcoffread.c: Fix indentation.
* xml-syscall.c: Fix indentation.
* xml-tdesc.c: Fix indentation.
* xstormy16-tdep.c: Fix indentation.
* xtensa-config.c: Fix indentation.
* xtensa-linux-nat.c: Fix indentation.
* xtensa-linux-tdep.c: Fix indentation.
* xtensa-tdep.c: Fix indentation.
gdbserver/ChangeLog:
* ax.cc: Fix indentation.
* dll.cc: Fix indentation.
* inferiors.h: Fix indentation.
* linux-low.cc: Fix indentation.
* linux-nios2-low.cc: Fix indentation.
* linux-ppc-ipa.cc: Fix indentation.
* linux-ppc-low.cc: Fix indentation.
* linux-x86-low.cc: Fix indentation.
* linux-xtensa-low.cc: Fix indentation.
* regcache.cc: Fix indentation.
* server.cc: Fix indentation.
* tracepoint.cc: Fix indentation.
gdbsupport/ChangeLog:
* common-exceptions.h: Fix indentation.
* event-loop.cc: Fix indentation.
* fileio.cc: Fix indentation.
* filestuff.cc: Fix indentation.
* gdb-dlfcn.cc: Fix indentation.
* gdb_string_view.h: Fix indentation.
* job-control.cc: Fix indentation.
* signals.cc: Fix indentation.
Change-Id: I4bad7ae6be0fbe14168b8ebafb98ffe14964a695
2020-11-02 23:26:14 +08:00
|
|
|
|
return STATIC_CAST;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
break;
|
|
|
|
|
case 9:
|
|
|
|
|
HANDLE_SPECIAL ("covariant return thunk to ", DEMANGLE_COMPONENT_COVARIANT_THUNK);
|
|
|
|
|
HANDLE_SPECIAL ("reference temporary for ", DEMANGLE_COMPONENT_REFTEMP);
|
|
|
|
|
break;
|
|
|
|
|
case 8:
|
|
|
|
|
HANDLE_SPECIAL ("typeinfo for ", DEMANGLE_COMPONENT_TYPEINFO);
|
|
|
|
|
HANDLE_SPECIAL ("typeinfo fn for ", DEMANGLE_COMPONENT_TYPEINFO_FN);
|
|
|
|
|
HANDLE_SPECIAL ("typeinfo name for ", DEMANGLE_COMPONENT_TYPEINFO_NAME);
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "operator"))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return OPERATOR;
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "restrict"))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return RESTRICT;
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "unsigned"))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return UNSIGNED;
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "template"))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return TEMPLATE;
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "volatile"))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return VOLATILE_KEYWORD;
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
|
|
|
|
HANDLE_SPECIAL ("virtual thunk to ", DEMANGLE_COMPONENT_VIRTUAL_THUNK);
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "wchar_t"))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return WCHAR_T;
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "global constructors keyed to "))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
{
|
|
|
|
|
const char *p;
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->lexptr = tokstart + 29;
|
|
|
|
|
lvalp->lval = DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
/* Find the end of the symbol. */
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
p = symbol_end (state->lexptr);
|
2018-06-02 01:50:01 +08:00
|
|
|
|
lvalp->comp = state->make_name (state->lexptr, p - state->lexptr);
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->lexptr = p;
|
2009-07-30 02:44:28 +08:00
|
|
|
|
return DEMANGLER_SPECIAL;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
}
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "global destructors keyed to "))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
{
|
|
|
|
|
const char *p;
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->lexptr = tokstart + 28;
|
|
|
|
|
lvalp->lval = DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
/* Find the end of the symbol. */
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
p = symbol_end (state->lexptr);
|
2018-06-02 01:50:01 +08:00
|
|
|
|
lvalp->comp = state->make_name (state->lexptr, p - state->lexptr);
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->lexptr = p;
|
2009-07-30 02:44:28 +08:00
|
|
|
|
return DEMANGLER_SPECIAL;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HANDLE_SPECIAL ("vtable for ", DEMANGLE_COMPONENT_VTABLE);
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "delete"))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return DELETE;
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "struct"))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return STRUCT;
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "signed"))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return SIGNED_KEYWORD;
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "sizeof"))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return SIZEOF;
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "double"))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return DOUBLE_KEYWORD;
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
HANDLE_SPECIAL ("guard variable for ", DEMANGLE_COMPONENT_GUARD);
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "false"))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return FALSEKEYWORD;
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "class"))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return CLASS;
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "union"))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return UNION;
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "float"))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return FLOAT_KEYWORD;
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "short"))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return SHORT;
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "const"))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return CONST_KEYWORD;
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "void"))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return VOID;
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "bool"))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return BOOL;
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "char"))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return CHAR;
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "enum"))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return ENUM;
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "long"))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return LONG;
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "true"))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return TRUEKEYWORD;
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
HANDLE_SPECIAL ("VTT for ", DEMANGLE_COMPONENT_VTT);
|
|
|
|
|
HANDLE_SPECIAL ("non-virtual thunk to ", DEMANGLE_COMPONENT_THUNK);
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "new"))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return NEW;
|
2021-03-23 17:02:04 +08:00
|
|
|
|
if (startswith (tokstart, "int"))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return INT_KEYWORD;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-02 01:50:01 +08:00
|
|
|
|
lvalp->comp = state->make_name (tokstart, namelen);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return NAME;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
yyerror (cpname_state *state, const char *msg)
|
2005-03-11 10:24:23 +08:00
|
|
|
|
{
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
if (state->global_errmsg)
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return;
|
|
|
|
|
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
state->error_lexptr = state->prev_lexptr;
|
|
|
|
|
state->global_errmsg = msg ? msg : "parse error";
|
2005-03-11 10:24:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
Fix "b f(std::string)", always use DMGL_VERBOSE
Currently, on any remotely modern GNU/Linux system,
gdb.cp/no-dmgl-verbose.exp fails like so:
break 'f(std::string)'
Function "f(std::string)" not defined.
(gdb) FAIL: gdb.cp/no-dmgl-verbose.exp: gdb_breakpoint: set breakpoint at 'f(std::string)'
break 'f(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
Function "f(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)" not defined.
(gdb) PASS: gdb.cp/no-dmgl-verbose.exp: DMGL_VERBOSE-demangled f(std::string) is not defined
This testcase was added back in 2011, here:
[patch] Remove DMGL_VERBOSE
https://sourceware.org/pipermail/gdb-patches/2011-June/083081.html
Back then, the testcase would pass cleanly. It turns out that the
reason it fails today is that the testcase is exercising something in
GDB that only makes sense if the program is built for the pre-C++11
libstc++ ABI. Back then the C++11 ABI didn't exist yet, but nowadays,
you need to compile with -D_GLIBCXX_USE_CXX11_ABI=0 to use the old
ABI. See "Dual ABI" in the libstdc++ manual, at
<https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html>.
If we tweak the gdb.cp/no-dmgl-verbose.exp testcase to force the old
ABI with -D_GLIBCXX_USE_CXX11_ABI=0, then it passes cleanly.
So why is it that setting a breakpoint at "f(std::string)" fails with
modern ABI, but passes with old ABI?
This is where libiberty demangler's DMGL_VERBOSE option comes in. The
Itanium ABI mangling scheme has a shorthand form for std::string (and
some other types). See
<https://itanium-cxx-abi.github.io/cxx-abi/abi.html>:
"In addition, the following catalog of abbreviations of the form "Sx" are used:
<substitution> ::= St # ::std::
<substitution> ::= Sa # ::std::allocator
<substitution> ::= Sb # ::std::basic_string
<substitution> ::= Ss # ::std::basic_string < char,
::std::char_traits<char>,
::std::allocator<char> >
<substitution> ::= Si # ::std::basic_istream<char, std::char_traits<char> >
<substitution> ::= So # ::std::basic_ostream<char, std::char_traits<char> >
<substitution> ::= Sd # ::std::basic_iostream<char, std::char_traits<char> >
"
When the libiberty demangler encounters such a abbreviation, by
default, it expands it to the user-friendly typedef "std::string",
"std::iostream", etc.. If OTOH DMGL_VERBOSE is specified, the
abbreviation is expanded to the underlying, non-typedefed fullname
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >"
etc. as documented in the Itanium ABI, and pasted above. You can see
the standard abbreviations/substitutions in
libiberty/cp-demangle.c:standard_subs.
Back before Jan's patch in 2011, there were parts of GDB that used
DMGL_VERBOSE, and others that did not, leading to mismatches. The
solution back then was to stop using DMGL_VERBOSE throughout.
GDB has code in place to let users set a breakpoint at a function with
typedefs in its parameters, like "b f(uint32_t)". Demangled function
names as they appear in the symbol tables almost (more on this is in a
bit) never have typedefs in them, so when processing "b f(uint32_t)"
GDB first replaces "uint32_t" for its underlying type, and then sets a
breakpoint on the resulting prototype, in this case "f(unsigned int)".
Now, if DMGL_VERBOSE is _not_ used, then the demangler demangles the
mangled name of a function such as "void f(std::string)" that was
mangled using the standard abbreviations mentioned above really as:
"void f(std::string)".
For example, the mangled name of "void f(std::string)" if you compile
with old pre-C++11 ABI is "_Z1fSs". That uses the abbreviation "Ss",
so if you demangle that without DMGL_VERBOSE, you get:
$ echo "_Z1fSs" | c++filt --no-verbose
f(std::string)
while with DMGL_VERBOSE you'd get:
$ echo "_Z1fSs" | c++filt
f(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)
If, when the user sets a breakpoint at "f(std::string)", GDB would
replace the std::string typedef for its underlying type using the same
mechanism I mentioned for the "f(uint32_t)" example above, then GDB
would really try to set a breakpoint at "f(std::basic_string<char,
std::char_traits<char>, std::allocator<char> >)", and that would fail,
as the function symbol GDB knows about for that function, given no
DMGL_VERBOSE, is "f(std::string)".
For this reason, the code that expands typedefs in function parameter
names has an exception for std::string (and other standard
abbreviation types), such that "std::string" is never
typedef-expanded.
And here lies the problem when you try to do "b f(std::string)" with a
program compiled with the C++11 ABI. In that case, std::string
expands to a different underlying type, like so:
f(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)
and this symbol naturally mangles differently, as:
_Z1fNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
and then because this doesn't use the shorthand mangling abbreviation
for "std::string" anymore, it always demangles as:
f(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)
Now, when using the C++11 ABI, and you set a breakpoint at
"f(std::string)", GDB's typedefs-in-parameters expansion code hits the
exception for "std::string" and doesn't expand it, so the breakpoint
fails to be inserted, because the symbol that exists is really the
f(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)
one, not "f(std::string)".
So to fix things for C++11 ABI, clearly we need to remove the
"std::string" exception from the typedef-in-parameters expansion
logic. If we do just that, then "b f(std::string)" starts working
with the C++11 ABI.
However, if we do _just_ that, and nothing else, then we break
pre-C++11 ABI...
The solution is then to in addition switch GDB to always use
DMGL_VERBOSE. If we do this, then pre-C++11 ABI symbols works the
same as C++11 ABI symbols overall -- the demangler expands the
standard abbreviation for "std::string" as "std::basic_string<char,
std::char_traits<char>, std::allocator<char> >" and letting GDB expand
the "std::string" typedef (etc.) too is no longer a problem.
To avoid getting in the situation where some parts of GDB use
DMGL_VERBOSE and others not, this patch adds wrappers around the
demangler's entry points that GDB uses, and makes those force
DMGL_VERBOSE.
The point of the gdb.cp/no-dmgl-verbose.exp testcase was to try to
ensure that DMGL_VERBOSE doesn't creep back in:
gdb_test {break 'f(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'} \
{Function ".*" not defined\.} \
"DMGL_VERBOSE-demangled f(std::string) is not defined"
This obviously no longer makes sense to have, since we now depend on
DMGL_VERBOSE. So the patch replaces gdb.cp/no-dmgl-verbose.exp with a
new gdb.cp/break-f-std-string.exp testcase whose purpose is to make
sure that setting a breakpoint at "f(std::string)" works. It
exercises both pre-C++11 ABI and C++11 ABI.
Change-Id: Ib54fab4cf0fd307bfd55bf1dd5056830096a653b
2022-04-30 06:21:18 +08:00
|
|
|
|
/* See cp-support.h. */
|
2005-03-11 10:24:23 +08:00
|
|
|
|
|
2017-08-09 22:04:32 +08:00
|
|
|
|
gdb::unique_xmalloc_ptr<char>
|
2005-03-11 10:24:23 +08:00
|
|
|
|
cp_comp_to_string (struct demangle_component *result, int estimated_len)
|
|
|
|
|
{
|
2009-07-30 02:44:28 +08:00
|
|
|
|
size_t err;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
|
Fix "b f(std::string)", always use DMGL_VERBOSE
Currently, on any remotely modern GNU/Linux system,
gdb.cp/no-dmgl-verbose.exp fails like so:
break 'f(std::string)'
Function "f(std::string)" not defined.
(gdb) FAIL: gdb.cp/no-dmgl-verbose.exp: gdb_breakpoint: set breakpoint at 'f(std::string)'
break 'f(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
Function "f(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)" not defined.
(gdb) PASS: gdb.cp/no-dmgl-verbose.exp: DMGL_VERBOSE-demangled f(std::string) is not defined
This testcase was added back in 2011, here:
[patch] Remove DMGL_VERBOSE
https://sourceware.org/pipermail/gdb-patches/2011-June/083081.html
Back then, the testcase would pass cleanly. It turns out that the
reason it fails today is that the testcase is exercising something in
GDB that only makes sense if the program is built for the pre-C++11
libstc++ ABI. Back then the C++11 ABI didn't exist yet, but nowadays,
you need to compile with -D_GLIBCXX_USE_CXX11_ABI=0 to use the old
ABI. See "Dual ABI" in the libstdc++ manual, at
<https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html>.
If we tweak the gdb.cp/no-dmgl-verbose.exp testcase to force the old
ABI with -D_GLIBCXX_USE_CXX11_ABI=0, then it passes cleanly.
So why is it that setting a breakpoint at "f(std::string)" fails with
modern ABI, but passes with old ABI?
This is where libiberty demangler's DMGL_VERBOSE option comes in. The
Itanium ABI mangling scheme has a shorthand form for std::string (and
some other types). See
<https://itanium-cxx-abi.github.io/cxx-abi/abi.html>:
"In addition, the following catalog of abbreviations of the form "Sx" are used:
<substitution> ::= St # ::std::
<substitution> ::= Sa # ::std::allocator
<substitution> ::= Sb # ::std::basic_string
<substitution> ::= Ss # ::std::basic_string < char,
::std::char_traits<char>,
::std::allocator<char> >
<substitution> ::= Si # ::std::basic_istream<char, std::char_traits<char> >
<substitution> ::= So # ::std::basic_ostream<char, std::char_traits<char> >
<substitution> ::= Sd # ::std::basic_iostream<char, std::char_traits<char> >
"
When the libiberty demangler encounters such a abbreviation, by
default, it expands it to the user-friendly typedef "std::string",
"std::iostream", etc.. If OTOH DMGL_VERBOSE is specified, the
abbreviation is expanded to the underlying, non-typedefed fullname
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >"
etc. as documented in the Itanium ABI, and pasted above. You can see
the standard abbreviations/substitutions in
libiberty/cp-demangle.c:standard_subs.
Back before Jan's patch in 2011, there were parts of GDB that used
DMGL_VERBOSE, and others that did not, leading to mismatches. The
solution back then was to stop using DMGL_VERBOSE throughout.
GDB has code in place to let users set a breakpoint at a function with
typedefs in its parameters, like "b f(uint32_t)". Demangled function
names as they appear in the symbol tables almost (more on this is in a
bit) never have typedefs in them, so when processing "b f(uint32_t)"
GDB first replaces "uint32_t" for its underlying type, and then sets a
breakpoint on the resulting prototype, in this case "f(unsigned int)".
Now, if DMGL_VERBOSE is _not_ used, then the demangler demangles the
mangled name of a function such as "void f(std::string)" that was
mangled using the standard abbreviations mentioned above really as:
"void f(std::string)".
For example, the mangled name of "void f(std::string)" if you compile
with old pre-C++11 ABI is "_Z1fSs". That uses the abbreviation "Ss",
so if you demangle that without DMGL_VERBOSE, you get:
$ echo "_Z1fSs" | c++filt --no-verbose
f(std::string)
while with DMGL_VERBOSE you'd get:
$ echo "_Z1fSs" | c++filt
f(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)
If, when the user sets a breakpoint at "f(std::string)", GDB would
replace the std::string typedef for its underlying type using the same
mechanism I mentioned for the "f(uint32_t)" example above, then GDB
would really try to set a breakpoint at "f(std::basic_string<char,
std::char_traits<char>, std::allocator<char> >)", and that would fail,
as the function symbol GDB knows about for that function, given no
DMGL_VERBOSE, is "f(std::string)".
For this reason, the code that expands typedefs in function parameter
names has an exception for std::string (and other standard
abbreviation types), such that "std::string" is never
typedef-expanded.
And here lies the problem when you try to do "b f(std::string)" with a
program compiled with the C++11 ABI. In that case, std::string
expands to a different underlying type, like so:
f(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)
and this symbol naturally mangles differently, as:
_Z1fNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
and then because this doesn't use the shorthand mangling abbreviation
for "std::string" anymore, it always demangles as:
f(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)
Now, when using the C++11 ABI, and you set a breakpoint at
"f(std::string)", GDB's typedefs-in-parameters expansion code hits the
exception for "std::string" and doesn't expand it, so the breakpoint
fails to be inserted, because the symbol that exists is really the
f(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)
one, not "f(std::string)".
So to fix things for C++11 ABI, clearly we need to remove the
"std::string" exception from the typedef-in-parameters expansion
logic. If we do just that, then "b f(std::string)" starts working
with the C++11 ABI.
However, if we do _just_ that, and nothing else, then we break
pre-C++11 ABI...
The solution is then to in addition switch GDB to always use
DMGL_VERBOSE. If we do this, then pre-C++11 ABI symbols works the
same as C++11 ABI symbols overall -- the demangler expands the
standard abbreviation for "std::string" as "std::basic_string<char,
std::char_traits<char>, std::allocator<char> >" and letting GDB expand
the "std::string" typedef (etc.) too is no longer a problem.
To avoid getting in the situation where some parts of GDB use
DMGL_VERBOSE and others not, this patch adds wrappers around the
demangler's entry points that GDB uses, and makes those force
DMGL_VERBOSE.
The point of the gdb.cp/no-dmgl-verbose.exp testcase was to try to
ensure that DMGL_VERBOSE doesn't creep back in:
gdb_test {break 'f(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'} \
{Function ".*" not defined\.} \
"DMGL_VERBOSE-demangled f(std::string) is not defined"
This obviously no longer makes sense to have, since we now depend on
DMGL_VERBOSE. So the patch replaces gdb.cp/no-dmgl-verbose.exp with a
new gdb.cp/break-f-std-string.exp testcase whose purpose is to make
sure that setting a breakpoint at "f(std::string)" works. It
exercises both pre-C++11 ABI and C++11 ABI.
Change-Id: Ib54fab4cf0fd307bfd55bf1dd5056830096a653b
2022-04-30 06:21:18 +08:00
|
|
|
|
char *res = gdb_cplus_demangle_print (DMGL_PARAMS | DMGL_ANSI,
|
|
|
|
|
result, estimated_len, &err);
|
2017-08-09 22:04:32 +08:00
|
|
|
|
return gdb::unique_xmalloc_ptr<char> (res);
|
2005-03-11 10:24:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
2011-08-19 00:17:39 +08:00
|
|
|
|
/* Merge the two parse trees given by DEST and SRC. The parse tree
|
|
|
|
|
in SRC is attached to DEST at the node represented by TARGET.
|
|
|
|
|
|
|
|
|
|
NOTE 1: Since there is no API to merge obstacks, this function does
|
|
|
|
|
even attempt to try it. Fortunately, we do not (yet?) need this ability.
|
|
|
|
|
The code will assert if SRC->obstack is not empty.
|
|
|
|
|
|
|
|
|
|
NOTE 2: The string from which SRC was parsed must not be freed, since
|
|
|
|
|
this function will place pointers to that string into DEST. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cp_merge_demangle_parse_infos (struct demangle_parse_info *dest,
|
|
|
|
|
struct demangle_component *target,
|
2024-04-12 00:35:09 +08:00
|
|
|
|
std::unique_ptr<demangle_parse_info> src)
|
2011-08-19 00:17:39 +08:00
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
/* Copy the SRC's parse data into DEST. */
|
|
|
|
|
*target = *src->tree;
|
2024-04-12 00:35:09 +08:00
|
|
|
|
|
|
|
|
|
/* Make sure SRC is owned by DEST. */
|
|
|
|
|
dest->infos.push_back (std::move (src));
|
2011-08-19 00:17:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
2007-10-22 22:37:36 +08:00
|
|
|
|
/* Convert a demangled name to a demangle_component tree. On success,
|
2017-03-14 08:11:09 +08:00
|
|
|
|
a structure containing the root of the new tree is returned. On
|
|
|
|
|
error, NULL is returned, and an error message will be set in
|
2018-05-24 11:05:52 +08:00
|
|
|
|
*ERRMSG. */
|
2005-03-11 10:24:23 +08:00
|
|
|
|
|
2016-11-29 12:39:47 +08:00
|
|
|
|
struct std::unique_ptr<demangle_parse_info>
|
2018-05-24 11:05:52 +08:00
|
|
|
|
cp_demangled_name_to_comp (const char *demangled_name,
|
|
|
|
|
std::string *errmsg)
|
2005-03-11 10:24:23 +08:00
|
|
|
|
{
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
cpname_state state;
|
|
|
|
|
|
|
|
|
|
state.prev_lexptr = state.lexptr = demangled_name;
|
|
|
|
|
state.error_lexptr = NULL;
|
|
|
|
|
state.global_errmsg = NULL;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
|
2023-09-14 19:13:24 +08:00
|
|
|
|
auto result = std::make_unique<demangle_parse_info> ();
|
2024-04-12 00:35:09 +08:00
|
|
|
|
state.demangle_info = result.get ();
|
2005-03-11 10:24:23 +08:00
|
|
|
|
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
if (yyparse (&state))
|
2005-03-11 10:24:23 +08:00
|
|
|
|
{
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
if (state.global_errmsg && errmsg)
|
|
|
|
|
*errmsg = state.global_errmsg;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
2018-05-24 11:46:59 +08:00
|
|
|
|
result->tree = state.global_result;
|
2005-03-11 10:24:23 +08:00
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
2024-04-11 06:49:51 +08:00
|
|
|
|
|
|
|
|
|
#if GDB_SELF_TEST
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
should_be_the_same (const char *one, const char *two)
|
|
|
|
|
{
|
|
|
|
|
gdb::unique_xmalloc_ptr<char> cpone = cp_canonicalize_string (one);
|
|
|
|
|
gdb::unique_xmalloc_ptr<char> cptwo = cp_canonicalize_string (two);
|
|
|
|
|
|
|
|
|
|
if (cpone != nullptr)
|
|
|
|
|
one = cpone.get ();
|
|
|
|
|
if (cptwo != nullptr)
|
|
|
|
|
two = cptwo.get ();
|
|
|
|
|
|
|
|
|
|
SELF_CHECK (strcmp (one, two) == 0);
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-21 06:33:37 +08:00
|
|
|
|
static void
|
|
|
|
|
should_parse (const char *name)
|
|
|
|
|
{
|
|
|
|
|
std::string err;
|
|
|
|
|
auto parsed = cp_demangled_name_to_comp (name, &err);
|
|
|
|
|
SELF_CHECK (parsed != nullptr);
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-11 06:49:51 +08:00
|
|
|
|
static void
|
|
|
|
|
canonicalize_tests ()
|
|
|
|
|
{
|
|
|
|
|
should_be_the_same ("short int", "short");
|
|
|
|
|
should_be_the_same ("int short", "short");
|
|
|
|
|
|
|
|
|
|
should_be_the_same ("C<(char) 1>::m()", "C<(char) '\\001'>::m()");
|
2024-04-12 02:43:06 +08:00
|
|
|
|
should_be_the_same ("x::y::z<1>", "x::y::z<0x01>");
|
|
|
|
|
should_be_the_same ("x::y::z<1>", "x::y::z<01>");
|
|
|
|
|
should_be_the_same ("x::y::z<(unsigned long long) 1>", "x::y::z<01ull>");
|
|
|
|
|
should_be_the_same ("x::y::z<0b111>", "x::y::z<7>");
|
|
|
|
|
should_be_the_same ("x::y::z<0b111>", "x::y::z<0t7>");
|
|
|
|
|
should_be_the_same ("x::y::z<0b111>", "x::y::z<0D7>");
|
2024-04-20 10:22:11 +08:00
|
|
|
|
|
|
|
|
|
should_be_the_same ("x::y::z<0xff'ff>", "x::y::z<65535>");
|
2024-04-21 00:44:13 +08:00
|
|
|
|
|
|
|
|
|
should_be_the_same ("something<void ()>", "something< void() >");
|
|
|
|
|
should_be_the_same ("something<void ()>", "something<void (void)>");
|
2024-04-21 06:33:37 +08:00
|
|
|
|
|
|
|
|
|
should_parse ("void whatever::operator<=><int, int>");
|
2024-04-11 06:49:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
void _initialize_cp_name_parser ();
|
|
|
|
|
void
|
|
|
|
|
_initialize_cp_name_parser ()
|
|
|
|
|
{
|
|
|
|
|
#if GDB_SELF_TEST
|
|
|
|
|
selftests::register_test ("canonicalize", canonicalize_tests);
|
|
|
|
|
#endif
|
|
|
|
|
}
|