Remove varobj_language_string, languages and varobj_languages
authorYao Qi <yao@codesourcery.com>
Wed, 9 Oct 2013 14:10:14 +0000 (22:10 +0800)
committerYao Qi <yao@codesourcery.com>
Thu, 7 Nov 2013 07:10:50 +0000 (15:10 +0800)
This patch does some cleanups, removing some language-related stuff.
Note that mi_cmd_var_info_expression uses varobj_language_string,
which is redundant, because we can get language name from
lang->la_natural_name.

varobj_language_string doesn't have "Ada", which looks like a bug to
me.  With this patch applied, this problem doesn't exist, because the
language name is got from the same place (field la_natural_name).

gdb:

2013-11-07  Yao Qi  <yao@codesourcery.com>

* mi/mi-cmd-var.c: Include "language.h".
(mi_cmd_var_info_expression): Get language name from
language_defn.
* varobj.c (varobj_language_string): Remove.
(variable_language): Remove declaration.
(languages): Remove.
(varobj_get_language): Change the type of return value.
(variable_language): Remove.
* varobj.h (enum varobj_languages): Remove.
(varobj_language_string): Remove declaration.
(varobj_get_language): Update declaration.

gdb/doc:

2013-11-07  Yao Qi  <yao@codesourcery.com>

* gdb.texinfo (GDB/MI Variable Objects): Update doc about the
output of "-var-info-expression".

gdb/ChangeLog
gdb/doc/ChangeLog
gdb/doc/gdb.texinfo
gdb/mi/mi-cmd-var.c
gdb/varobj.c
gdb/varobj.h

index 63879fba7ee05f627623073cdf241914870a93af..88ea85980e7db9a44d1e01804c26b904c311065e 100644 (file)
@@ -1,3 +1,17 @@
+2013-11-07  Yao Qi  <yao@codesourcery.com>
+
+       * mi/mi-cmd-var.c: Include "language.h".
+       (mi_cmd_var_info_expression): Get language name from
+       language_defn.
+       * varobj.c (varobj_language_string): Remove.
+       (variable_language): Remove declaration.
+       (languages): Remove.
+       (varobj_get_language): Change the type of return value.
+       (variable_language): Remove.
+       * varobj.h (enum varobj_languages): Remove.
+       (varobj_language_string): Remove declaration.
+       (varobj_get_language): Update declaration.
+
 2013-11-07  Yao Qi  <yao@codesourcery.com>
 
        * language.h (struct language_defn) <la_natural_name>: New
index 9803346932641676b1b1429e8e166b37bd6f37da..12ceb0151171eafea07d10fa723571bc60302c0e 100644 (file)
@@ -1,3 +1,8 @@
+2013-11-07  Yao Qi  <yao@codesourcery.com>
+
+       * gdb.texinfo (GDB/MI Variable Objects): Update doc about the
+       output of "-var-info-expression".
+
 2013-11-06  Pedro Alves  <palves@redhat.com>
 
        * gdb.texinfo (Starting) <set/show startup-with-shell>: Mention
index 39498d7ceac1656b3a43248ab5981e35ada3d85d..80ddaf95520890f7fe4574f5af78dcb4b4b8eed0 100644 (file)
@@ -32402,7 +32402,8 @@ For example, if @code{a} is an array, and variable object
 @end smallexample
 
 @noindent
-Here, the values of @code{lang} can be @code{@{"C" | "C++" | "Java"@}}.
+Here, the value of @code{lang} is the language name, which can be
+found in @ref{Supported Languages}.
 
 Note that the output of the @code{-var-list-children} command also
 includes those expressions, so the @code{-var-info-expression} command
index 57a2f6b4518d9f5dd4b1196f3c849788074062f0..0a2ef5cfc1d1fb3c9416db65b69c30a70b1f6588 100644 (file)
@@ -24,6 +24,7 @@
 #include "ui-out.h"
 #include "mi-out.h"
 #include "varobj.h"
+#include "language.h"
 #include "value.h"
 #include <ctype.h>
 #include "gdb_string.h"
@@ -479,7 +480,7 @@ void
 mi_cmd_var_info_expression (char *command, char **argv, int argc)
 {
   struct ui_out *uiout = current_uiout;
-  enum varobj_languages lang;
+  const struct language_defn *lang;
   struct varobj *var;
 
   if (argc != 1)
@@ -490,7 +491,7 @@ mi_cmd_var_info_expression (char *command, char **argv, int argc)
 
   lang = varobj_get_language (var);
 
-  ui_out_field_string (uiout, "lang", varobj_language_string[(int) lang]);
+  ui_out_field_string (uiout, "lang", lang->la_natural_name);
   ui_out_field_string (uiout, "exp", varobj_get_expression (var));
 }
 
index b5cf17da2aaf392c2ecff8cdc4090ca3e683acc4..f15c9de7ce74e36c4998dabd80f4e0413a8e6faa 100644 (file)
@@ -55,9 +55,6 @@ show_varobjdebug (struct ui_file *file, int from_tty,
 char *varobj_format_string[] =
   { "natural", "binary", "decimal", "hexadecimal", "octal" };
 
-/* String representations of gdb's known languages.  */
-char *varobj_language_string[] = { "C", "C++", "Java" };
-
 /* True if we want to allow Python-based pretty-printing.  */
 static int pretty_printing = 0;
 
@@ -199,8 +196,6 @@ static int install_new_value (struct varobj *var, struct value *value,
 
 /* Language-specific routines.  */
 
-static enum varobj_languages variable_language (struct varobj *var);
-
 static int number_of_children (struct varobj *);
 
 static char *name_of_variable (struct varobj *);
@@ -224,14 +219,6 @@ static struct varobj *varobj_add_child (struct varobj *var,
 
 #endif /* HAVE_PYTHON */
 
-/* Array of known source language routines.  */
-static const struct lang_varobj_ops *languages[vlang_end] = {
-  &c_varobj_ops,
-  &cplus_varobj_ops,
-  &java_varobj_ops,
-  &ada_varobj_ops,
-};
-
 /* Private data */
 
 /* Mappings of varobj_display_formats enums to gdb's format codes.  */
@@ -1126,10 +1113,10 @@ varobj_get_path_expr (struct varobj *var)
     }
 }
 
-enum varobj_languages
+const struct language_defn *
 varobj_get_language (struct varobj *var)
 {
-  return variable_language (var);
+  return var->root->exp->language_defn;
 }
 
 int
@@ -2332,32 +2319,6 @@ cppop (struct cpstack **pstack)
 
 /* Common entry points */
 
-/* Get the language of variable VAR.  */
-static enum varobj_languages
-variable_language (struct varobj *var)
-{
-  enum varobj_languages lang;
-
-  switch (var->root->exp->language_defn->la_language)
-    {
-    default:
-    case language_c:
-      lang = vlang_c;
-      break;
-    case language_cplus:
-      lang = vlang_cplus;
-      break;
-    case language_java:
-      lang = vlang_java;
-      break;
-    case language_ada:
-      lang = vlang_ada;
-      break;
-    }
-
-  return lang;
-}
-
 /* Return the number of children for a given variable.
    The result of this function is defined by the language
    implementation.  The number of children returned by this function
index 2379c3d9c3074619fd4e7efce3d42e845d890a95..978d9b94c92f961960edf813ae182c6147a6d6ad 100644 (file)
@@ -52,16 +52,6 @@ enum varobj_scope_status
 /* String representations of gdb's format codes (defined in varobj.c).  */
 extern char *varobj_format_string[];
 
-/* Languages supported by this variable objects system.  This enum is used
-   to index arrays so we make its first enum explicitly zero.  */
-enum varobj_languages
-  {
-    vlang_c = 0, vlang_cplus, vlang_java, vlang_ada, vlang_end
-  };
-
-/* String representations of gdb's known languages (defined in varobj.c).  */
-extern char *varobj_language_string[];
-
 /* Struct thar describes a variable object instance.  */
 
 struct varobj;
@@ -286,7 +276,7 @@ extern struct type *varobj_get_gdb_type (struct varobj *var);
 
 extern char *varobj_get_path_expr (struct varobj *var);
 
-extern enum varobj_languages varobj_get_language (struct varobj *var);
+extern const struct language_defn *varobj_get_language (struct varobj *var);
 
 extern int varobj_get_attributes (struct varobj *var);
 
This page took 0.059028 seconds and 4 git commands to generate.