Use startswith in gdb subfolder.
gdb/ChangeLog: * cp-name-parser.y: Use startswith instead of strncmp. * m2-exp.y: Likewise. * macroexp.c (substitute_args): Likewise. * mi/mi-main.c (command_notifies_uscc_observer): Likewise. * rust-exp.y: Likewise.
This commit is contained in:
parent
af82f89db0
commit
733f5eea6b
@ -1,3 +1,11 @@
|
|||||||
|
2021-04-01 Martin Liska <mliska@suse.cz>
|
||||||
|
|
||||||
|
* cp-name-parser.y: Use startswith instead of strncmp.
|
||||||
|
* m2-exp.y: Likewise.
|
||||||
|
* macroexp.c (substitute_args): Likewise.
|
||||||
|
* mi/mi-main.c (command_notifies_uscc_observer): Likewise.
|
||||||
|
* rust-exp.y: Likewise.
|
||||||
|
|
||||||
2021-03-31 Tom Tromey <tom@tromey.com>
|
2021-03-31 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
* dwarf2/read.c (dwarf2_gdb_index::map_matching_symbols): Merge
|
* dwarf2/read.c (dwarf2_gdb_index::map_matching_symbols): Merge
|
||||||
|
@ -1511,7 +1511,7 @@ cp_parse_escape (const char **string_ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define HANDLE_SPECIAL(string, comp) \
|
#define HANDLE_SPECIAL(string, comp) \
|
||||||
if (strncmp (tokstart, string, sizeof (string) - 1) == 0) \
|
if (startswith (tokstart, string)) \
|
||||||
{ \
|
{ \
|
||||||
state->lexptr = tokstart + sizeof (string) - 1; \
|
state->lexptr = tokstart + sizeof (string) - 1; \
|
||||||
lvalp->lval = comp; \
|
lvalp->lval = comp; \
|
||||||
@ -1592,7 +1592,7 @@ yylex (YYSTYPE *lvalp, cpname_state *state)
|
|||||||
return INT;
|
return INT;
|
||||||
|
|
||||||
case '(':
|
case '(':
|
||||||
if (strncmp (tokstart, "(anonymous namespace)", 21) == 0)
|
if (startswith (tokstart, "(anonymous namespace)"))
|
||||||
{
|
{
|
||||||
state->lexptr += 21;
|
state->lexptr += 21;
|
||||||
lvalp->comp = state->make_name ("(anonymous namespace)",
|
lvalp->comp = state->make_name ("(anonymous namespace)",
|
||||||
@ -1625,7 +1625,7 @@ yylex (YYSTYPE *lvalp, cpname_state *state)
|
|||||||
HANDLE_TOKEN2 ("->", ARROW);
|
HANDLE_TOKEN2 ("->", ARROW);
|
||||||
|
|
||||||
/* For construction vtables. This is kind of hokey. */
|
/* For construction vtables. This is kind of hokey. */
|
||||||
if (strncmp (tokstart, "-in-", 4) == 0)
|
if (startswith (tokstart, "-in-"))
|
||||||
{
|
{
|
||||||
state->lexptr += 4;
|
state->lexptr += 4;
|
||||||
return CONSTRUCTION_IN;
|
return CONSTRUCTION_IN;
|
||||||
@ -1803,20 +1803,20 @@ yylex (YYSTYPE *lvalp, cpname_state *state)
|
|||||||
switch (namelen)
|
switch (namelen)
|
||||||
{
|
{
|
||||||
case 16:
|
case 16:
|
||||||
if (strncmp (tokstart, "reinterpret_cast", 16) == 0)
|
if (startswith (tokstart, "reinterpret_cast"))
|
||||||
return REINTERPRET_CAST;
|
return REINTERPRET_CAST;
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
if (strncmp (tokstart, "construction vtable for ", 24) == 0)
|
if (startswith (tokstart, "construction vtable for "))
|
||||||
{
|
{
|
||||||
state->lexptr = tokstart + 24;
|
state->lexptr = tokstart + 24;
|
||||||
return CONSTRUCTION_VTABLE;
|
return CONSTRUCTION_VTABLE;
|
||||||
}
|
}
|
||||||
if (strncmp (tokstart, "dynamic_cast", 12) == 0)
|
if (startswith (tokstart, "dynamic_cast"))
|
||||||
return DYNAMIC_CAST;
|
return DYNAMIC_CAST;
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
if (strncmp (tokstart, "static_cast", 11) == 0)
|
if (startswith (tokstart, "static_cast"))
|
||||||
return STATIC_CAST;
|
return STATIC_CAST;
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
@ -1827,24 +1827,24 @@ yylex (YYSTYPE *lvalp, cpname_state *state)
|
|||||||
HANDLE_SPECIAL ("typeinfo for ", DEMANGLE_COMPONENT_TYPEINFO);
|
HANDLE_SPECIAL ("typeinfo for ", DEMANGLE_COMPONENT_TYPEINFO);
|
||||||
HANDLE_SPECIAL ("typeinfo fn for ", DEMANGLE_COMPONENT_TYPEINFO_FN);
|
HANDLE_SPECIAL ("typeinfo fn for ", DEMANGLE_COMPONENT_TYPEINFO_FN);
|
||||||
HANDLE_SPECIAL ("typeinfo name for ", DEMANGLE_COMPONENT_TYPEINFO_NAME);
|
HANDLE_SPECIAL ("typeinfo name for ", DEMANGLE_COMPONENT_TYPEINFO_NAME);
|
||||||
if (strncmp (tokstart, "operator", 8) == 0)
|
if (startswith (tokstart, "operator"))
|
||||||
return OPERATOR;
|
return OPERATOR;
|
||||||
if (strncmp (tokstart, "restrict", 8) == 0)
|
if (startswith (tokstart, "restrict"))
|
||||||
return RESTRICT;
|
return RESTRICT;
|
||||||
if (strncmp (tokstart, "unsigned", 8) == 0)
|
if (startswith (tokstart, "unsigned"))
|
||||||
return UNSIGNED;
|
return UNSIGNED;
|
||||||
if (strncmp (tokstart, "template", 8) == 0)
|
if (startswith (tokstart, "template"))
|
||||||
return TEMPLATE;
|
return TEMPLATE;
|
||||||
if (strncmp (tokstart, "volatile", 8) == 0)
|
if (startswith (tokstart, "volatile"))
|
||||||
return VOLATILE_KEYWORD;
|
return VOLATILE_KEYWORD;
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
HANDLE_SPECIAL ("virtual thunk to ", DEMANGLE_COMPONENT_VIRTUAL_THUNK);
|
HANDLE_SPECIAL ("virtual thunk to ", DEMANGLE_COMPONENT_VIRTUAL_THUNK);
|
||||||
if (strncmp (tokstart, "wchar_t", 7) == 0)
|
if (startswith (tokstart, "wchar_t"))
|
||||||
return WCHAR_T;
|
return WCHAR_T;
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
if (strncmp (tokstart, "global constructors keyed to ", 29) == 0)
|
if (startswith (tokstart, "global constructors keyed to "))
|
||||||
{
|
{
|
||||||
const char *p;
|
const char *p;
|
||||||
state->lexptr = tokstart + 29;
|
state->lexptr = tokstart + 29;
|
||||||
@ -1855,7 +1855,7 @@ yylex (YYSTYPE *lvalp, cpname_state *state)
|
|||||||
state->lexptr = p;
|
state->lexptr = p;
|
||||||
return DEMANGLER_SPECIAL;
|
return DEMANGLER_SPECIAL;
|
||||||
}
|
}
|
||||||
if (strncmp (tokstart, "global destructors keyed to ", 28) == 0)
|
if (startswith (tokstart, "global destructors keyed to "))
|
||||||
{
|
{
|
||||||
const char *p;
|
const char *p;
|
||||||
state->lexptr = tokstart + 28;
|
state->lexptr = tokstart + 28;
|
||||||
@ -1868,52 +1868,52 @@ yylex (YYSTYPE *lvalp, cpname_state *state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
HANDLE_SPECIAL ("vtable for ", DEMANGLE_COMPONENT_VTABLE);
|
HANDLE_SPECIAL ("vtable for ", DEMANGLE_COMPONENT_VTABLE);
|
||||||
if (strncmp (tokstart, "delete", 6) == 0)
|
if (startswith (tokstart, "delete"))
|
||||||
return DELETE;
|
return DELETE;
|
||||||
if (strncmp (tokstart, "struct", 6) == 0)
|
if (startswith (tokstart, "struct"))
|
||||||
return STRUCT;
|
return STRUCT;
|
||||||
if (strncmp (tokstart, "signed", 6) == 0)
|
if (startswith (tokstart, "signed"))
|
||||||
return SIGNED_KEYWORD;
|
return SIGNED_KEYWORD;
|
||||||
if (strncmp (tokstart, "sizeof", 6) == 0)
|
if (startswith (tokstart, "sizeof"))
|
||||||
return SIZEOF;
|
return SIZEOF;
|
||||||
if (strncmp (tokstart, "double", 6) == 0)
|
if (startswith (tokstart, "double"))
|
||||||
return DOUBLE_KEYWORD;
|
return DOUBLE_KEYWORD;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
HANDLE_SPECIAL ("guard variable for ", DEMANGLE_COMPONENT_GUARD);
|
HANDLE_SPECIAL ("guard variable for ", DEMANGLE_COMPONENT_GUARD);
|
||||||
if (strncmp (tokstart, "false", 5) == 0)
|
if (startswith (tokstart, "false"))
|
||||||
return FALSEKEYWORD;
|
return FALSEKEYWORD;
|
||||||
if (strncmp (tokstart, "class", 5) == 0)
|
if (startswith (tokstart, "class"))
|
||||||
return CLASS;
|
return CLASS;
|
||||||
if (strncmp (tokstart, "union", 5) == 0)
|
if (startswith (tokstart, "union"))
|
||||||
return UNION;
|
return UNION;
|
||||||
if (strncmp (tokstart, "float", 5) == 0)
|
if (startswith (tokstart, "float"))
|
||||||
return FLOAT_KEYWORD;
|
return FLOAT_KEYWORD;
|
||||||
if (strncmp (tokstart, "short", 5) == 0)
|
if (startswith (tokstart, "short"))
|
||||||
return SHORT;
|
return SHORT;
|
||||||
if (strncmp (tokstart, "const", 5) == 0)
|
if (startswith (tokstart, "const"))
|
||||||
return CONST_KEYWORD;
|
return CONST_KEYWORD;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
if (strncmp (tokstart, "void", 4) == 0)
|
if (startswith (tokstart, "void"))
|
||||||
return VOID;
|
return VOID;
|
||||||
if (strncmp (tokstart, "bool", 4) == 0)
|
if (startswith (tokstart, "bool"))
|
||||||
return BOOL;
|
return BOOL;
|
||||||
if (strncmp (tokstart, "char", 4) == 0)
|
if (startswith (tokstart, "char"))
|
||||||
return CHAR;
|
return CHAR;
|
||||||
if (strncmp (tokstart, "enum", 4) == 0)
|
if (startswith (tokstart, "enum"))
|
||||||
return ENUM;
|
return ENUM;
|
||||||
if (strncmp (tokstart, "long", 4) == 0)
|
if (startswith (tokstart, "long"))
|
||||||
return LONG;
|
return LONG;
|
||||||
if (strncmp (tokstart, "true", 4) == 0)
|
if (startswith (tokstart, "true"))
|
||||||
return TRUEKEYWORD;
|
return TRUEKEYWORD;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
HANDLE_SPECIAL ("VTT for ", DEMANGLE_COMPONENT_VTT);
|
HANDLE_SPECIAL ("VTT for ", DEMANGLE_COMPONENT_VTT);
|
||||||
HANDLE_SPECIAL ("non-virtual thunk to ", DEMANGLE_COMPONENT_THUNK);
|
HANDLE_SPECIAL ("non-virtual thunk to ", DEMANGLE_COMPONENT_THUNK);
|
||||||
if (strncmp (tokstart, "new", 3) == 0)
|
if (startswith (tokstart, "new"))
|
||||||
return NEW;
|
return NEW;
|
||||||
if (strncmp (tokstart, "int", 3) == 0)
|
if (startswith (tokstart, "int"))
|
||||||
return INT_KEYWORD;
|
return INT_KEYWORD;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -976,12 +976,12 @@ yylex (void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Built-in BOOLEAN type. This is sort of a hack. */
|
/* Built-in BOOLEAN type. This is sort of a hack. */
|
||||||
if (strncmp (tokstart, "TRUE", 4) == 0)
|
if (startswith (tokstart, "TRUE"))
|
||||||
{
|
{
|
||||||
yylval.ulval = 1;
|
yylval.ulval = 1;
|
||||||
return M2_TRUE;
|
return M2_TRUE;
|
||||||
}
|
}
|
||||||
else if (strncmp (tokstart, "FALSE", 5) == 0)
|
else if (startswith (tokstart, "FALSE"))
|
||||||
{
|
{
|
||||||
yylval.ulval = 0;
|
yylval.ulval = 0;
|
||||||
return M2_FALSE;
|
return M2_FALSE;
|
||||||
|
@ -988,7 +988,7 @@ substitute_args (growable_macro_buffer *dest,
|
|||||||
&keep_going))
|
&keep_going))
|
||||||
{
|
{
|
||||||
bool token_is_vaopt = (tok.len == 10
|
bool token_is_vaopt = (tok.len == 10
|
||||||
&& strncmp (tok.text, "__VA_OPT__", 10) == 0);
|
&& startswith (tok.text, "__VA_OPT__"));
|
||||||
|
|
||||||
if (vaopt_state > 0)
|
if (vaopt_state > 0)
|
||||||
{
|
{
|
||||||
|
@ -1886,8 +1886,8 @@ command_notifies_uscc_observer (struct mi_parse *command)
|
|||||||
if (command->op == CLI_COMMAND)
|
if (command->op == CLI_COMMAND)
|
||||||
{
|
{
|
||||||
/* CLI commands "thread" and "inferior" already send it. */
|
/* CLI commands "thread" and "inferior" already send it. */
|
||||||
return (strncmp (command->command, "thread ", 7) == 0
|
return (startswith (command->command, "thread ")
|
||||||
|| strncmp (command->command, "inferior ", 9) == 0);
|
|| startswith (command->command, "inferior "));
|
||||||
}
|
}
|
||||||
else /* MI_COMMAND */
|
else /* MI_COMMAND */
|
||||||
{
|
{
|
||||||
@ -1895,8 +1895,8 @@ command_notifies_uscc_observer (struct mi_parse *command)
|
|||||||
&& command->argc > 1)
|
&& command->argc > 1)
|
||||||
{
|
{
|
||||||
/* "thread" and "inferior" again, but through -interpreter-exec. */
|
/* "thread" and "inferior" again, but through -interpreter-exec. */
|
||||||
return (strncmp (command->argv[1], "thread ", 7) == 0
|
return (startswith (command->argv[1], "thread ")
|
||||||
|| strncmp (command->argv[1], "inferior ", 9) == 0);
|
|| startswith (command->argv[1], "inferior "));
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -1986,7 +1986,7 @@ munge_name_and_block (const char **name, const struct block **block)
|
|||||||
{
|
{
|
||||||
/* If it is a global reference, skip the current block in favor of
|
/* If it is a global reference, skip the current block in favor of
|
||||||
the static block. */
|
the static block. */
|
||||||
if (strncmp (*name, "::", 2) == 0)
|
if (startswith (*name, "::"))
|
||||||
{
|
{
|
||||||
*name += 2;
|
*name += 2;
|
||||||
*block = block_static_block (*block);
|
*block = block_static_block (*block);
|
||||||
|
Loading…
Reference in New Issue
Block a user