[ppc64le] Use skip_entrypoint for skip_trampoline_code
[deliverable/binutils-gdb.git] / gdb / d-exp.y
index e23a0aaeeaec07876a12befb9096d2394b979fa8..dd87d8aa18849ed14d7a773de824ee1bfb706cd8 100644 (file)
@@ -126,6 +126,8 @@ static int yylex (void);
 
 void yyerror (char *);
 
+static int type_aggregate_p (struct type *);
+
 %}
 
 /* Although the yacc "value" of an expression is not used,
@@ -522,12 +524,12 @@ PrimaryExpression:
                            {
                              struct bound_minimal_symbol msymbol;
                              struct block_symbol sym;
-                             const char *typename = TYPE_SAFE_NAME (type);
-                             int typename_len = strlen (typename);
+                             const char *type_name = TYPE_SAFE_NAME (type);
+                             int type_name_len = strlen (type_name);
                              char *name;
 
                              name = xstrprintf ("%.*s.%.*s",
-                                                typename_len, typename,
+                                                type_name_len, type_name,
                                                 $3.length, $3.ptr);
                              make_cleanup (xfree, name);
 
@@ -554,9 +556,7 @@ PrimaryExpression:
 
                          /* Check if the qualified name resolves as a member
                             of an aggregate or an enum type.  */
-                         if (!(TYPE_CODE (type) == TYPE_CODE_STRUCT
-                               || TYPE_CODE (type) == TYPE_CODE_UNION
-                               || TYPE_CODE (type) == TYPE_CODE_ENUM))
+                         if (!type_aggregate_p (type))
                            error (_("`%s' is not defined as an aggregate type."),
                                   TYPE_SAFE_NAME (type));
 
@@ -695,6 +695,17 @@ BasicType:
 
 %%
 
+/* Return true if the type is aggregate-like.  */
+
+static int
+type_aggregate_p (struct type *type)
+{
+  return (TYPE_CODE (type) == TYPE_CODE_STRUCT
+         || TYPE_CODE (type) == TYPE_CODE_UNION
+         || (TYPE_CODE (type) == TYPE_CODE_ENUM
+             && TYPE_DECLARED_CLASS (type)));
+}
+
 /* Take care of parsing a number (anything that starts with a digit).
    Set yylval and return the token type; update lexptr.
    LEN is the number of characters in it.  */
@@ -1440,6 +1451,8 @@ classify_inner_name (struct parser_state *par_state,
     return classify_name (par_state, block);
 
   type = check_typedef (context);
+  if (!type_aggregate_p (type))
+    return ERROR;
 
   copy = copy_name (yylval.ssym.stoken);
   yylval.ssym.sym = d_lookup_nested_symbol (type, copy, block);
This page took 0.024268 seconds and 4 git commands to generate.