aboutsummaryrefslogtreecommitdiff
path: root/gdb/c-exp.y
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>1991-11-06 01:08:21 +0000
committerPer Bothner <per@bothner.com>1991-11-06 01:08:21 +0000
commit545af6ce070ded76ef1b8697495a18dbe0990e6c (patch)
tree6ee06fb285b476377d97fa7a7e8becdaf012e44f /gdb/c-exp.y
parent4906534f1f4f6c1a3444f370cfd9ecdf986e66a0 (diff)
downloadgdb-545af6ce070ded76ef1b8697495a18dbe0990e6c.zip
gdb-545af6ce070ded76ef1b8697495a18dbe0990e6c.tar.gz
gdb-545af6ce070ded76ef1b8697495a18dbe0990e6c.tar.bz2
Add C++ as a separate language.
Also, fix a C++ problem when looking for methods in super-classes. (There was confusion between base and derived types.)
Diffstat (limited to 'gdb/c-exp.y')
-rw-r--r--gdb/c-exp.y26
1 files changed, 22 insertions, 4 deletions
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index b30729a..3e318fe 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -1348,7 +1348,10 @@ yylex ()
int hextype;
sym = lookup_symbol (tmp, expression_context_block,
- VAR_NAMESPACE, &is_a_field_of_this, NULL);
+ VAR_NAMESPACE,
+ current_language->la_language == language_cplus
+ ? &is_a_field_of_this : NULL,
+ NULL);
if ((sym && SYMBOL_CLASS (sym) == LOC_BLOCK) ||
lookup_partial_symtab (tmp))
{
@@ -1480,8 +1483,6 @@ struct type ** const (c_builtin_types[]) =
0
};
-/* FIXME: Eventually do a separate defintion for C++. */
-
const struct language_defn c_language_defn = {
"c", /* Language name */
language_c,
@@ -1499,6 +1500,23 @@ const struct language_defn c_language_defn = {
LANG_MAGIC
};
+const struct language_defn cplus_language_defn = {
+ "c++", /* Language name */
+ language_cplus,
+ c_builtin_types,
+ range_check_off,
+ type_check_off,
+ c_parse,
+ c_error,
+ &BUILTIN_TYPE_LONGEST, /* longest signed integral type */
+ &BUILTIN_TYPE_UNSIGNED_LONGEST,/* longest unsigned integral type */
+ &builtin_type_double, /* longest floating point type */ /*FIXME*/
+ "0x%x", "0x%", "x", /* Hex format, prefix, suffix */
+ "0%o", "0%", "o", /* Octal format, prefix, suffix */
+ c_op_print_tab, /* expression operators for printing */
+ LANG_MAGIC
+};
+
void
_initialize_c_exp ()
{
@@ -1552,5 +1570,5 @@ _initialize_c_exp ()
"double complex");
add_language (&c_language_defn);
- set_language (language_c); /* Make C the default language */
+ add_language (&cplus_language_defn);
}