public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-keiths-expr-cumulative: Fix rh bz 541093
@ 2009-12-02 18:05 swagiaal
  0 siblings, 0 replies; only message in thread
From: swagiaal @ 2009-12-02 18:05 UTC (permalink / raw)
  To: archer-commits

The branch, archer-keiths-expr-cumulative has been updated
       via  f3e1558f5fe481a645f628a05197beb76c063b6a (commit)
      from  a81cfe86441450877621addb7866d1f10caefce5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit f3e1558f5fe481a645f628a05197beb76c063b6a
Author: Sami Wagiaalla <swagiaal@redhat.com>
Date:   Tue Dec 1 12:01:41 2009 -0500

    Fix rh bz 541093

-----------------------------------------------------------------------

Summary of changes:
 gdb/cp-namespace.c                                 |   73 +++++++++------
 .../gdb.cp/namespace-stress-declarations.cc        |   93 ++++++++++++++++++++
 .../gdb.cp/namespace-stress-declarations.exp       |   50 +++++++++++
 3 files changed, 187 insertions(+), 29 deletions(-)
 create mode 100644 gdb/testsuite/gdb.cp/namespace-stress-declarations.cc
 create mode 100644 gdb/testsuite/gdb.cp/namespace-stress-declarations.exp

First 500 lines of diff:
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index af0ba28..db26a01 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -406,6 +406,16 @@ cp_lookup_symbol_in_namespace (const char *namespace,
     }
 }
 
+/* Used for cleanups to reset the "searched" flag incase
+   of an error.  */
+
+static void
+reset_directive_searched (void *data)
+{
+  struct using_direct *direct = data;
+  direct->searched = 0;
+}
+
 /* Search for NAME by applying all import statements belonging
    to BLOCK which are applicable in SCOPE. If DECLARATION_ONLY the search
    is restricted to using declarations.
@@ -433,16 +443,17 @@ cp_lookup_symbol_in_namespace (const char *namespace,
 
 struct symbol *
 cp_lookup_symbol_imports (const char *scope,
-                            const char *name,
-                            const struct block *block,
-                            const domain_enum domain,
-                            int declaration_only,
-                            int search_parents)
+                          const char *name,
+                          const struct block *block,
+                          const domain_enum domain,
+                          int declaration_only,
+                          int search_parents)
 {
   struct using_direct *current;
   struct symbol *sym = NULL;
   int directive_match;
   int current_line;
+  struct cleanup *searched_cleanup;
 
   if(!declaration_only)
     /* First, try to find the symbol in the given namespace.  */
@@ -478,6 +489,8 @@ cp_lookup_symbol_imports (const char *scope,
           !current->searched)
 	{
 	  current->searched = 1;
+	  searched_cleanup = make_cleanup (reset_directive_searched, current);
+
 	  /* If there is an import of a single declaration, compare the imported
 	     declaration with the sought out name. If there is a match pass
 	     current->import_src as NAMESPACE to direct the search towards the
@@ -486,23 +499,25 @@ cp_lookup_symbol_imports (const char *scope,
 	    {
 	    if (strcmp (name, current->declaration) == 0)
 	      {
-	        sym = cp_lookup_symbol_in_namespace (current->import_src,
-	                                          name,
-	                                          block,
-	                                          domain);
+	      sym = cp_lookup_symbol_in_namespace (current->import_src,
+	                                           name,
+	                                           block,
+	                                           domain);
 	      }
+
+	    current->searched = 0;
+	    if (sym)
+	      return sym;
+
+	    continue;
 	    }
 	   
 	  if (declaration_only)
-            {
-              current->searched = 0;
-              if (sym)
-                {
-                  return sym;
-                } else {
-                  continue;
-                }
-            }
+	    {
+	    current->searched = 0;
+	    discard_cleanups (searched_cleanup);
+	    continue;
+	    }
 
 	  if (strcmp (name, current->alias) == 0)
 	    /* If the import is creating an alias and the alias matches the
@@ -510,25 +525,25 @@ cp_lookup_symbol_imports (const char *scope,
 	       search towards the aliased namespace */
 	    {
 	    sym = cp_lookup_symbol_in_namespace (scope,
-	                                      current->import_src,
-	                                      block,
-	                                      domain);
+	                                         current->import_src,
+	                                         block,
+	                                         domain);
 	    } else if (strcmp ("", current->alias) == 0){
 	    /* If this import statement creates no alias, pass current->inner as
 	       NAMESPACE to direct the search towards the imported namespace. */
 	      sym = cp_lookup_symbol_imports (current->import_src,
-		                                name,
-		                                block,
-		                                domain,
-		                                0,
-		                                0);
+	                                      name,
+	                                      block,
+	                                      domain,
+	                                      0,
+	                                      0);
 	    }
 
 	  current->searched = 0;
+	  discard_cleanups (searched_cleanup);
+
 	  if (sym != NULL)
-	    {
-	      return sym;
-	    }
+	    return sym;
 	}
     }
 
diff --git a/gdb/testsuite/gdb.cp/namespace-stress-declarations.cc b/gdb/testsuite/gdb.cp/namespace-stress-declarations.cc
new file mode 100644
index 0000000..173e49b
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/namespace-stress-declarations.cc
@@ -0,0 +1,93 @@
+int a;
+int b;
+int c;
+int d;
+int e;
+int f;
+int g;
+int h;
+int i;
+int j;
+int k;
+int l;
+int m;
+int n;
+int o;
+int p;
+int q;
+int r;
+int s;
+int t;
+int u;
+int v;
+int w;
+int x;
+int y;
+int z;
+
+namespace A
+{
+  int xyz;
+
+  using ::a;
+  using ::b;
+  using ::c;
+  using ::d;
+  using ::e;
+  using ::f;
+  using ::g;
+  using ::h;
+  using ::i;
+  using ::j;
+  using ::k;
+  using ::l;
+  using ::m;
+  using ::n;
+  using ::o;
+  using ::p;
+  using ::q;
+  using ::r;
+  using ::s;
+  using ::t;
+  using ::u;
+  using ::v;
+  using ::w;
+  using ::x;
+  using ::y;
+  using ::z;
+
+}
+
+using A::a;
+using A::b;
+using A::c;
+using A::d;
+using A::e;
+using A::f;
+using A::g;
+using A::h;
+using A::i;
+using A::j;
+using A::k;
+using A::l;
+using A::m;
+using A::n;
+using A::o;
+using A::p;
+using A::q;
+using A::r;
+using A::s;
+using A::t;
+using A::u;
+using A::v;
+using A::w;
+using A::x;
+using A::y;
+using A::z;
+
+using namespace A;
+
+int main ()
+{
+  return 0;
+}
\ No newline at end of file
diff --git a/gdb/testsuite/gdb.cp/namespace-stress-declarations.exp b/gdb/testsuite/gdb.cp/namespace-stress-declarations.exp
new file mode 100644
index 0000000..f22a14e
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/namespace-stress-declarations.exp
@@ -0,0 +1,50 @@
+# Copyright 2008 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+if $tracelevel then {
+    strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile namespace-stress-declarations
+set srcfile ${testfile}.cc
+set binfile ${objdir}/${subdir}/${testfile}
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
+    untested "Couldn't compile test program"
+    return -1
+}
+
+if [get_compiler_info ${binfile}] {
+    return -1;
+}
+
+# Get things started.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+if ![runto_main] then {
+    perror "couldn't run to breakpoint main"
+    continue
+}
+
+############################################
+# Test that the search can fail efficiently 
+
+gdb_test "print fakex" "No symbol \"fakex\" in current context."


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-12-02 18:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-02 18:05 [SCM] archer-keiths-expr-cumulative: Fix rh bz 541093 swagiaal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).