This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
Re: [RFC] Koenig lookup patch 3
I was curious to know what happens when the current language is C, not
C++. Do we still attempt ADL?
With the previous patch an ADL search would have been attempted and
failed. What do you think of this solution (applied to the previous patch):
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 80e09d4..a45133f 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -184,7 +184,7 @@ static int parse_number (char *, int, int, YYSTYPE *);
%token <sval> STRING
%token <ssym> NAME /* BLOCKNAME defined below to give it higher precedence. */
-%token <ssym> UNKNOWN_NAME
+%token <ssym> UNKNOWN_CPP_NAME
%token <voidval> COMPLETE
%token <tsym> TYPENAME
%type <sval> name string_exp
@@ -385,7 +385,7 @@ exp : exp '('
write_exp_elt_opcode (OP_FUNCALL); }
;
-exp : UNKNOWN_NAME '('
+exp : UNKNOWN_CPP_NAME '('
{
/* This could potentially be a an argument defined
@@ -820,7 +820,7 @@ variable: name_not_typename
}
;
-space_identifier : '@' UNKNOWN_NAME
+space_identifier : '@' UNKNOWN_CPP_NAME
{ push_type_address_space (copy_name ($2.stoken));
push_type (tp_space_identifier);
}
@@ -1116,12 +1116,12 @@ name : NAME { $$ = $1.stoken; }
| BLOCKNAME { $$ = $1.stoken; }
| TYPENAME { $$ = $1.stoken; }
| NAME_OR_INT { $$ = $1.stoken; }
- | UNKNOWN_NAME { $$ = $1.stoken; }
+ | UNKNOWN_CPP_NAME { $$ = $1.stoken; }
;
name_not_typename : NAME
| BLOCKNAME
- | UNKNOWN_NAME
+ | UNKNOWN_CPP_NAME
/* These would be useful if name_not_typename was useful, but it is just
a fake for "variable", so these cause reduce/reduce conflicts because
the parser can't tell whether NAME_OR_INT is a name_not_typename (=variable,
@@ -2043,8 +2043,8 @@ yylex ()
if (in_parse_field && *lexptr == '\0')
saw_name_at_eof = 1;
- if (sym == NULL && !lookup_minimal_symbol (tmp, NULL, NULL))
- return UNKNOWN_NAME;
+ if (sym == NULL && !lookup_minimal_symbol (tmp, NULL, NULL) && parse_language->la_language == language_cplus)
+ return UNKNOWN_CPP_NAME;
return NAME;
}