]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
commit f658463559c9f03672b0fd226e4941f159e65bc0
authorJan Kratochvil <jan.kratochvil@redhat.com>
Sat, 2 Jul 2011 19:37:21 +0000 (19:37 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Sat, 2 Jul 2011 19:37:21 +0000 (19:37 +0000)
Author: Keith Seitz <keiths@redhat.com>
Date:   Tue May 31 21:54:06 2011 +0000

gdb/
PR symtab/12704
* cp-namespace.c (ANONYMOUS_NAMESPACE_LEN): Remove.
(cp_scan_for_anonymous_namespaces): Use CP_ANONYMOUS_NAMESPACE_STR
and CP_ANONYMOUS_NAMESPACE_LEN.
(cp_is_anonymous): Likewise.
* cp-support.h (CP_ANONYMOUS_NAMESPACE_STR): Define.
(CP_ANONYMOUS_NAMESPACE_LEN): Define.
* dwarf2read.c (namespace_name): Likewise.
(fixup_partial_die): Likewise.
* linespec.c (decode_compound): If CP_ANONYMOUS_NAMESPACE_STR is
seen in the input, keep it.

gdb/ChangeLog
gdb/cp-namespace.c
gdb/cp-support.h
gdb/dwarf2read.c
gdb/linespec.c

index 6293da198216da9aa810b275bc3c1dd78d627f75..96409b5df31679f2fddc989820236fee9acf5c33 100644 (file)
@@ -1,3 +1,17 @@
+2011-07-02  Keith Seitz  <keiths@redhat.com>
+
+       PR symtab/12704
+       * cp-namespace.c (ANONYMOUS_NAMESPACE_LEN): Remove.
+       (cp_scan_for_anonymous_namespaces): Use CP_ANONYMOUS_NAMESPACE_STR
+       and CP_ANONYMOUS_NAMESPACE_LEN.
+       (cp_is_anonymous): Likewise.
+       * cp-support.h (CP_ANONYMOUS_NAMESPACE_STR): Define.
+       (CP_ANONYMOUS_NAMESPACE_LEN): Define.
+       * dwarf2read.c (namespace_name): Likewise.
+       (fixup_partial_die): Likewise.
+       * linespec.c (decode_compound): If CP_ANONYMOUS_NAMESPACE_STR is
+       seen in the input, keep it.
+
 2011-07-02  Keith Seitz  <keiths@redhat.com>
 
        PR breakpoint/12803
index bdbc215a74456391ff7f65e6f9081945a72f4335..cc761c8cd1a106061341f8fe67cbbbc80869018c 100644 (file)
@@ -70,10 +70,6 @@ static void maintenance_cplus_namespace (char *args, int from_tty);
 /* Check to see if SYMBOL refers to an object contained within an
    anonymous namespace; if so, add an appropriate using directive.  */
 
-/* Optimize away strlen ("(anonymous namespace)").  */
-
-#define ANONYMOUS_NAMESPACE_LEN 21
-
 void
 cp_scan_for_anonymous_namespaces (const struct symbol *symbol)
 {
@@ -94,10 +90,11 @@ cp_scan_for_anonymous_namespaces (const struct symbol *symbol)
 
       while (name[next_component] == ':')
        {
-         if ((next_component - previous_component) == ANONYMOUS_NAMESPACE_LEN
+         if (((next_component - previous_component)
+              == CP_ANONYMOUS_NAMESPACE_LEN)
              && strncmp (name + previous_component,
-                         "(anonymous namespace)",
-                         ANONYMOUS_NAMESPACE_LEN) == 0)
+                         CP_ANONYMOUS_NAMESPACE_STR,
+                         CP_ANONYMOUS_NAMESPACE_LEN) == 0)
            {
              int dest_len = (previous_component == 0
                              ? 0 : previous_component - 2);
@@ -225,7 +222,7 @@ cp_set_block_scope (const struct symbol *symbol,
 int
 cp_is_anonymous (const char *namespace)
 {
-  return (strstr (namespace, "(anonymous namespace)")
+  return (strstr (namespace, CP_ANONYMOUS_NAMESPACE_STR)
          != NULL);
 }
 
index 5902dcb6c0b65c76658149a3bdcdfa1383f733e6..bb0ba398f090b22edd08eef0e3ff4aa8f4f8476d 100644 (file)
@@ -36,6 +36,14 @@ struct objfile;
 struct type;
 struct demangle_component;
 
+/* A string representing the name of the anonymous namespace used in GDB.  */
+
+#define CP_ANONYMOUS_NAMESPACE_STR "(anonymous namespace)"
+
+/* The length of the string representing the anonymous namespace.  */
+
+#define CP_ANONYMOUS_NAMESPACE_LEN 21
+
 /* This struct is designed to store data from using directives.  It
    says that names from namespace IMPORT_SRC should be visible within
    namespace IMPORT_DEST.  These form a linked list; NEXT is the next
index 51e0442ffbeb0cc5face1e09ce011eb3d5089cb0..e93451feee56b0a444652f55a6cd5fe13baceea1 100644 (file)
@@ -7822,7 +7822,7 @@ namespace_name (struct die_info *die, int *is_anonymous, struct dwarf2_cu *cu)
 
   *is_anonymous = (name == NULL);
   if (*is_anonymous)
-    name = "(anonymous namespace)";
+    name = CP_ANONYMOUS_NAMESPACE_STR;
 
   return name;
 }
@@ -9478,7 +9478,7 @@ fixup_partial_die (struct partial_die_info *part_die,
   /* Set default names for some unnamed DIEs.  */
 
   if (part_die->name == NULL && part_die->tag == DW_TAG_namespace)
-    part_die->name = "(anonymous namespace)";
+    part_die->name = CP_ANONYMOUS_NAMESPACE_STR;
 
   /* If there is no parent die to provide a namespace, and there are
      children, see if we can determine the namespace from their linkage
index f79df2e42c7f683532d2a4b0b00b106948c2ccd3..fdca109fb53c828266f1818927a54684c0ea2ed6 100644 (file)
@@ -1429,8 +1429,15 @@ decode_compound (char **argptr, int funfirstline,
            {
              /* PASS2: We'll keep getting here, until P points to one of the
                 break characters, at which point we exit this loop.  */
-             if (*p && strchr (break_characters, *p) == NULL)
-               p++;
+             if (*p)
+               {
+                 if (p[1] == '('
+                     && strncmp (&p[1], CP_ANONYMOUS_NAMESPACE_STR,
+                                 CP_ANONYMOUS_NAMESPACE_LEN) == 0)
+                   p += CP_ANONYMOUS_NAMESPACE_LEN;
+                 else if (strchr (break_characters, *p) == NULL)
+                   ++p;
+               }
            }
        }