gdb: resume ongoing step after handling fork or vfork
[deliverable/binutils-gdb.git] / gdb / cp-name-parser.y
index 8514411ebeba190159a4d2eac1f45354cdbbfc7f..6410363c87f022a549506ddac0cd863e02b51e70 100644 (file)
@@ -1,6 +1,6 @@
 /* YACC parser for C++ names, for GDB.
 
-   Copyright (C) 2003-2021 Free Software Foundation, Inc.
+   Copyright (C) 2003-2022 Free Software Foundation, Inc.
 
    Parts of the lexer are based on c-exp.y from GDB.
 
@@ -1511,7 +1511,7 @@ cp_parse_escape (const char **string_ptr)
 }
 
 #define HANDLE_SPECIAL(string, comp)                           \
-  if (strncmp (tokstart, string, sizeof (string) - 1) == 0)    \
+  if (startswith (tokstart, string))                           \
     {                                                          \
       state->lexptr = tokstart + sizeof (string) - 1;                  \
       lvalp->lval = comp;                                      \
@@ -1592,7 +1592,7 @@ yylex (YYSTYPE *lvalp, cpname_state *state)
       return INT;
 
     case '(':
-      if (strncmp (tokstart, "(anonymous namespace)", 21) == 0)
+      if (startswith (tokstart, "(anonymous namespace)"))
        {
          state->lexptr += 21;
          lvalp->comp = state->make_name ("(anonymous namespace)",
@@ -1625,7 +1625,7 @@ yylex (YYSTYPE *lvalp, cpname_state *state)
       HANDLE_TOKEN2 ("->", ARROW);
 
       /* For construction vtables.  This is kind of hokey.  */
-      if (strncmp (tokstart, "-in-", 4) == 0)
+      if (startswith (tokstart, "-in-"))
        {
          state->lexptr += 4;
          return CONSTRUCTION_IN;
@@ -1803,20 +1803,20 @@ yylex (YYSTYPE *lvalp, cpname_state *state)
   switch (namelen)
     {
     case 16:
-      if (strncmp (tokstart, "reinterpret_cast", 16) == 0)
+      if (startswith (tokstart, "reinterpret_cast"))
        return REINTERPRET_CAST;
       break;
     case 12:
-      if (strncmp (tokstart, "construction vtable for ", 24) == 0)
+      if (startswith (tokstart, "construction vtable for "))
        {
          state->lexptr = tokstart + 24;
          return CONSTRUCTION_VTABLE;
        }
-      if (strncmp (tokstart, "dynamic_cast", 12) == 0)
+      if (startswith (tokstart, "dynamic_cast"))
        return DYNAMIC_CAST;
       break;
     case 11:
-      if (strncmp (tokstart, "static_cast", 11) == 0)
+      if (startswith (tokstart, "static_cast"))
        return STATIC_CAST;
       break;
     case 9:
@@ -1827,24 +1827,24 @@ yylex (YYSTYPE *lvalp, cpname_state *state)
       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);
-      if (strncmp (tokstart, "operator", 8) == 0)
+      if (startswith (tokstart, "operator"))
        return OPERATOR;
-      if (strncmp (tokstart, "restrict", 8) == 0)
+      if (startswith (tokstart, "restrict"))
        return RESTRICT;
-      if (strncmp (tokstart, "unsigned", 8) == 0)
+      if (startswith (tokstart, "unsigned"))
        return UNSIGNED;
-      if (strncmp (tokstart, "template", 8) == 0)
+      if (startswith (tokstart, "template"))
        return TEMPLATE;
-      if (strncmp (tokstart, "volatile", 8) == 0)
+      if (startswith (tokstart, "volatile"))
        return VOLATILE_KEYWORD;
       break;
     case 7:
       HANDLE_SPECIAL ("virtual thunk to ", DEMANGLE_COMPONENT_VIRTUAL_THUNK);
-      if (strncmp (tokstart, "wchar_t", 7) == 0)
+      if (startswith (tokstart, "wchar_t"))
        return WCHAR_T;
       break;
     case 6:
-      if (strncmp (tokstart, "global constructors keyed to ", 29) == 0)
+      if (startswith (tokstart, "global constructors keyed to "))
        {
          const char *p;
          state->lexptr = tokstart + 29;
@@ -1855,7 +1855,7 @@ yylex (YYSTYPE *lvalp, cpname_state *state)
          state->lexptr = p;
          return DEMANGLER_SPECIAL;
        }
-      if (strncmp (tokstart, "global destructors keyed to ", 28) == 0)
+      if (startswith (tokstart, "global destructors keyed to "))
        {
          const char *p;
          state->lexptr = tokstart + 28;
@@ -1868,52 +1868,52 @@ yylex (YYSTYPE *lvalp, cpname_state *state)
        }
 
       HANDLE_SPECIAL ("vtable for ", DEMANGLE_COMPONENT_VTABLE);
-      if (strncmp (tokstart, "delete", 6) == 0)
+      if (startswith (tokstart, "delete"))
        return DELETE;
-      if (strncmp (tokstart, "struct", 6) == 0)
+      if (startswith (tokstart, "struct"))
        return STRUCT;
-      if (strncmp (tokstart, "signed", 6) == 0)
+      if (startswith (tokstart, "signed"))
        return SIGNED_KEYWORD;
-      if (strncmp (tokstart, "sizeof", 6) == 0)
+      if (startswith (tokstart, "sizeof"))
        return SIZEOF;
-      if (strncmp (tokstart, "double", 6) == 0)
+      if (startswith (tokstart, "double"))
        return DOUBLE_KEYWORD;
       break;
     case 5:
       HANDLE_SPECIAL ("guard variable for ", DEMANGLE_COMPONENT_GUARD);
-      if (strncmp (tokstart, "false", 5) == 0)
+      if (startswith (tokstart, "false"))
        return FALSEKEYWORD;
-      if (strncmp (tokstart, "class", 5) == 0)
+      if (startswith (tokstart, "class"))
        return CLASS;
-      if (strncmp (tokstart, "union", 5) == 0)
+      if (startswith (tokstart, "union"))
        return UNION;
-      if (strncmp (tokstart, "float", 5) == 0)
+      if (startswith (tokstart, "float"))
        return FLOAT_KEYWORD;
-      if (strncmp (tokstart, "short", 5) == 0)
+      if (startswith (tokstart, "short"))
        return SHORT;
-      if (strncmp (tokstart, "const", 5) == 0)
+      if (startswith (tokstart, "const"))
        return CONST_KEYWORD;
       break;
     case 4:
-      if (strncmp (tokstart, "void", 4) == 0)
+      if (startswith (tokstart, "void"))
        return VOID;
-      if (strncmp (tokstart, "bool", 4) == 0)
+      if (startswith (tokstart, "bool"))
        return BOOL;
-      if (strncmp (tokstart, "char", 4) == 0)
+      if (startswith (tokstart, "char"))
        return CHAR;
-      if (strncmp (tokstart, "enum", 4) == 0)
+      if (startswith (tokstart, "enum"))
        return ENUM;
-      if (strncmp (tokstart, "long", 4) == 0)
+      if (startswith (tokstart, "long"))
        return LONG;
-      if (strncmp (tokstart, "true", 4) == 0)
+      if (startswith (tokstart, "true"))
        return TRUEKEYWORD;
       break;
     case 3:
       HANDLE_SPECIAL ("VTT for ", DEMANGLE_COMPONENT_VTT);
       HANDLE_SPECIAL ("non-virtual thunk to ", DEMANGLE_COMPONENT_THUNK);
-      if (strncmp (tokstart, "new", 3) == 0)
+      if (startswith (tokstart, "new"))
        return NEW;
-      if (strncmp (tokstart, "int", 3) == 0)
+      if (startswith (tokstart, "int"))
        return INT_KEYWORD;
       break;
     default:
This page took 0.028824 seconds and 4 git commands to generate.