This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[cplus] Merge fixups for new demangler interface 2/2


Even less interesting; some things I noticed when I removed the excess copy
of include/cp-demangle.h on the branch.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

2003-01-13  Daniel Jacobowitz  <drow@mvista.com>

	* Makefile.in (cp_demangle_h): Remove.
	(libiberty_h): Add.
	(cp-names.tab.o, cp-names-main.tab.o, cp-support.o): Update
	dependencies.
	* cp-support.c: Don't include "cp-demangle.h".
	(d_left, d_right): New macros.
	(cp_canonicalize_string, class_name_from_physname,
	method_name_from_physname): Fix types and component names.
	* cp-support.h (demangled_name_to_comp, mangled_name_to_comp)
	(cp_comp_to_string): Update prototypes.

Index: gdb/Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.268.2.11
diff -u -p -r1.268.2.11 Makefile.in
--- gdb/Makefile.in	13 Jan 2004 16:11:46 -0000	1.268.2.11
+++ gdb/Makefile.in	13 Jan 2004 18:26:55 -0000
@@ -579,13 +579,13 @@ coff_sym_h =	$(INCLUDE_DIR)/coff/sym.h
 coff_symconst_h =	$(INCLUDE_DIR)/coff/symconst.h
 coff_ecoff_h =	$(INCLUDE_DIR)/coff/ecoff.h
 coff_internal_h =	$(INCLUDE_DIR)/coff/internal.h
-cp_demangle_h =	$(INCLUDE_DIR)/cp-demangle.h
 dis_asm_h =	$(INCLUDE_DIR)/dis-asm.h $(bfd_h)
 elf_reloc_macros_h =	$(INCLUDE_DIR)/elf/reloc-macros.h
 elf_sh_h =	$(INCLUDE_DIR)/elf/sh.h
 elf_arm_h =	$(INCLUDE_DIR)/elf/arm.h $(elf_reloc_macros_h)
 elf_bfd_h =	$(BFD_SRC)/elf-bfd.h
 libaout_h =	$(BFD_SRC)/libaout.h
+libiberty_h =	$(INCLUDE_DIR)/libiberty.h
 libbfd_h =	$(BFD_SRC)/libbfd.h
 remote_sim_h =	$(INCLUDE_DIR)/gdb/remote-sim.h
 demangle_h =    $(INCLUDE_DIR)/demangle.h
@@ -1441,9 +1441,9 @@ c-exp.tab.c: c-exp.y
 	-rm c-exp.tmp
 	mv c-exp.new ./c-exp.tab.c
 
-cp-names.tab.o: cp-names.tab.c $(safe_ctype_h) $(cp_demangle_h)
+cp-names.tab.o: cp-names.tab.c $(safe_ctype_h) $(libiberty_h) $(demangle_h)
 
-cp-names-main.tab.o: cp-names.tab.c $(safe_ctype_h) $(cp_demangle_h)
+cp-names-main.tab.o: cp-names.tab.c $(safe_ctype_h) $(libiberty_h) $(demangle_h)
 	$(CC) -c $(INTERNAL_CFLAGS) -DTEST_CPNAMES \
 		-o cp-names-main.tab.o cp-names.tab.c
 test-cpnames: cp-names-main.tab.o $(LIBIBERTY)
@@ -1709,7 +1709,7 @@ cp-namespace.o: cp-namespace.c $(defs_h)
 cp-support.o: cp-support.c $(defs_h) $(cp_support_h) $(gdb_string_h) \
 	$(demangle_h) $(gdb_assert_h) $(gdbcmd_h) $(dictionary_h) \
 	$(objfiles_h) $(frame_h) $(symtab_h) $(block_h) $(complaints_h) \
-	$(cp_demangle_h)
+	$(demangle_h)
 cpu32bug-rom.o: cpu32bug-rom.c $(defs_h) $(gdbcore_h) $(target_h) \
 	$(monitor_h) $(serial_h) $(regcache_h) $(m68k_tdep_h)
 cp-valprint.o: cp-valprint.c $(defs_h) $(gdb_obstack_h) $(symtab_h) \
Index: gdb/cp-support.c
===================================================================
RCS file: /cvs/src/src/gdb/cp-support.c,v
retrieving revision 1.1.6.6
diff -u -p -r1.1.6.6 cp-support.c
--- gdb/cp-support.c	13 Jan 2004 18:18:03 -0000	1.1.6.6
+++ gdb/cp-support.c	13 Jan 2004 18:26:56 -0000
@@ -35,8 +35,8 @@
 #include "complaints.h"
 #include "gdbtypes.h"
 
-#define IN_GDB
-#include "cp-demangle.h"
+#define d_left(dc) (dc)->u.s_binary.left
+#define d_right(dc) (dc)->u.s_binary.right
 
 /* Functions related to demangled name parsing.  */
 
@@ -75,20 +75,20 @@ static void first_component_command (cha
 char *
 cp_canonicalize_string (const char *string)
 {
-  struct d_info *di;
-  struct d_comp *ret_comp;
+  void *storage;
+  struct demangle_component *ret_comp;
   char *ret;
   int len = strlen (string);
 
   len = len + len / 8;
 
-  ret_comp = demangled_name_to_comp (string, &di);
+  ret_comp = demangled_name_to_comp (string, &storage);
   if (ret_comp == NULL)
     return NULL;
 
   ret = cp_comp_to_string (ret_comp, len);
 
-  xfree (di);
+  xfree (storage);
 
   return ret;
 }
@@ -98,12 +98,13 @@ cp_canonicalize_string (const char *stri
 char *
 class_name_from_physname (const char *physname)
 {
-  struct d_info *di;
+  void *storage;
   char *demangled_name = NULL, *ret;
-  struct d_comp *ret_comp, *prev_comp;
+  struct demangle_component *ret_comp, *prev_comp;
   int done;
 
-  ret_comp = mangled_name_to_comp (physname, DMGL_ANSI, &di, &demangled_name);
+  ret_comp = mangled_name_to_comp (physname, DMGL_ANSI, &storage,
+				   &demangled_name);
   if (ret_comp == NULL)
     return NULL;
 
@@ -112,31 +113,31 @@ class_name_from_physname (const char *ph
   while (!done)
     switch (ret_comp->type)
       {
-      case D_COMP_TYPED_NAME:
+      case DEMANGLE_COMPONENT_TYPED_NAME:
 	prev_comp = NULL;
         ret_comp = d_right (ret_comp);
         break;
-      case D_COMP_QUAL_NAME:
-      case D_COMP_LOCAL_NAME:
+      case DEMANGLE_COMPONENT_QUAL_NAME:
+      case DEMANGLE_COMPONENT_LOCAL_NAME:
 	prev_comp = ret_comp;
         ret_comp = d_right (ret_comp);
         break;
-      case D_COMP_CONST:
-      case D_COMP_RESTRICT:
-      case D_COMP_VOLATILE:
-      case D_COMP_CONST_THIS:
-      case D_COMP_RESTRICT_THIS:
-      case D_COMP_VOLATILE_THIS:
-      case D_COMP_VENDOR_TYPE_QUAL:
+      case DEMANGLE_COMPONENT_CONST:
+      case DEMANGLE_COMPONENT_RESTRICT:
+      case DEMANGLE_COMPONENT_VOLATILE:
+      case DEMANGLE_COMPONENT_CONST_THIS:
+      case DEMANGLE_COMPONENT_RESTRICT_THIS:
+      case DEMANGLE_COMPONENT_VOLATILE_THIS:
+      case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL:
 	prev_comp = NULL;
         ret_comp = d_left (ret_comp);
         break;
-      case D_COMP_NAME:
-      case D_COMP_TEMPLATE:
-      case D_COMP_CTOR:
-      case D_COMP_DTOR:
-      case D_COMP_OPERATOR:
-      case D_COMP_EXTENDED_OPERATOR:
+      case DEMANGLE_COMPONENT_NAME:
+      case DEMANGLE_COMPONENT_TEMPLATE:
+      case DEMANGLE_COMPONENT_CTOR:
+      case DEMANGLE_COMPONENT_DTOR:
+      case DEMANGLE_COMPONENT_OPERATOR:
+      case DEMANGLE_COMPONENT_EXTENDED_OPERATOR:
 	done = 1;
 	break;
       default:
@@ -154,7 +155,7 @@ class_name_from_physname (const char *ph
       ret = cp_comp_to_string (prev_comp, 10);
     }
 
-  xfree (di);
+  xfree (storage);
   if (demangled_name)
     xfree (demangled_name);
   return ret;
@@ -165,12 +166,13 @@ class_name_from_physname (const char *ph
 char *
 method_name_from_physname (const char *physname)
 {
-  struct d_info *di;
+  void *storage;
   char *demangled_name = NULL, *ret;
-  struct d_comp *ret_comp;
+  struct demangle_component *ret_comp;
   int done;
 
-  ret_comp = mangled_name_to_comp (physname, DMGL_ANSI, &di, &demangled_name);
+  ret_comp = mangled_name_to_comp (physname, DMGL_ANSI, &storage,
+				   &demangled_name);
   if (ret_comp == NULL)
     return NULL;
 
@@ -178,26 +180,26 @@ method_name_from_physname (const char *p
   while (!done)
     switch (ret_comp->type)
       {
-      case D_COMP_QUAL_NAME:
-      case D_COMP_LOCAL_NAME:
-      case D_COMP_TYPED_NAME:
+      case DEMANGLE_COMPONENT_QUAL_NAME:
+      case DEMANGLE_COMPONENT_LOCAL_NAME:
+      case DEMANGLE_COMPONENT_TYPED_NAME:
         ret_comp = d_right (ret_comp);
         break;
-      case D_COMP_CONST:
-      case D_COMP_RESTRICT:
-      case D_COMP_VOLATILE:
-      case D_COMP_CONST_THIS:
-      case D_COMP_RESTRICT_THIS:
-      case D_COMP_VOLATILE_THIS:
-      case D_COMP_VENDOR_TYPE_QUAL:
+      case DEMANGLE_COMPONENT_CONST:
+      case DEMANGLE_COMPONENT_RESTRICT:
+      case DEMANGLE_COMPONENT_VOLATILE:
+      case DEMANGLE_COMPONENT_CONST_THIS:
+      case DEMANGLE_COMPONENT_RESTRICT_THIS:
+      case DEMANGLE_COMPONENT_VOLATILE_THIS:
+      case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL:
         ret_comp = d_left (ret_comp);
         break;
-      case D_COMP_NAME:
-      case D_COMP_TEMPLATE:
-      case D_COMP_CTOR:
-      case D_COMP_DTOR:
-      case D_COMP_OPERATOR:
-      case D_COMP_EXTENDED_OPERATOR:
+      case DEMANGLE_COMPONENT_NAME:
+      case DEMANGLE_COMPONENT_TEMPLATE:
+      case DEMANGLE_COMPONENT_CTOR:
+      case DEMANGLE_COMPONENT_DTOR:
+      case DEMANGLE_COMPONENT_OPERATOR:
+      case DEMANGLE_COMPONENT_EXTENDED_OPERATOR:
 	done = 1;
 	break;
       default:
@@ -211,7 +213,7 @@ method_name_from_physname (const char *p
     /* The ten is completely arbitrary; we don't have a good estimate.  */
     ret = cp_comp_to_string (ret_comp, 10);
 
-  xfree (di);
+  xfree (storage);
   if (demangled_name)
     xfree (demangled_name);
   return ret;
Index: gdb/cp-support.h
===================================================================
RCS file: /cvs/src/src/gdb/cp-support.h,v
retrieving revision 1.1.6.5
diff -u -p -r1.1.6.5 cp-support.h
--- gdb/cp-support.h	13 Jan 2004 16:11:53 -0000	1.1.6.5
+++ gdb/cp-support.h	13 Jan 2004 18:26:56 -0000
@@ -35,7 +35,7 @@ struct obstack;
 struct block;
 struct objfile;
 struct type;
-struct d_comp;
+struct demangle_component;
 struct d_info;
 
 /* This struct is designed to store data from using directives.  It
@@ -114,15 +114,15 @@ extern void cp_check_possible_namespace_
 
 /* Functions from cp-names.y.  */
 
-extern struct d_comp *demangled_name_to_comp (const char *demangled_name,
-					      struct d_info **di_p);
+extern struct demangle_component *demangled_name_to_comp
+  (const char *demangled_name, void **memory_p);
 
-extern struct d_comp *mangled_name_to_comp (const char *mangled_name,
-					    int options,
-					    struct d_info **di_p,
-					    char **demangled_p);
+extern struct demangle_component *mangled_name_to_comp
+  (const char *mangled_name, int options, void **memory_p,
+   char **demangled_name_p);
 
-extern char *cp_comp_to_string (struct d_comp *result, int estimated_len);
+extern char *cp_comp_to_string (struct demangle_component *result,
+				int estimated_len);
 
 /* The list of "maint cplus" commands.  */
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]